我使用Parse.com发送推送通知我的iOS应用。 但是当我执行下面的代码来创建PFInstallation
对象时,设备令牌字段为空。didRegisterForRemoteNotificationsWithDeviceToken不执行 - 推送通知
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)newDeviceToken {
// Store the deviceToken in the current installation and save it to Parse.
NSLog(@"didRegisterForRemoteNotificationsWithDeviceToken");
PFInstallation *currentInstallation = [PFInstallation currentInstallation];
[currentInstallation setDeviceTokenFromData:newDeviceToken];
[currentInstallation saveInBackground];
}
didFinishLaunchingWithOptions
方法
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[Parse setApplicationId:@"xhjhkk869698lhlljk554hl55khlkhl4ff99065" clientKey:@"spg1t6jad1ShK2lh5456khh6j7j4nmn1YD6J6rl8vt3"];
[PFAnalytics trackAppOpenedWithLaunchOptions:launchOptions];
[FBProfilePictureView class];
// Register for push notifications
[application registerForRemoteNotificationTypes:
UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeAlert |
UIRemoteNotificationTypeSound];
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
return YES;
}
我注意到,从不执行didRegisterForRemoteNotificationsWithDeviceToken
。我过检查了我的证书和配置配置文件,我使用的方法指定here(见下制作一个PEM文件)对它们进行测试。证书和连接正常工作。我还检查了我的wifi是否阻止推送通知,没有问题。
所以任何人都可以请建议我在做什么错在这里?
是警报空间PoPing当你注册远程通知? – soryngod
没有任何反应 –
您是在设备上还是在模拟器上测试应用程序? – soryngod