Ich versuche, die neue iOS 6-Freigabefunktionalität mithilfe des UIActivityViewControllers zu meiner App hinzuzufügen. Ich habe etwas Text, den ich teilen möchte und wenn sie E-Mail wählen, möchte ich auch den Betreff der E-Mail automatisch festlegen. HierAbsturz von UIActivityViewController, NSCFConstantString _beforeActivity nicht erkannter Selektor an Instanz gesendet
NSArray *activityItems = @[resultString];
NSLog(@"items=%@", activityItems);
NSArray *acitivities = @[UIActivityTypeMail, UIActivityTypeMessage, UIActivityTypePrint, UIActivityTypePostToFacebook, UIActivityTypeCopyToPasteboard];
UIActivityViewController *activityController =
[[UIActivityViewController alloc] initWithActivityItems:activityItems
applicationActivities:activities];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
self.popover = [[UIPopoverController alloc] initWithContentViewController:activityController];
// the line above is where the error happens.
[self.popover presentPopoverFromBarButtonItem:self.emailResultsButton permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
} else {
[self presentViewController:activityController
animated:YES
completion:nil];
}
ist die Ausgabe des Codes einschließlich der Fehlermeldung:
[694:907] items=(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas porttitor accumsan mi eu mollis. Fusce condimentum dictum lectus, eu ultrices urna vulputate eu."
)
[694:907] -[__NSCFConstantString _beforeActivity]: unrecognized selector sent to instance 0x3ad971c8
[694:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString _beforeActivity]: unrecognized selector sent to instance 0x3ad971c8'
*** First throw call stack:
(0x35add2a3 0x37a1497f 0x35ae0e07 0x35adf531 0x35a36f68 0x361dc7a3 0x361dc52d 0x36067595 0x36434d31 0x3642fe07 0x2990b 0x361330ad 0x36133135 0x361330ad 0x3613305f 0x3613303d 0x361328f3 0x36132de9 0x3605b5f9 0x36048809 0x36048123 0x37bd15a3 0x37bd11d3 0x35ab2173 0x35ab2117 0x35ab0f99 0x35a23ebd 0x35a23d49 0x37bd02eb 0x3609c301 0x1ef9d 0x1ef30)
libc++abi.dylib: terminate called throwing an exception
Ich laufe dies auf einem iPad 2 mit iOS 6. Irgendwelche Ideen?
EDIT: Es erscheint, wenn ich die Aktivitäten Array nicht liefern dann scheint alles gut zu funktionieren. Das Problem noch eingrenzen.
Bleibt das Problem bestehen, wenn Sie ARC ausschalten? (Ich würde ja voraussagen) –
Das Ausschalten von ARC ist nicht wie das Umlegen eines Schalters ... aber ich habe weiter herumgespielt. Es sieht so aus, als ob das Problem verschwindet, wenn ich das Aktivitäts-Array nicht zur Verfügung stelle. –
Nun, deaktivieren Sie einfach das Compiler-Flag temporär. Mach dir nichts aus den Speicherlecks. –