![](/img/trans.png)
[英]Xcode 10.1 failed to create provisioning profile after trying to side load app to device w/ iOS 12.1
[英]Photo Library permissions - Why is my app not showing in the Settings app? (iOS 12.1 Xcode 10.1)
我的應用程序未顯示在iPhone的“設置”應用程序中(物理設備和模擬器上均出現類似問題)。 我正在使用Xcode 10.1和iOS 12.1。
它需要將照片保存到用戶的照片庫中,因此我在info.plist中添加了右鍵(下面列出),但是我從未收到照片庫權限提示。
NSAppleMusicUsageDescription
NSCameraUsageDescription
NSMicrophoneUsageDescription
NSPhotoLibraryAddUsageDescription
NSPhotoLibraryUsageDescription
(我認為根本不需要其中的一些,但是添加它們仍然無法解決任何問題)。
我試圖強制打開“設置”應用程序,如下所示。 這將打開“設置”應用程序,但是我正在使用的應用程序未出現在此處。
guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else {
print("Couldn't load settingsURL")
return
}
if UIApplication.shared.canOpenURL(settingsUrl) {
UIApplication.shared.open(settingsUrl, completionHandler: { (success) in
print("Settings opened: \(success)")
})
}
結果,我無法調試權限,並且在嘗試將圖像寫入照片庫時應用程序繼續崩潰。
歡迎任何建議。
已解決:我認為該應用程序僅在第一次獲得許可后出現在“設置”中。
使用此代碼解決了它。
PHPhotoLibrary.requestAuthorization { (status) in
print("Status: \(status)")
}
調用一次后,該應用程序在“設置”中正確顯示,並且在將映像保存到磁盤時不再崩潰。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.