Yesterday, a netizen said that I wrote that part of the system to share code on the iOS9 have warning, see the original iOS8 after Uipopovercontroller was discarded. The newly added uipopoverpresentationcontroller is easier to use on the control Popview.
Here's the code I modified:
1. Open other app previews in the app in sub-view mode, only support more than 6.0
Openappwithidentifier (appid:string)
2. Share the text image information, the ipad will focus on Sourceview to select the view
Share (texttoshare:string, url:string, Image:uiimage, Sourceview:uiview)
Open other app previews within the app in sub-view, only support 6.0 or morePrivate FuncOpenappwithidentifier (appid:string) {IfLet _ = nsclassfromstring ("Skstoreproductviewcontroller") {Let Storeproductviewcontroller = Skstoreproductviewcontroller () Storeproductviewcontroller.delegate = SelfLet Dict = Nsdictionary (Object:appid, Forkey:skstoreproductparameteritunesitemidentifier)as! [String:anyobject] Storeproductviewcontroller.loadproductwithparameters (dict, Completionblock: {(result, error)- > VoidInchSelf.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 picture information, the ipad will focus on Sourceview to select the viewPrivate FuncShare (texttoshare:string, url:string, Image:uiimage, Sourceview:uiview) {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 = Uipopoverarrowdirection.any Self.presentviewcontroller (activityViewController, animated : True, Completion:nil) }}}
IOS9 system share call (Uiactivityviewcontroller)