Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
495 views
in Technique[技术] by (71.8m points)

iphone - Is the APN Device Token unique to each individual app?

I have two apps on the iTunes store - both implement push notifications. While I was testing sending notifications to these production apps, I noticed that a push intended for app A was titled and opened app B.

Both of these apps are installed on the same phone. I looked in my device table and saw that the device Tokens (and of course, the Device ID) listed for the two apps were both the same.

As required, I am using two different certificates on the server - one for each app. I sort of assumed the device Token or certificate would route the message to the right app but clearly it isn't.

I can see in NSLog that the tokens being sent from each app are indeed the same.

Should the device Token be unique to each app? If so, any idea how my test phone could be sending the same device token for both apps to my server. Keep in mind this is from two apps currently on the app store.

Thanks for any help!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

NOTE: this is an old answer that is true only for iOS <= 6. See user1641761's answer for the current approach.

Figured it out. The Device Tokens are NOT unique to the phone-app pairing. They are unique to the phone only. If you have multiple apps with push on the same phone they will all use the same Device Token. The certificate you use to send the notification will dictate which app it goes to.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...