UIActivityViewController crashing on presentation on device

I am having trouble adding a default sheet for ios default / UIActivityViewController in my project. It works great on a simulator, but it crashes when it runs on a device (iPhone) using either a USB cable or testflight. The error message I get is:

* Application termination due to the uncaught exception 'NSInvalidArgumentException', reason: '* - [__ NSCFString rangeOfString: options: range: locale:]: nil argument' *** First stack of throw calls: (0x182ddedb0 0x182443f80 0x182ddecf8 0x1836198f8908188398f8908398f8908f8908f8908f8908f8908f8908f8908f8908f8908f8908f8908f8908f8908f8oc8f8908f8188f8188f8908f8oc8188f8oc8f8188f8oc8f8188f8oc8f8188f8f8188f8oc8f8oc8f8oc8f8oc8f8f8188f8oc8f8oc8f8oc8f8ocf8 0x1888f5050 0x182cd6584 0x182ccd2ac 0x1888f4c9c 0x1888f5560 0x187f3cc40 0x187f3c844 0x1883b4bd8 0x18813cc78 0x187f3cc40 0x187f3c844 0x1882c4228 0x1882bd3b8 0x1882bee54 0x1882c1890 0x1880373cc 0x1001ae7b8 0x187f74be8 0x187f74b64 0x187f5c870 0x187f74454 0x187f2cc0c 0x187f6d610 0x187f6cc0c 0x187f3d04c 0x187f3b628 0x182d9509c 0x182d94b30 0x182d92830 0x182cbcc50 0x1845a4088 0x187fa6088 0x100137c88 0x18285a8b8) libS ++ abi.dylib: completion with uncaught exception type NSException

Here is the code I'm using

-(void)share {
    NSString *item = @"test";
    NSArray *items = @[item];

    UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil];
    [self presentViewController:activityVC animated:YES completion:nil];
}

"presentViewController". , activityVC , , . .

, , , , /

+4
2

, AirDrop, .

activityVC.excludedActivityTypes = @[UIActivityTypeAirDrop];

, , AirDrop ( iOS). , , / AirDrop. , AirDrop , , - , UIActivityTypeAirDrop

+4

, UIViewController.

- (void)setTitle:(NSString *)title {
    // ...
}
+1

All Articles