显示警报时出现NSException

时间:2017-04-17 03:00:10

标签: ios swift nsexception

我正在为我正在制作的社交媒体应用创建朋友请求系统。当用户尝试向他们已经发送过一个用户的用户发送好友请求时,我想要显示一个警告,告诉用户他们已经向此人发送了好友请求。它大部分都不起作用......虽然它在调试模式下有几次。我不确定这里发生了什么;任何启蒙都会非常感激。

我的代码:

let alert = UIAlertController(title: ALREADY_SENT_REQUEST_ALERT_TITLE, message: ALREADY_SENT_REQUEST_ALERT_MESSAGE, preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: OK, style: UIAlertActionStyle.default, handler: nil))
self.present(alert, animated: true, completion: nil)

如果您愿意,我可以提供有关此代码的更多信息。让我知道。

此外,这是错误消息和回溯:

libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) bt
* thread #9: tid = 0x2b66a, 0x00000001870d7014 
libsystem_kernel.dylib`__pthread_kill + 8, queue = 
'com.apple.cloudkit.operation-FDC3BA3D714031D6.callback', stop reason = signal SIGABRT
frame #0: 0x00000001870d7014 libsystem_kernel.dylib`__pthread_kill + 8
frame #1: 0x000000018719f450 libsystem_pthread.dylib`pthread_kill + 112
frame #2: 0x000000018704b400 libsystem_c.dylib`abort + 140
frame #3: 0x0000000186b152d4 libc++abi.dylib`abort_message + 132
frame #4: 0x0000000186b32cc0 libc++abi.dylib`default_terminate_handler() + 304
frame #5: 0x0000000186b40844 libobjc.A.dylib`_objc_terminate() + 124
frame #6: 0x0000000186b2f66c libc++abi.dylib`std::__terminate(void (*)()) + 16
frame #7: 0x0000000186b2ef84 libc++abi.dylib`__cxa_throw + 136
frame #8: 0x0000000186b40690 libobjc.A.dylib`objc_exception_throw + 364
frame #9: 0x000000018810908c CoreFoundation`+[NSException raise:format:arguments:] + 104
frame #10: 0x0000000188bc102c Foundation`-[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 112
frame #11: 0x000000018dfeabe4 UIKit`-[UIKeyboardTaskQueue waitUntilAllTasksAreFinished] + 176
frame #12: 0x000000018dfeb638 UIKit`-[UIKeyboardImpl setDelegate:force:] + 1332
frame #13: 0x000000018dfe4ee8 UIKit`-[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:] + 1088
frame #14: 0x000000018e6b79ac UIKit`-[UIPeripheralHost(UIKitInternal) _preserveInputViewsWithId:animated:reset:] + 504
frame #15: 0x000000018e329324 UIKit`-[UIViewController _presentViewController:modalSourceViewController:presentationController:animationController:interactionController:completion:] + 1156
frame #16: 0x000000018e32adec UIKit`-[UIViewController _presentViewController:withAnimationController:completion:] + 4524
frame #17: 0x000000018e32d920 UIKit`-[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 524
frame #18: 0x000000018e0b1154 UIKit`-[UIViewController presentViewController:animated:completion:] + 184
* frame #19: 0x000000010005a270 MyNetwork`ConnectViewController.(thisUserRecord=0x0000000100f4f6f0, err2=nil, userRefToSendTo=0x000000017003af60, self=0x0000000100e129a0, sender=0x0000000100f31ad0, thisUserRecordId=0x000000017002b100, userRecordToSendTo=0x0000000100f500c0) -> ()).(closure #1).(closure #2).(closure #3).(closure #1).(closure #1) + 2076 at ConnectViewController.swift:236
frame #20: 0x000000010004db1c MyNetwork`thunk + 144 at ProfileTableViewCell.swift:0
frame #21: 0x0000000192647e0c CloudKit`__70-[CKDatabase(ConvenienceMethods) fetchRecordWithID:completionHandler:]_block_invoke + 428
frame #22: 0x0000000192664308 CloudKit`-[CKFetchRecordsOperation _finishOnCallbackQueueWithError:] + 652
frame #23: 0x000000019262df18 CloudKit`-[CKOperation _finishInternalOnCallbackQueueWithError:] + 504
frame #24: 0x000000019262dd0c CloudKit`-[CKOperation _handleCompletionCallback:] + 120
frame #25: 0x0000000100cb5258 libdispatch.dylib`_dispatch_call_block_and_release + 24
frame #26: 0x0000000100cb5218 libdispatch.dylib`_dispatch_client_callout + 16
frame #27: 0x0000000100cc2aec libdispatch.dylib`_dispatch_queue_serial_drain + 1136
frame #28: 0x0000000100cb8ce0 libdispatch.dylib`_dispatch_queue_invoke + 672
frame #29: 0x0000000100cc4e2c libdispatch.dylib`_dispatch_root_queue_drain + 584
frame #30: 0x0000000100cc4b78 libdispatch.dylib`_dispatch_worker_thread3 + 140
frame #31: 0x000000018719b2a0 libsystem_pthread.dylib`_pthread_wqthread + 1288
frame #32: 0x000000018719ad8c libsystem_pthread.dylib`start_wqthread + 4
(lldb) 

谢谢你看看这个!

0 个答案:

没有答案