IOS9 system sharing call (UIActivityViewController)
Some netizens said yesterday that the system shared code I wrote had a warning on iOS9. After reading the original ios8.UIPopoverControllerAbandoned. The newly added UIPopoverPresentationController is easier to use in PopView control.
The modified code is as follows: <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> Vcd4kpg1_iglkpq = "1-open other apps in the subview mode in the app for preview only 60 or more"> 1. in the app, you can open other apps in the subview mode to preview, and only support over 6.0
OpenAppWithIdentifier (appId: String)
2. Share text and image information. The selection view is displayed with sourceView as the focus on the ipad.
Share (textToShare: String, url: String, image: UIImage, sourceView: UIView)
/// Open other apps in the subview mode in the app for preview. Only private func openAppWithIdentifier (appId: String) over 6.0 is supported {if let _ = NSClassFromString (SKStoreProductViewController) {let storeProductViewController = SKStoreProductViewController () storeProductViewController. delegate = self let dict = NSDictionary (object: appId, forKey: SKStoreProductParameterITunesItemIdentifier)! [String: AnyObject] storeProductViewController. loadProductWithParameters (dict, completionBlock: {(result, error)-> Void in // self. presentViewController (storeProductViewController, animated: true, completion: nil)}) self. presentViewController (storeProductViewController, animated: true, completion: nil)} else {UIApplication. sharedApplication (). openURL (NSURL (string: itms-apps: // itunes.apple.com/ App/id (appId ))!)} // Share text and image information. On the ipad, the private func share (textToShare: String, url: String, image: UIImage, sourceView: UIView) is displayed with the focus of sourceView) {let objectsToShare = [textToShare, url, image] let activityViewController = UIActivityViewController (activityItems: objectsToShare, applicationActivities: nil) if UIDevice. currentDevice (). userInterfaceIdiom = UIUserInterfaceIdiom. phone {self. presentViewController (ActivityViewController, animated: true, completion: nil)} else {let popover = activityViewController. popoverPresentationController if (popover! = Nil) {popover ?. SourceView = sourceView popover ?. SourceRect = sourceView. frame popover ?. PermittedArrowDirections ctions = UIPopoverArrowDirection. Any self. presentViewController (activityViewController, animated: true, completion: nil )}}}