0

I use QLPreviewController to preview images and pdf files. It works perfectly for iOS7-9. However, when I tap share button on device with iOS9, app crashes immediately with following exception:

Fatal Exception: NSInvalidArgumentException *** -[__NSCFString rangeOfString:options:range:locale:]: nil argument

This doesn't happen on simulator with iOS9. I am able to see AirDrop sharing menu on devices with iOS7&8, but strange (null) title appears on the top of description. Here is link to sample screenshot, taken on iPhone 5 with iOS7:

enter image description here

Have any of you experienced such issue?

Full stacktrace from CrashLytics

Thread : Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x00000001860a0f5c __exceptionPreprocess + 124
1  libobjc.A.dylib                0x000000019ac97f80 objc_exception_throw + 56
2  CoreFoundation                 0x00000001860a0ea4 -[NSException initWithCoder:]
3  Foundation                     0x0000000186efe598 -[NSString rangeOfString:options:range:locale:] + 348
4  Sharing                        0x0000000195064118 -[SFAirDropActivityViewController attributedStringWithTitle:content:]
5  Sharing                        0x00000001950633e0 -[SFAirDropActivityViewController viewDidLoad]
6  UIKit                          0x000000018b5f7610 -[UIViewController loadViewIfRequired] + 1124
7  UIKit                          0x000000018b5f7194 -[UIViewController view] + 28
8  UIKit                          0x000000018bf3a244 __79-[_UIActivityGroupListViewController updateVisibleActivityGroupViewControllers]_block_invoke115 + 112
9  CoreFoundation                 0x0000000185f9e6f0 __53-[__NSArrayI enumerateObjectsWithOptions:usingBlock:]_block_invoke + 100
10 CoreFoundation                 0x0000000185f95418 -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] + 148
11 UIKit                          0x000000018bf39e90 -[_UIActivityGroupListViewController updateVisibleActivityGroupViewControllers] + 456
12 UIKit                          0x000000018bf3a754 -[_UIActivityGroupListViewController viewDidLoad] + 720
13 UIKit                          0x000000018b5f7610 -[UIViewController loadViewIfRequired] + 1124
14 UIKit                          0x000000018b5f7194 -[UIViewController view] + 28
15 UIKit                          0x000000018ba4901c -[UIAlertController setContentViewController:] + 284
16 UIKit                          0x000000018b7f0278 -[UIActivityViewController viewDidLoad] + 1280
17 UIKit                          0x000000018b5f7610 -[UIViewController loadViewIfRequired] + 1124
18 UIKit                          0x000000018b5f7194 -[UIViewController view] + 28
19 UIKit                          0x000000018b969bfc -[UIViewController _setPresentationController:] + 108
20 UIKit                          0x000000018b962e58 -[UIViewController _presentViewController:modalSourceViewController:presentationController:animationController:interactionController:completion:] + 1328
21 UIKit                          0x000000018b964840 -[UIViewController _presentViewController:withAnimationController:completion:] + 4428
22 UIKit                          0x000000018b967278 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 472
23 UIKit                          0x000000018b6ee0a4 -[UIViewController presentViewController:animated:completion:] + 184
24 UIKit                          0x000000018bc48c84 _UIDocumentInteractionControllerPresentPopoverFromItemOrShowActivityViewController + 356
25 UIKit                          0x000000018bc48a70 -[UIDocumentInteractionController presentOptionsMenuFromBarButtonItem:animated:] + 264
26 QuickLook                      0x000000018af9d220 -[QLPreviewController actionButtonTapped:] + 220
27 UIKit                          0x000000018b62e3c8 -[UIApplication sendAction:to:from:forEvent:] + 100
28 UIKit                          0x000000018b7ad3dc -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 168
29 UIKit                          0x000000018b62e3c8 -[UIApplication sendAction:to:from:forEvent:] + 100
30 UIKit                          0x000000018b62e344 -[UIControl sendAction:to:forEvent:] + 80
31 UIKit                          0x000000018b616c6c -[UIControl _sendActionsForEvents:withEvent:] + 416
32 UIKit                          0x000000018b616db8 -[UIControl _sendActionsForEvents:withEvent:] + 748
33 UIKit                          0x000000018b62dc5c -[UIControl touchesEnded:withEvent:] + 572
34 UIKit                          0x000000018b62d88c -[UIWindow _sendTouchesForEvent:] + 804
35 UIKit                          0x000000018b626ac0 -[UIWindow sendEvent:] + 784
36 UIKit                          0x000000018b5f7a10 -[UIApplication sendEvent:] + 248
37 UIKit                          0x000000018b5f5efc _UIApplicationHandleEventQueue + 5348
38 CoreFoundation                 0x00000001860585a4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
39 CoreFoundation                 0x0000000186058038 __CFRunLoopDoSources0 + 540
40 CoreFoundation                 0x0000000186055d38 __CFRunLoopRun + 724
41 CoreFoundation                 0x0000000185f84dc0 CFRunLoopRunSpecific + 384
42 GraphicsServices               0x00000001910d8088 GSEventRunModal + 180
43 UIKit                          0x000000018b65ef44 UIApplicationMain + 204
Jay Bhalani
  • 4,142
  • 8
  • 37
  • 50

1 Answers1

1

I met the same problem. My solution is,Do something to SFAirDropActivityViewController.

the code:

@interface SFAirDropActivityViewController : UIViewController
+ (BOOL)isAirDropAvailable;
@end


@implementation SFAirDropActivityViewController
+ (BOOL)isAirDropAvailable{
 return NO;
}
@end

PrivateFrameworks address:

https://github.com/nst/iOS-Runtime-Headers/blob/master/PrivateFrameworks/Sharing.framework/SFAirDropActivityViewController.h

action121
  • 11
  • 2