didRegisterForRemoteNotificationsWithDeviceToken
メソッドでデバイストークンを取得しました。私は別の方法でデバイストークンを使いたかったのです。私はこのようなDevice Token
は "nosniff" と返しているんdidRegisterForRemoteNotificationsWithDeviceToken以外の方法でデバイストークンを使用する方法?
NSLog(@"Device Token : %@",str);
:didReceiveRemoteNotification
方法で
str = [NSString stringWithFormat:@"%@",deviceToken];
// str is the NSString which is declared in the appDelegate.h file as global variable
:私は、このようにdidRegisterForRemoteNotificationsWithDeviceToken
方法で
を、それを試してみました。
このデバイストークンをグローバル変数に格納し、それを他のクラスまたは他の方法で使用するにはどうすればよいですか。
CustomAppDelegate
は、アプリのデリゲートクラスの名前です
+ (CustomAppDelegate *)sharedAppDelegate
{
return (CustomAppDelegate *) [UIApplication sharedApplication].delegate;
}
:アプリのデリゲートクラスで
これはアプリの起動画面を開いていますが、すべてのビューコントローラが読み込まれていない場合は空白にすることができます私はこの[[UIapplication sharedApplication] setDelegate:self]を実行したら、これを試しましたが、 - > App launch - > DidfinishlaunchwithOnption Called - >初期View Controllerがviewdidloadのために呼び出されませんでした –