連絡先フレームワークにアクセスしようとしているため、新しい連絡先をユーザーのアドレス帳に保存できます。私はマークされた行で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
クラッシュがあります。私はルートにdict
<key>NSContactsUsageDescription</key>
<string>We need to access Contacts to import entries direct from the app.</string>
をInfo.plist
に必要なラインを持っている...
error: Couldn't materialize: couldn't read the value of register x0
Errored out in Execute, couldn't PrepareToExecuteJITExpression
をスタックを下巻きしてpo $arg1
は以下をスローランニング、私もリンクされたフレームワーク「でContacts.framework
とContactsUI.framework
が含まれています(一般)
お使いの端末はiOS 10を実行していますか?プロジェクトをクリーニングしたり、デバイスからアプリケーションを削除したり、時々再起動したりするのに役立ちます –
このリンクをチェックしてくださいhttp://stackoverflow.com/questions/14704310/error-couldnt-materialize-struct-couldntread-eax –
@josipアンインストールを試みました( – Brendan