주소록에 새 연락처를 저장할 수 있도록 주소록 프레임 워크에 액세스하려고합니다. 내가 표시 줄에서iOS 10의 주소록 프레임 워크에 액세스하려고 할 때 오류가 발생합니다.
func requestForAccess(completion: (granted: Bool) ->()) {
dispatch_async(dispatch_get_global_queue(Int(QOS_CLASS_BACKGROUND.rawValue), 0), {
let authStatus = CNContactStore.authorizationStatusForEntityType(.Contacts)
switch authStatus {
case .Authorized:
completion(granted: true)
case .Denied, .NotDetermined:
// CRASH HERE before the completion block is called, after calling
// requestAccessForEntityType
self.contactStore.requestAccessForEntityType(.Contacts, completionHandler: { (access, accessError) ->() in
if access {
completion(granted: access)
} else {
if authStatus == .Denied {
dispatch_async(dispatch_get_main_queue(), {() ->() in
let msg = "\(accessError!.localizedDescription)\n\nPlease allow the app to access your contacts through the Settings."
//self.alertService.showAlert(msg)
})
}
}
})
default:
completion(granted: false)
}
})
}
... 파일의 머리에 다음 코드 ...
import Contacts
import ContactsUI
을 가지고하는 방법을 포함하는 SIABRT
충돌이있다. 스택을 와인딩 및 po $arg1
을 실행하는
error: Couldn't materialize: couldn't read the value of register x0
Errored out in Execute, couldn't PrepareToExecuteJITExpression
이 나는 또한 '링크 프레임 워크에서
Contacts.framework
및
ContactsUI.framework
을 포함했다
dict
<key>NSContactsUsageDescription</key>
<string>We need to access Contacts to import entries direct from the app.</string>
루트에 Info.plist
에 필요한 라인을 가지고 ... 다음을 던졌습니다 및 도서관 '대상 속성 (일반)
기기에서 iOS 10을 실행하고 있습니까? 프로젝트를 청소하거나 장치에서 응용 프로그램을 삭제하거나 때때로 다시 시작하는 데 도움이됩니다 –
이 링크를 확인하십시오 http://stackoverflow.com/questions/14704310/error-couldnt-materialize-struct-couldnt-read-eax –
@josip 제거를 시도했습니다. 전화, 재시작, Xcode 다시 시작 및 프로젝트 청소 (행운) : ( – Brendan