gpt4 book ai didi

ios - UIActivityViewController 在 Testflight 中崩溃,但在从 Xcode 构建时不会崩溃

转载 作者:行者123 更新时间:2023-12-02 15:42:57 25 4
gpt4 key购买 nike

我在这里遇到一个奇怪的问题。

我在我的应用程序中集成了 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 编译器选项造成的。

这是我解决问题的方法:

  1. 在 Target 中选择项目
  2. build设置
  3. Swift 编译器 - 代码生成
  4. 优化级别
  5. 将调试和发布设置为:无 [-Onone]

关于ios - UIActivityViewController 在 Testflight 中崩溃,但在从 Xcode 构建时不会崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30013958/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com