I’ve iCloud sync working within the simulator, the place I signed in with my Apple ID on two simulators and it syncs high quality. However once I add the identical construct to TestFlight and set up it on two of my bodily gadgets, it doesn’t sync. Every gadget behaves as in the event that they solely have a neighborhood retailer, eg. every can save and cargo high quality domestically. I already tried pushing my schema to manufacturing, however it nonetheless doesn’t work, even when given 24 hours to see if it might sync. I’ve additionally tried restarting each gadgets and deleting and re-installing the app on each gadgets. I’ve additionally confirmed that iCloud is turned on within the settings app for my app.
I noticed this put up on Stackoverflow, which appears to be associated to my challenge, however the recommendations there didn’t work both. I additionally noticed this put up, however I didn’t perceive the accepted reply, and not one of the different recommendations labored both.
I am simply asking what has to alter from a simulator to a bodily gadget. The implementation is simply the pattern mission in Xcode with core information and CloudKit checked.
Right here is my code:
struct PersistenceController {
static let shared = PersistenceController()
let container: NSPersistentCloudKitContainer
init(inMemory: Bool = false) {
container = NSPersistentCloudKitContainer(identify: "Mannequin")
if inMemory {
container.persistentStoreDescriptions.first!.url = URL(fileURLWithPath: "/dev/null")
}
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {
fatalError("Unresolved error (error), (error.userInfo)")
}
})
container.viewContext.automaticallyMergesChangesFromParent = true
}
}