我已经尝试了很多教程来为我的应用程序发送推送通知服务。当我在设备上测试它时它可以工作。但是如果我在我的应用程序在 App Store 上启动后对其进行实时测试,并且我通过从商店下载将它安装在我的设备上,我运行 php 文件以发送推送通知,我没有收到它。这是代码我用于推送通知和我从中学到的教程。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
return YES;
}
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
NSLog(@"My token is: %@", deviceToken);
}
- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
NSLog(@"Failed to get token, error: %@", error);
}
是否有任何教程可以教我实时使用它。我将我的 php 文件的环境从沙箱更改为实时。请指导。