iPod touch 4 でアプリをテストしようとしていますが、APNS サポートが必要です。
APNS のどちらのデリゲート コールバックも呼び出されていないことがわかりました。
Technical Noteを検索しましたが、役に立ちません (私の iPad2 でも同じコードが機能するため、デバイス トークンが返されます)。
これについて何か考えはありますか?
iOS 5.1.1 で iPod touch 4 を使用しています
編集:
ああ、ここで提供される詳細情報。これらすべての証明書と同様に、事前にプロビジョニング プロファイルを作成しました。だから私はiPadでそれを解決することができます。
そして今日、iPod touch 4 を開発デバイスとして追加し、プロビジョニング プロファイルを再度ダウンロードしました。この行為は、APNS ジョブを処理できるように私の iPod touch 4 を登録しないのでしょうか????
編集2:
リクエストに応じて:
実際、私はAppleが私に要求したことを何でもするだけです。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: NSDictionary *)launchOptions
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeBadge)];
//Other codes...
}
次に、2 つのデリゲートのコールバック メソッド
#pragma mark - For Apple Push Notification Service
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
NSString *str = [NSString
stringWithFormat:@"%@",deviceToken];
NSString *devToken = [[[[str description]
stringByReplacingOccurrencesOfString:@"<"withString:@""]
stringByReplacingOccurrencesOfString:@">" withString:@""]
stringByReplacingOccurrencesOfString: @" " withString: @""];
NSLog(@"%@", devToken);
NSUserDefaults *standardUserDefaults = [NSUserDefaults standardUserDefaults];
if (standardUserDefaults)
{
[standardUserDefaults setObject:devToken forKey:@"device_token"];
[standardUserDefaults synchronize];
}
}
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
NSLog(@"application:didFailToRegisterForRemoteNotificationsWithError: %@", error);
}
実際には、Apple から提供されたものをコピーして貼り付けるだけです。ただし、ケースは上記のとおりです。iOS 5.0.1 の iPad2、iOS 4.3 の iPhone ではどちらのメソッドも呼び出されますが、iOS5.1.1 の iPod Touch 4 では呼び出されません。