알림이 실행될 때 앱이 있습니다. 앱이 백그라운드에있을 때 알림 바가 표시됩니다. 알림 바의 탭을 탐색 할 때 알림 바를 탭하면됩니다. 내가 배경에서 응용 프로그램을 종료하면 알림을 받고 있지만 통지 표시 줄 탭 때 응용 프로그램이 tableview의 indexpath를 가져 오지 않아 충돌이 발생합니다.didFinishLaunchingWithOptions가 호출 될 때 앱이 충돌합니다.
앱이 백그라운드에서 종료되고 다시로드되면 앱이 didfinishlaunching을 입력해야합니다. appDidFinishLaunching에서
난 당신이 응용 프로그램을 종료하고 앱이 viewController
가 아직 설정되지 않은, 다시 시작할 때의 tableview
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[PPViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil] ;
UILocalNotification *notification = [launchOptions objectForKey: UIApplicationLaunchOptionsLocalNotificationKey];
if (notification)
{
int remedyID = [[notification.userInfo objectForKey:kRemindMeNotificationRemedyIDKey] intValue];
NSDictionary *reminderDetails =[NSDictionary dictionaryWithObjectsAndKeys:notification.userInfo,@"kRemindMeNotificationDataKey",[NSNumber numberWithInt:remedyID],kRemindMeNotificationRemedyIDKey,nil];
[_viewController goToReminder:reminderDetails showNotification:YES];
}
[application setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
self.viewController = [[PPViewController alloc] initWithNibName:@"PPViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
**This is the code which navigates into tableview in another viewcontroller**
- (void)goToReminder:(NSMutableDictionary *)reminderDictionary showNotification:(BOOL)shouldShowNotification
{
NSIndexPath *selectedSymptIP = [NSIndexPath indexPathForRow:selectedSymptomIndex inSection:keyIndexNumber];
[self tableView:symptomsTableView didSelectRowAtIndexPath:selectedSymptIP];
}
앱이 어떤 라인에서 충돌하고 있습니까? 충돌 로그가 있습니까? –
@Ric 앱이 백그라운드에서 종료되고 알림 바를 클릭하여 알림이 시작되면 앱이 다운됩니다. 앱이 백그라운드에서 실행 중이고 알림이 시작된 경우 ... 바를 클릭하면 앱이 제대로 탐색합니다. – raptor
감사합니다. 'application didFinishLaunchingWithOptions :'의 첫 번째 줄에 중단 점을 설정하고 메서드를 단계별로 실행하면 충돌이 어디에서 발생합니까? 내 생각 엔 userInfo가 제대로 디코딩되지 않으면이 줄'int remedyID = [[notification.userInfo objectForKey : kRemindMeNotificationRemedyIDKey] intValue];가 문제가 될 수 있습니다. –