비슷한 문제가있었습니다. 의 Info.plist에서 NSPhotoLibraryUsageDescription 키를 생성하는 것은이 문제를 해결하지만, 그렇지 않은한다, 여기에 프로그램의 수정입니다 :
func photoLibraryAvailabilityCheck() {
let status = PHPhotoLibrary.authorizationStatus()
if (status == PHAuthorizationStatus.authorized) {
print("PHAuthorizationStatus.authorized")
} else if (status == PHAuthorizationStatus.denied) {
print("PHAuthorizationStatus.denied")
requestPhotosLibraryAccess()
} else if (status == PHAuthorizationStatus.notDetermined) {
print("PHAuthorizationStatus.notDetermined")
requestPhotosLibraryAccess()
} else if (status == PHAuthorizationStatus.restricted) {
print("PHAuthorizationStatus.restricted")
}
}
func requestPhotosLibraryAccess() {
PHPhotoLibrary.requestAuthorization({ (newStatus) in
if (newStatus == PHAuthorizationStatus.authorized) {
print("pressed the allowed button")
} else {
print("pressed the don't allow button")
}
})
}
사용하기 :
photoLibraryAvailabilityCheck()
가 http://stackoverflow.com/보기 질문/13635288/ios-calendar-access-permission-dialog-force-it-to-appear/13693935 # 13693935 이는 모든 개인 정보 설정에 적용됩니다. – rmaddy
또한 "편집"에 대한 정보는 http://stackoverflow.com/questions/12810638/app-crashed-in-ios-6-when-user-changes-contacts-access-permissions/12810719#12810719를 참조하십시오. – rmaddy
@rmaddy, 흥미 롭습니다. 도와 주셔서 감사합니다! – Stonep123