谁能帮我解决以下问题?每次当我尝试触摸和向下滑动的通知。我得到以下错误和iOS模拟器重新启动。我试着重新安装Xcode,它没有帮助。我试过不同版本的模拟器。从iphone6到iphone8
Process: SpringBoard [5139]
Path: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/CoreServices/SpringBoard.app/SpringBoard
Identifier: SpringBoard
Version: 1.0 (50)
Code Type: X86-64 (Native)
Parent Process: launchd_sim [4875]
Responsible: SpringBoard [5139]
User ID: 501
Date/Time: 2017-10-28 08:09:15.159 +0200
OS Version: Mac OS X 10.13 (17A405)
Report Version: 12
Anonymous UUID: CF9C10C7-F4C9-1CC8-7D45-E336797E531B
Sleep/Wake UUID: CE87E042-97E5-49EF-8466-B49FDB0354A9
Time Awake Since Boot: 47000 seconds
Time Since Wake: 630 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Failed to receive a participant from the arbiter'
terminating with uncaught exception of type NSException
abort() called
CoreSimulator 494.22.3 - Device: iPhone 8 - Runtime: iOS 11.0 (15A8401) - DeviceType: iPhone 8
以下是我的viewController代码
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// 1. REQUEST PERMISSION
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { (granted, error) in
if granted {
print("Notification access granted")
} else {
print(error?.localizedDescription as Any)
}
}
}
@IBAction func notoify(_ sender: UIButton) {
scheduleNotification(inSeconds: 5, completion: {
success in if success {
print("Ok")
} else {
print("Error scheduled notification")
}
})
}
func scheduleNotification(inSeconds: TimeInterval, completion: @escaping (_ Success: Bool) -> ()){
let notification = UNMutableNotificationContent()
notification.title = "Notification"
notification.subtitle = "These are great"
notification.body = "Test test test test test test test test"
let notificationTrigger = UNTimeIntervalNotificationTrigger(timeInterval: inSeconds, repeats: false)
let notificationRequest = UNNotificationRequest(identifier: "myNotification", content: notification, trigger: notificationTrigger)
UNUserNotificationCenter.current().add(notificationRequest, withCompletionHandler: {
error in if error != nil {
print(error as Any)
completion(false)
}
else {
completion(true)
}
})
}
}
我最近跑到这个问题后,我更新了我的xcode到11.4.1版本。只有我得到了这个问题固定完全卸载xcode和重新安装它。一旦重新安装完成,我没有看到这个错误了,我所有的Flutter和其他移动项目的工作没有任何问题了。
在遇到完全相同的问题后,完全卸载XCode并重新安装对我来说也是有效的。