gpt4 book ai didi

ios - NSInvalidArgumentException。 UIPasteboard设置字符串

转载 作者:行者123 更新时间:2023-12-02 05:17:32 26 4
gpt4 key购买 nike

通常应用程序运行良好,但我在 Crashlytics 中收到问题。一周发生1-2次。适合 2k-3k 用户。应用程序适用于 iOS 7 及更高版本。报告:致命异常:NSInvalidArgumentException

-[UIPasteboard setString:]: Argument is not an object of type NSString [(null)]

这里是应用程序崩溃的线程堆栈:

 Thread : Crashed: com.apple.main-thread
0 libsystem_kernel.dylib 0x38fae1f0 __pthread_kill + 8
1 libsystem_pthread.dylib 0x390167b7 pthread_kill + 58
2 libsystem_c.dylib 0x38f5eff9 abort + 76
3 libc++abi.dylib 0x383ad98f abort_message + 74
4 libc++abi.dylib 0x383c66e7 default_terminate_handler() + 254
5 libobjc.A.dylib 0x389f9f7d _objc_terminate() + 192
6 APPNAME 0x001f1495 CPPExceptionTerminate() (KSCrashSentry_CPPException.mm:193)
7 libc++abi.dylib 0x383c41b3 std::__terminate(void (*)()) + 78
8 libc++abi.dylib 0x383c3a09 __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*)
9 libobjc.A.dylib 0x389f9dbb objc_exception_throw + 250
10 CoreFoundation 0x2e25ee0d -[NSException initWithCoder:]
11 UIKit 0x30e3e0eb -[UIPasteboard(UIPasteboardDataExtensions) setString:] + 154
12 APPNAME 0x0011cfaf __33-[WebViewController moreActions:]_block_invoke_2 (WebViewController.m:424)
13 UIKit 0x30c74ceb __56-[UIActivityViewController _cleanupActivityWithSuccess:]_block_invoke + 54
14 UIKit 0x30ba87c9 -[UIWindowController transitionViewDidComplete:fromView:toView:removeFromView:] + 1880
15 UIKit 0x30ba7f9f __101-[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:animation:]_block_invoke293 + 170
16 UIKit 0x30ba7ecb -[_UIViewControllerTransitionContext completeTransition:] + 74
17 UIKit 0x30ba7db1 -[UITransitionView notifyDidCompleteTransition:] + 288
18 UIKit 0x30ba78c1 -[UITransitionView _didCompleteTransition:] + 944
19 UIKit 0x30ac83b7 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 178
20 UIKit 0x30ac82cf -[UIViewAnimationState animationDidStop:finished:] + 66
21 QuartzCore 0x30712e0b CA::Layer::run_animation_callbacks(void*) + 234
22 libdispatch.dylib 0x38ee2d3f _dispatch_client_callout + 22
23 libdispatch.dylib 0x38ee56c3 _dispatch_main_queue_callback_4CF + 278
24 CoreFoundation 0x2e229641 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
25 CoreFoundation 0x2e227f0d __CFRunLoopRun + 1308
26 CoreFoundation 0x2e192729 CFRunLoopRunSpecific + 524
27 CoreFoundation 0x2e19250b CFRunLoopRunInMode + 106
28 GraphicsServices 0x331016d3 GSEventRunModal + 138
29 UIKit 0x30af3871 UIApplicationMain + 1136
30 APPNAME 0x000b9287 main (main.m:16)

应用程序在 WebViewController 的 moreActions 函数中崩溃。

12 APPNAME    0x0011cfaf __33-[WebViewController moreActions:]_block_invoke_2 (WebViewController.m:424)

此函数显示 UIActivityViewController 和自定义操作之一 - 将链接复制到网页。

 __weak WebViewController *weakSelf = self;
[activityViewController setCompletionHandler:^(NSString *activityType, BOOL completed) {
WebViewController *strongSelf = weakSelf;
if ([activityType isEqualToString:@"VK"]) {
// actions
} else if ([activityType isEqualToString:@"copyLink"]) {

// HERE UIPasteboard!
UIPasteboard *pb = [UIPasteboard generalPasteboard];
[pb setString:[strongSelf.startUrl absoluteString]];

}
}];

最佳答案

确保 [strongSelf.startUrl AbsoluteString] 在将其设置为粘贴板字符串之前不会返回 nil。我很确定你的 startUrl 显然变成了 nil。

关于ios - NSInvalidArgumentException。 UIPasteboard设置字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24934729/

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