Very good reference: Http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1
Chinese reference: Part I http://www.tairan.com/archives/194
Part II: http://www.tairan.com/archives/281
Part III: http://www.tairan.com/archives/240
A comparison of the various certificate profiles is presented in detail: http://blog.sina.com.cn/s/blog_7bfb9660010144j6.html
Relationship between bound name and APP ID: http://blog.csdn.net/totogogo/article/details/7377870
Possible problems and a variety of click-Call Apps: http://blog.csdn.net/totogogo/article/details/7385487
In addition, there are cocoa information: http://www.cocoachina.com/bbs/read.php?tid-98797-keyword-%D4%B6%B3%CC%CD%A8%D6%AA.html
http://www.cocoachina.com/bbs/read.php?tid=102110
CSDN on the information: http://www.csdn.net/article/2012-02-18/311976
http://blog.csdn.net/cleverbobywjb/article/details/40109971
The problems you have encountered
1. Error:error Domain=nscocoaerrordomain code=3000 "Cannot find the application's" aps-environment "rights string" userinfo=0x1187ad0
Program Callback Delegate
-(void) application: (uiapplication*) Application Didfailtoregisterforremotenotificationswitherror: (NSError*) error
{
NSLog (@ "Get token failed:%@", error);
}
Error returned: Error:error domain=nscocoaerrordomain code=3000 "Cannot find the application's ' aps-environment ' rights string" userinfo=0x1187ad0
The reason for my error is that Xcode's bundle Identifier is inconsistent with the certificate's app ID
Make sure the three places are consistent.
If the bundle identifier in the first figure cannot be modified, look at the value of bundle identifier in the second figure, which may be the setting in the second diagram that makes the first diagram impossible to modify.
I'm just letting both values be the same as the values in the third diagram.
2.xcode using incorrect configuration file provisioning profile
Xcode automatically uses the configuration file with *, which is not allowed. I specified the configuration file to use:
Click on the debug value where the optional provisioning profile will appear:
Because I am the debug version, so set the debug provisioning profile for the developed provisioning profile, do not use automatic.
3. According to the above English link to run in the terminal
PHP simplepush.php
Appear
Warning:stream_socket_client (): Unable to set private key file '/users/ensurebit/desktop/simplepush/ck.pem ' in/users/ ensurebit/desktop/simplepush/simplepush.php on line 22
Warning:stream_socket_client (): Failed to create a SSL handle in/users/ensurebit/desktop/simplepush/simplepush.php on Line 22
Warning:stream_socket_client (): Failed to enable crypto in/users/ensurebit/desktop/simplepush/simplepush.php in line 22
Warning:stream_socket_client (): Unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in/ users/ensurebit/desktop/simplepush/simplepush.php on line 22
Failed to Connect:0
Checked the file changes 3 places also modified
<?php
Put your device token (without spaces):
$deviceToken = ' Device token without space ';
Put your private key ' s passphrase here:
$passphrase = ' password ';
Put your alert:
$message = ' Push notification information! ';
////////////////////////////////////////////////////////////////////////////////
$ctx = Stream_context_create ();
Stream_context_set_option ($ctx, ' SSL ', ' Local_cert ', ' Ck.pem own Pem ');
The red part needs to be modified into its own value.
It's scratching to surf the internet all kinds of bad. Suddenly found $passphrase = ' password '; this line of password two words of the single quotation mark is not correct, is a full-width symbol, and then changed to Half-width symbol, run, successful. Claps.
$ PHP simplepush.php
Connected to APNs
Message successfully delivered
This means success.
A remote push is received for a single application.