func sharebuttonPress() { //when the share button is pressed,default share phrase is added,cropped image of highscore is added var sharingItems = [AnyObject]() var sharebuttonHighscore = NSUserDefaults.standardUserDefaults().objectForKey("highscore") as Int! sharingItems.append("Just hit \(sharebuttonHighscore)! Beat it! #Swath") UIGraphicsBeginImageContextWithOptions(UIScreen.mainScreen().bounds.size,false,0); self.vIEw.drawVIEwHIErarchyInRect(vIEw.bounds,afterScreenUpdates: true) var image:UIImage = UIGraphicsGetimageFromCurrentimageContext(); UIGraphicsEndImageContext(); sharingItems.append(image) let activityVIEwController = UIActivityVIEwController(activityItems: sharingItems,applicationActivitIEs: nil) var barbuttonItem: UIbarbuttonItem! = UIbarbuttonItem() activityVIEwController.excludedActivityTypes = [UIActivityTypecopytopasteboard,UIActivityTypeAirDrop,UIActivityTypeAddToReadingList,UIActivityTypeAssignToContact,UIActivityTypePostToTencentWeibo,UIActivityTypePostToVimeo,UIActivityTypePrint,UIActivityTypeSavetoCameraRoll,UIActivityTypePostToWeibo] self.presentVIEwController(activityVIEwController,animated: true,completion: nil)}
正如您所看到的,我正在Swift中编程,在SpriteKit框架中,我不明白为什么应用程序崩溃.
我收到此错误:
Terminating app due to uncaught exception 'NSGenericException',reason: 'UIPopoverPresentationController (<_UIAlertControllerActionSheetRegularPresentationController: 0x7fc7a874bd90>) should have a non-nil sourceVIEw or barbuttonItem set before the presentation occurs.'
我该怎么做才能解决这个问题?
在演示UIActivityVIEwController之前,添加以下代码行:activityVIEwController.popoverPresentationController?.sourceVIEw = self.vIEw
这样,视图控制器就知道要在哪个GameVIEwController框架中出现.
总结以上是内存溢出为你收集整理的swift – 当调用UIActivityViewController时,IOS 8 iPad应用程序崩溃全部内容,希望文章能够帮你解决swift – 当调用UIActivityViewController时,IOS 8 iPad应用程序崩溃所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)