UIActivityViewController 在 Test Flight 中崩溃,但在从 Xcode 构建时不会崩溃
UIActivityViewController crash in Test Flight but not when built from Xcode
我遇到一个奇怪的问题。
我在我的应用程序中集成了一个 UIActivityViewController(处理 iPhone 和 iPad)。当我从 Xcode 构建应用程序时一切正常,但当我在 Test Flight 上分发它时它崩溃了。
这是我用来集成它的代码:
let textToShare = NSLocalizedString("SHARE_APP_TEXT", comment: "text to share")
if let myWebsite = NSURL(string: NSLocalizedString("SHARE_APP_LINK", comment: "link to share"))
{
let objectsToShare = [textToShare, myWebsite]
let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)
activityVC.excludedActivityTypes = [UIActivityTypeAirDrop, UIActivityTypeAddToReadingList]
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.Phone) {
self.presentViewController(activityVC, animated: true, completion: nil)
} else {
var popup:UIPopoverController = UIPopoverController(contentViewController: activityVC)
popup.presentPopoverFromRect(CGRectMake(self.view.frame.size.width/2, self.view.frame.size.height - 50, 0, 0), inView: self.view, permittedArrowDirections: UIPopoverArrowDirection.Any, animated: true)
}
}
感谢 解析崩溃报告 我能够得到这个:
Thread 0 (crashed)
0
CoreFoundation
__exceptionPreprocess @ 0x84
1
libobjc.A.dylib
objc_exception_throw @ 0x38
2
CoreFoundation
+[NSObject(NSObject) doesNotRecognizeSelector:] @ 0xd8
3
CoreFoundation
___forwarding___ @ 0x39c
4
CoreFoundation
_CF_forwarding_prep_0 @ 0x58
5
plizdoo
_TTSf4g_g___TFC7plizdoo23ToDoTableViewController13inviteFriendsfS0_FCSo8UIButtonT_ @ 0x35c
6
plizdoo
_TToFC7plizdoo23ToDoTableViewController13inviteFriendsfS0_FCSo8UIButtonT_ @ 0x24
7
UIKit
-[UIApplication sendAction:to:from:forEvent:] @ 0x5c
8
UIKit
-[UIControl _sendActionsForEvents:withEvent:] @ 0x260
9
UIKit
-[UIControl touchesEnded:withEvent:] @ 0x24c
10
UIKit
_UIGestureRecognizerUpdate @ 0x2154
11
UIKit
-[UIWindow _sendGesturesForEvent:] @ 0x410
12
UIKit
-[UIWindow sendEvent:] @ 0x290
13
UIKit
-[UIApplication sendEvent:] @ 0x104
14
UIKit
_UIApplicationHandleEventFromQueueEvent @ 0x3c3c
15
UIKit
_UIApplicationHandleEventQueue @ 0x6b0
16
CoreFoundation
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ @ 0x14
17
CoreFoundation
__CFRunLoopDoSources0 @ 0x104
18
CoreFoundation
__CFRunLoopRun @ 0x2c4
19
CoreFoundation
CFRunLoopRunSpecific @ 0x188
20
GraphicsServices
GSEventRunModal @ 0xa4
21
UIKit
UIApplicationMain @ 0x5cc
22
plizdoo
main @ 0x98
23
libdyld.dylib
start @ 0x0
如果需要我可以提供完整的崩溃报告
问题是由于 swift 编译器选项造成的。
我是这样解决的:
- Select Target 中的项目
- 构建设置
- Swift 编译器 - 代码生成
- 优化级别
- 将调试和发布设置为:None [-Onone]
我遇到一个奇怪的问题。
我在我的应用程序中集成了一个 UIActivityViewController(处理 iPhone 和 iPad)。当我从 Xcode 构建应用程序时一切正常,但当我在 Test Flight 上分发它时它崩溃了。
这是我用来集成它的代码:
let textToShare = NSLocalizedString("SHARE_APP_TEXT", comment: "text to share")
if let myWebsite = NSURL(string: NSLocalizedString("SHARE_APP_LINK", comment: "link to share"))
{
let objectsToShare = [textToShare, myWebsite]
let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)
activityVC.excludedActivityTypes = [UIActivityTypeAirDrop, UIActivityTypeAddToReadingList]
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.Phone) {
self.presentViewController(activityVC, animated: true, completion: nil)
} else {
var popup:UIPopoverController = UIPopoverController(contentViewController: activityVC)
popup.presentPopoverFromRect(CGRectMake(self.view.frame.size.width/2, self.view.frame.size.height - 50, 0, 0), inView: self.view, permittedArrowDirections: UIPopoverArrowDirection.Any, animated: true)
}
}
感谢 解析崩溃报告 我能够得到这个:
Thread 0 (crashed)
0
CoreFoundation
__exceptionPreprocess @ 0x84
1
libobjc.A.dylib
objc_exception_throw @ 0x38
2
CoreFoundation
+[NSObject(NSObject) doesNotRecognizeSelector:] @ 0xd8
3
CoreFoundation
___forwarding___ @ 0x39c
4
CoreFoundation
_CF_forwarding_prep_0 @ 0x58
5
plizdoo
_TTSf4g_g___TFC7plizdoo23ToDoTableViewController13inviteFriendsfS0_FCSo8UIButtonT_ @ 0x35c
6
plizdoo
_TToFC7plizdoo23ToDoTableViewController13inviteFriendsfS0_FCSo8UIButtonT_ @ 0x24
7
UIKit
-[UIApplication sendAction:to:from:forEvent:] @ 0x5c
8
UIKit
-[UIControl _sendActionsForEvents:withEvent:] @ 0x260
9
UIKit
-[UIControl touchesEnded:withEvent:] @ 0x24c
10
UIKit
_UIGestureRecognizerUpdate @ 0x2154
11
UIKit
-[UIWindow _sendGesturesForEvent:] @ 0x410
12
UIKit
-[UIWindow sendEvent:] @ 0x290
13
UIKit
-[UIApplication sendEvent:] @ 0x104
14
UIKit
_UIApplicationHandleEventFromQueueEvent @ 0x3c3c
15
UIKit
_UIApplicationHandleEventQueue @ 0x6b0
16
CoreFoundation
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ @ 0x14
17
CoreFoundation
__CFRunLoopDoSources0 @ 0x104
18
CoreFoundation
__CFRunLoopRun @ 0x2c4
19
CoreFoundation
CFRunLoopRunSpecific @ 0x188
20
GraphicsServices
GSEventRunModal @ 0xa4
21
UIKit
UIApplicationMain @ 0x5cc
22
plizdoo
main @ 0x98
23
libdyld.dylib
start @ 0x0
如果需要我可以提供完整的崩溃报告
问题是由于 swift 编译器选项造成的。
我是这样解决的:
- Select Target 中的项目
- 构建设置
- Swift 编译器 - 代码生成
- 优化级别
- 将调试和发布设置为:None [-Onone]