这是我用来分享图像 vaia facebook 的代码:
NSArray *array = [NSKeyedUnarchiver unarchiveObjectWithData:archive];
UIActivityViewController *activityVC =
[[UIActivityViewController alloc] initWithActivityItems:array
applicationActivities:nil];
activityVC.excludedActivityTypes = @[UIActivityTypeAssignToContact,
UIActivityTypePrint,
UIActivityTypePostToTwitter,
UIActivityTypePostToWeibo,
UIActivityTypeMail,
UIActivityTypeCopyToPasteboard,
UIActivityTypeSaveToCameraRoll];
[self presentViewController:activityVC animated:YES completion:nil];
这在模拟器中运行良好,但是当我在真正的 ipad 3 上对其进行测试时,它会强制关闭说错误
exc_bad_access code=1 address=0*0
在这一行
activityVC.excludedActivityTypes = @[UIActivityTypeAssignToContact,
UIActivityTypePrint,
UIActivityTypePostToTwitter,
UIActivityTypePostToWeibo,
UIActivityTypeMail,
UIActivityTypeCopyToPasteboard,
UIActivityTypeSaveToCameraRoll];
谁能找到我在这里错过的东西?
编辑部分:
我已经检查了所有内容,并且array
不是零。如果我注释掉该行activityVc.exclude....
然后它强制关闭并说
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view controller