我为tableView设置了手势识别器:
let longPress = UILongPressGestureRecognizer(target: self, action: "longPressDetected:")
self.tableView.addGestureRecognizer(longPress)
当我尝试它时,它工作正常。我已将应用程序发送到beta测试版,但我已多次使用此日志崩溃:
Thread : Crashed: com.apple.main-thread
0 IamDJ 4295807340 specialized ProjectDetailViewController.longPressDetected(AnyObject) -> () (ProjectDetailViewController.swift)
1 IamDJ 4295765652 @objc ProjectDetailViewController.longPressDetected(AnyObject) -> () (ProjectDetailViewController.swift)
2 UIKit 6613447472 _UIGestureRecognizerSendTargetActions + 164
3 UIKit 6609423196 _UIGestureRecognizerSendActions + 172
4 UIKit 6607906908 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 784
5 UIKit 6613452556 ___UIGestureRecognizerUpdate_block_invoke898 + 72
6 UIKit 6607640760 _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 372
7 UIKit 6607627836 _UIGestureRecognizerUpdate + 2404
8 UIKit 6607898316 -[UIWindow _sendGesturesForEvent:] + 1132
9 UIKit 6607895752 -[UIWindow sendEvent:] + 764
10 UIKit 6607701156 -[UIApplication sendEvent:] + 248
11 UIKit 6607693676 _UIApplicationHandleEventQueue + 5528
12 CoreFoundation 6517671236 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
13 CoreFoundation 6517669848 __CFRunLoopDoSources0 + 540
14 CoreFoundation 6517660888 __CFRunLoopRun + 724
15 CoreFoundation 6516804768 CFRunLoopRunSpecific + 384
16 GraphicsServices 6703693960 GSEventRunModal + 180
17 UIKit 6608130044 UIApplicationMain + 204
18 IamDJ 4296201300 main (AppDelegate.swift:15)
19 libdyld.dylib 6874491064 start + 4
我怎样才能找到问题所在? longPressDetected
方法有什么问题?我在最近2个小时内尝试过这种方法,没有任何事情发生。我使用相同的设备和相同的iOS版本(iPhone 6,iOS 9.1)。其中一个日志中有5%的可用RAM。释放内存会有问题吗?谢谢你的帮助