如何在 IOS 中实施推送通知
How to implement Push Notifications in IOS
http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1
我已经完成了上述所有步骤link。现在我的推送通知 Apple id、证书和设置已经完成。
任何人都可以建议下一步是什么。
您需要从应用程序端调用该服务。
- (void)callService
{
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.example.com/test/samplePush.php"]];
NSMutableURLRequest * rq = [ NSMutableURLRequest requestWithURL:url];
[rq setHTTPMethod:@"POST"];
[rq setValue:postLen forHTTPHeaderField:@"Content-Length"];
[rq setValue:@"application/x-www-urlencoded" forHTTPHeaderField:@"Content-Type"];
NSURLConnection *con = [[NSURLConnection alloc]initWithRequest:rq delegate:self];
NSLog(@"%@",postLen);
if(con) {
NSLog(@"connected");
}
NSLog(@"%@",con);
}
在他的教程中,这个人很好地解释了如何使用 php 脚本发送推送通知。
如果 Mac 中安装了 MAMP,则可以轻松使用它。您还可以使用免费服务 PushWoosh 来发送推送通知。
http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1
我已经完成了上述所有步骤link。现在我的推送通知 Apple id、证书和设置已经完成。
任何人都可以建议下一步是什么。
您需要从应用程序端调用该服务。
- (void)callService
{
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.example.com/test/samplePush.php"]];
NSMutableURLRequest * rq = [ NSMutableURLRequest requestWithURL:url];
[rq setHTTPMethod:@"POST"];
[rq setValue:postLen forHTTPHeaderField:@"Content-Length"];
[rq setValue:@"application/x-www-urlencoded" forHTTPHeaderField:@"Content-Type"];
NSURLConnection *con = [[NSURLConnection alloc]initWithRequest:rq delegate:self];
NSLog(@"%@",postLen);
if(con) {
NSLog(@"connected");
}
NSLog(@"%@",con);
}
在他的教程中,这个人很好地解释了如何使用 php 脚本发送推送通知。 如果 Mac 中安装了 MAMP,则可以轻松使用它。您还可以使用免费服务 PushWoosh 来发送推送通知。