英文:
How do I fx Bundle ID error using CloudKit
问题
I keep getting the error: An error occurred in <CKError 0x282313e40: "Permission Failure" (10/2007); server message = "Invalid bundle ID for container"; op = D62C00D9FAAABB1F; uuid = B9BFD757-0AB0-4981-BB5A-5DDB845E7097; container ID = "iCloud.com.xxx.xx"
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation])
{
let location = locations.last!
locationManager?.stopUpdatingLocation()//need?
let locationRecord = CKRecord(recordType: "location")
locationRecord.setObject(location, forKey: "location")
let container = CKContainer(identifier: "iCloud.com.XXX.XX")
let publicData = container.publicCloudDatabase
publicData.save(locationRecord, completionHandler: { record, error in
if let saveError = error {
print("An error occurred in \(saveError)")
} else {
// Saved record
}
}
}
英文:
I keep getting the error: An error occurred in <CKError 0x282313e40: "Permission Failure" (10/2007); server message = "Invalid bundle ID for container"; op = D62C00D9FAAABB1F; uuid = B9BFD757-0AB0-4981-BB5A-5DDB845E7097; container ID = "iCloud.com.xxx.xx
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation])
{
let location = locations.last!
locationManager?.stopUpdatingLocation()//need?
let locationRecord = CKRecord(recordType: "location")
locationRecord.setObject(location, forKey: "location")
let container = CKContainer(identifier: "iCloud.com.XXX.XX")
let publicData = container.publicCloudDatabase
publicData.save(locationRecord, completionHandler: { record, error in
if let saveError = error {
print("An error occurred in \(saveError)")
} else {
// Saved record
}
}
答案1
得分: 2
如果在使用CloudKit时遇到Bundle ID错误,很可能是Xcode项目中的Bundle ID与CloudKit容器的Bundle ID不匹配。
要解决此错误,您应确保Xcode项目中的Bundle ID与CloudKit容器的Bundle ID匹配。您可以通过转到CloudKit仪表板,选择您的容器,并记下“Development Environment”或“Production Environment”下列出的Bundle ID来实现此目的。
然后,在Xcode项目中,请确保项目设置中列出的Bundle Identifier与CloudKit容器的Bundle ID相匹配。您可能还需要更新正在使用的任何预配文件中的Bundle ID。
一旦确保Bundle ID匹配,您应该能够在不遇到此错误的情况下使用CloudKit。
英文:
If you're receiving a Bundle ID error while using CloudKit, it's likely that the Bundle ID in your Xcode project doesn't match the Bundle ID of your CloudKit container.
To fix this error, you should ensure that the Bundle ID in your Xcode project matches the Bundle ID of your CloudKit container. You can do this by going to the CloudKit dashboard, selecting your container, and making note of the Bundle ID listed under "Development Environment" or "Production Environment".
Then, in your Xcode project, make sure that the Bundle Identifier listed in the project settings matches the Bundle ID of your CloudKit container. You may also need to update the Bundle ID in any provisioning profiles you are using.
Once you've made sure that the Bundle IDs match, you should be able to use CloudKit without encountering this error.
答案2
得分: 0
我通过在Xcode的"能力"下断开容器与项目的连接,保存,然后重新连接来解决了这个问题。我还重新创建了配置文件。我认为这是一个苹果的问题,因为实际上并没有进行任何更改。
英文:
I was able to fix this by disconnecting container from the project in Xcode under capabilities, saving, then connecting again. I also redid the provisioning profile. I believe it is an apple problem since nothing was actually changed.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论