2014-07-24 44 views
1

通常應用程序很好,但我在Crashlytics中收到問題。這周發生1-2次。對於2k-3k用戶。應用程序在iOS 7及更高版本上工作。 報告:致命異常:NSInvalidArgumentExceptionNSInvalidArgumentException。 UIPasteboard setString

-[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) 

應用crahed在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]]; 

    } 
}]; 
+0

什麼是強自我? –

+0

@KathiravanG WebViewController * strongSelf = weakSelf;見代碼 –

+0

@KathiravanG __weak WebViewController * weakSelf = self; –

回答

0

只是將其設定爲粘貼板字符串之前,請確保[strongSelf.startUrl absoluteString]不會返回nil。我很確定你的startUrl顯然變成零。