我最近升級到Xcode 8並將我的代碼轉換爲Swift 3.我製作的自定義鍵盤(擴展)在iOS 9之前工作得很好,但我面對一對夫婦在iOS的問題10.在我的應用程序中單擊按鈕時打開手機設置
- 自定義鍵盤的容器應用程序包含一個按鈕,將用戶定向到鍵盤設置添加鍵盤
問題:單擊此按鈕不工作iOS 10即用戶沒有定向到設置。我已經在我的項目中配置的URL方案,並已嘗試下面的代碼:
@IBAction func btnGetStarted(_ sender: AnyObject) {
let settingsUrl = URL(string: UIApplicationOpenSettingsURLString)
if let url = settingsUrl {
UIApplication.shared.openURL(url)
}
}
也試過:
@IBAction func btnGetStarted(_ sender: AnyObject) {
if let settingsURL = URL(string:"prefs:root=General&path=Keyboard/KEYBOARDS") {
UIApplication.shared.openURL(settingsURL)
}
}
- 自定義鍵盤還包含的表情符號圖像。用戶需要在設置中啓用「允許訪問」才能使用表情符號圖像。如果用戶未啓用「允許訪問」,則他不能使用表情符號圖像。如果「允許訪問」未啓用,並且用戶嘗試點擊表情符號,則會彈出一個通知,告訴用戶轉到設置並啓用「允許訪問」。
問題:當應用程序在iOS中運行10
代碼土司的這種敬酒不彈出:
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath){
let pbWrapped: UIPasteboard? = UIPasteboard.general
if let pb = pbWrapped {
if currentKeyboard == XXXXXX.emoji {
if let data = UIImagePNGRepresentation(dataEmoji[(indexPath as NSIndexPath).row]) {
pb.setData(data, forPasteboardType: "public.png")
self.makeToast(pasteMessage, duration: 3.0, position: .center)
}
}
} else {
var style = ToastStyle()
style.messageColor = UIColor.red
style.messageAlignment = .center
//style.backgroundColor = UIColor.whiteColor()
self.makeToast("To really enjoy the keyboard, please Allow Full Access in the settings application.", duration: 8.0, position: .center, title: nil, image: UIImage(named: "toast.png"), style: style, completion: nil)
}
}
我做了計算器檢查出一些解決方案,但沒有他們爲我工作,正如我之前說過的,我的應用程序在除iOS 10以外的所有版本上工作得非常好。 請有人可以幫我嗎?
http://stackoverflow.com/questions/28152526/how-do-i-open-手機設置,當按鈕被點擊時 - ios – Rock
@Rock正如我上面寫的,我已經試過了,我的工作 – PersianBlue
@PersianBlue:你有答案,我也面臨同樣的問題。 – RJ168