Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
472 views
in Technique[技术] by (71.8m points)

swift2 - UIApplication.sharedApplication() is unavailable

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 is a keyboard extension and the snippet is from the containing app.

    let s = "https://itunes.apple.com/"
    UIApplication.sharedApplication().openURL(NSURL(string : s)!)

Error 1: 'sharedApplication()' is unavailable: Use view controller based solutions where appropriate instead.

Error 2: 'openURL' is unavailable.

This might be something to do with Xcode and AppDelegate, I might have screwed up my project.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

While I was making a framework. I faced this problem. Manually set it to NO solved my problem.

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...