我的AppDelegate.m
中有以下方法。我想的deviceToken
值在我UIViewController
將appdelegate數據傳遞給視圖控制器
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
NSLog(@"My token is: %@", deviceToken);
ViewController *viewController = [[ViewController alloc]initWithNibName:@"ViewController" bundle:nil];
viewController.tokenStr = [NSString stringWithFormat:@"%@",deviceToken];
}
,但是當我在UIViewController
顯示NSLog(@"%@",tokenStr);
我越來越(NULL)
。 我如何獲得我的UIViewController
中的值?
你如何顯示'ViewController'?在推送該對象之前添加。 – iDev
對不起,我不明白你的意思? –
您可以發表您在屏幕上顯示ViewController的代碼。上面的代碼只是創建一個對象,並沒有別的。應該在屏幕上顯示它。你需要在那裏添加。 – iDev