Objective c 生成一个错误";XPC连接中断“;当本地通知在XCode 8中发出时,模拟器停止工作

Objective c 生成一个错误";XPC连接中断“;当本地通知在XCode 8中发出时,模拟器停止工作,objective-c,xcode8,ios10,unusernotificationcenter,Objective C,Xcode8,Ios10,Unusernotificationcenter,我已经更新了xcode 8,因此无法获得本地通知 [self NotificationSettingMethod]; if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) { UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init]; content.body=[NSString stringWithFormat:@

我已经更新了xcode 8,因此无法获得本地通知

[self NotificationSettingMethod];

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0"))
{
    UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];
    content.body=[NSString stringWithFormat:@"Still not visited at %@",[dictData valueForKey:@"Name"]];
    content.sound = [UNNotificationSound defaultSound];
    content.badge = @([[UIApplication sharedApplication] applicationIconBadgeNumber] + 1);
    UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger
                                                  triggerWithTimeInterval:10.0f repeats:NO];
    UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:@""content:content trigger:trigger];
    UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
    [center addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error)
     {
         if (!error)
         {
             NSLog(@"add NotificationRequest succeeded!");
         }
     }];
}
else
{
    UILocalNotification *StillNotVisit = [[UILocalNotification alloc]init];
    StillNotVisit.fireDate=[NSDate dateWithTimeIntervalSinceNow:1];
    StillNotVisit.alertBody=[NSString stringWithFormat:@"Still not visited at %@",[dictData valueForKey:@"Name"]];
    StillNotVisit.timeZone=[NSTimeZone defaultTimeZone];
    StillNotVisit.repeatInterval = 0;
    StillNotVisit.hasAction=YES;
    StillNotVisit.soundName = UILocalNotificationDefaultSoundName;
}

-(void)NotificationSettingMethod
{
    [self registerNotificationSettingsCompletionHandler:^(BOOL granted, NSError * _Nullable error)
     {
         if (!error)
          {
             NSLog(@"request authorization succeeded!");
         }
     }];
}