UIApplication.sharedApplication() is unavailable

后端 未结 6 2096
情话喂你
情话喂你 2020-12-20 13:48

I just upgraded from XCode 6.4 to Xcode 7 GM and get started to change the code to be compliant with Swift 2. I could not come over the following errors.

The project

6条回答
  •  悲哀的现实
    2020-12-20 14:03

    Swift 3.0

    In my case I had this message inside a Widget (that's an extension), the code was a copy/paste from my app. And like Tom Roggero said I had to replace

    UIApplication.shared.open(NSURL(string:"https://
    

    by

    self.extensionContext?.open(NSURL(string:"https://
    

提交回复
热议问题