Apple Push Notification Service を使用して、iPhone アプリケーションから deviceToken を取得しようとしています。当分の間、サーバー側での実装はありません。APP Id を作成し、SSL 証明書を取得し、APN を使用してプロファイルをプロビジョニングし、呼び出しを行いました
- (void)applicationDidFinishLaunching:(UIApplication *)application {
//view init and add sub view to window
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound];
}
方法。アプリケーションを実行すると、プッシュ通知を許可するアクション ボックスがポップアップ表示されます (APN 登録の要求が機能していることを意味します) が、コールバックは実行されません。didRegisterForRemoteNotificationsWithDeviceTokenもdidFailToRegisterForRemoteNotificationsWithErrorも呼び出されていませんか? 誰でも問題を解決するのを手伝ってもらえますか? 以下は、参照用の私のコールバックです。
- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err {
UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"APNClient" message:@"Entered into Error Method" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[myAlert show];
[myAlert release];
NSLog(@"Error in registration. Error: %@", err);
}
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken {
UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"APNClient" message:@"Got the deviceToken..!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[myAlert show];
[myAlert release];
}