Cloud and Local Storage

RSS for tag

Store data locally or in the cloud.

Posts under Cloud and Local Storage tag

32 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Is History Tracking in Cloudkit shared database needed?
I’ve setup the Cloudkit persistent container with private and shared database (see code below). I’ve enabled NSPersistentHistoryTrackingKey to true also for .shared database. I’ve noticed in the example from Apple that the History Tracking is only enabled in .private but not for .shared. Questions: For a CloudKit setup to sync (a) between owners’ own devices (only private database), and (b) between multiple iCloud Users through .private and .shared databases, Do I need to enable history tracking for .shared database if I want to check the remote changes in the .shared database (or is the history tracking of the .private database of the owner also accessible in the .shared database)? ======================== let APP_BUNDLE_IDENTIFIER = Bundle.main.bundleIdentifier! let APP_GROUP_IDENTIFIER = "group." + APP_BUNDLE_IDENTIFIER private func setupPersistentContainer(_ container: NSPersistentCloudKitContainer? = nil, isStartup: Bool = true) -> NSPersistentCloudKitContainer { let container = container ?? getCloudKitContainer(name: CORE_DATA_DATA_MODEL_NAME) let defaultDirectoryURL: URL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: APP_GROUP_IDENTIFIER) ?? NSPersistentCloudKitContainer.defaultDirectoryURL() let privateDataStoreURL = defaultDirectoryURL.appendingPathComponent("PrivateDataStore.store") let sharedDataStoreURL = defaultDirectoryURL.appendingPathComponent("SharedDS.store") // MARK: Private Store configuration let privateDataStoreDescription = NSPersistentStoreDescription(url: privateDataStoreURL) privateDataStoreDescription.configuration = "PrivateDataStore" // Enable lightweight migration privateDataStoreDescription.shouldInferMappingModelAutomatically = true privateDataStoreDescription.shouldMigrateStoreAutomatically = true // Turn History Tracking privateDataStoreDescription.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey) let logOptions = NSPersistentCloudKitContainerOptions(containerIdentifier: CLOUDKIT_LOG_CONTAINER_ID) logOptions.databaseScope = .private privateDataStoreDescription.cloudKitContainerOptions = logOptions // turn on remote change notifications privateDataStoreDescription.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey) container.persistentStoreDescriptions = [privateDataStoreDescription] // MARK: Share Store configuration let sharedDataStoreDescription = NSPersistentStoreDescription(url: sharedDataStoreURL) sharedDataStoreDescription.configuration = "SharedDS" // MARK: Enable lightweight migration sharedDataStoreDescription.shouldInferMappingModelAutomatically = true sharedDataStoreDescription.shouldMigrateStoreAutomatically = true sharedDataStoreDescription.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey) let sharedOptions = NSPersistentCloudKitContainerOptions(containerIdentifier: CLOUDKIT_LOG_CONTAINER_ID) sharedOptions.databaseScope = .shared sharedDataStoreDescription.cloudKitContainerOptions = sharedOptions // turn on remote change notifications sharedDataStoreDescription.setOption(true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey) container.persistentStoreDescriptions.append(sharedDataStoreDescription) self.stores = [StoreType : NSPersistentStore]() container.loadPersistentStores(completionHandler: { [self] (storeDescription, error) in if let error = error as NSError? { print(error) } if let cloudKitContainerOptions = storeDescription.cloudKitContainerOptions { if cloudKitContainerOptions.databaseScope == .private { self.stores[.privateStore] = container.persistentStoreCoordinator.persistentStore(for: storeDescription.url ?? privateDataStoreURL) } else if cloudKitContainerOptions.databaseScope == .shared { self.stores[.sharedStore] = container.persistentStoreCoordinator.persistentStore(for: storeDescription.url ?? sharedDataStoreURL) } } else { self.stores[.privateStore] = container.persistentStoreCoordinator.persistentStore(for: storeDescription.url ?? privateDataStoreURL) } }) /// Automatically merge changes in background context into View Context /// Since we always use background context to save and viewContext to read only. The store values should always trump container.viewContext.automaticallyMergesChangesFromParent = true container.viewContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy // Create separate context for read and write container.viewContext.name = VIEW_CONTEXT_NAME container.viewContext.transactionAuthor = self.contextAuthor self.setQueryGeneration(context: container.viewContext, from: .current) return container }
1
0
84
3d
Public and Private CK sync failure, macOS mistake = add data before indexing
I have a Multiplatform app for iOS and macOS targets. I am using CloudKit with CoreData and have successfully established a private and public database. The app has successfully synced private and public data for months between macOS (dev machine), an iPhone 13 Pro and an iPad Pro 12.9inch 2nd gen. The public data also syncs perfectly to simulator instances running under other iCloud accounts. Recently I added a new entity in the public DB and here is where I seemed to have made a mistake. I entered data into the new public database via my developer UI built into the macOS app running on my MBP before I indexed the necessary fields. Side note - I find it necessary to index the following for each Entity to ensure iCloud sync works as expected on all devices... modifiedTimestamp - Queryable modifiedTimestamp - Sortable recordName - Queryable Realising my mistake, I indexed the above CKRecord fields for the new Entity. Since then, the macOS target has remained in some way "frozen" (for want of a better term). I can add new public or private records in the macOS app but they do not propagate to the public or private stores in iCloud. I have attempted many fixed, some summarised below: clean build folder from Xcode; remove all files from the folder /Users//Library/Containers/, place in recycle bin, empty recycle bin, then build and run; build and run on iPhone and iPad targets to ensure all apps are current dev version, then repeat above processes. I've read through the console logging when I build and run the macOS app many many times to see whether I can find any hint. The closest thing I can find is... BOOL _NSPersistentUIDeleteItemAtFileURL(NSURL *const __strong) Failed to stat item: file:///Users/<me>/Library/Containers/com.me.AppName/Data/Library/Saved%20Application%20State/com.me.AppName.savedState/restorecount.plist but my research on this and other forums suggests this is not relevant. Through this, the app still functions as expected on iOS devices and both private and public database additions and modifications propagate to iCloud stores and to other devices. I expect that removing the macOS app entirely from my dev machine would trigger a complete sync with all existing data. Imagine I bought a new macOS device and chose to install my app where before I had run this only on my iOS devices. My current problem suggests that I could not do this, but I know that this is not the intended behaviour. This scenario makes me think there is a setting file for my macOS app that I'm not aware of and that this impeding the sync of all existing app data back to the fresh install of the macOS app? But that is a wild guess. Running public releases (no betas) Xcode 15.4 (15F31d) macOS Sonoma 14.5 physical iOS devices running iOS 17.5.1 Any words of wisdom on how I might go about trying to solve this problem please?
0
0
132
6d
Cloud Service for Apple Vision Pro App
For all the AVP devs out there, what cloud service are you using to load content in your app that has extremely low latency? I tried using CloudKit and it did not work well at all. Latency was super bad :/ Firebase looks like the most promising at this point?? Wish Apple would create an ultra low latency cloud service for streaming high quality content such as USDZ files and scenes made in Reality Composer Pro.
0
0
157
1w
Questions About CloudKit Security Roles and Permissions
Hi, I'm using CloudKit to create an app that backs up and records your data to iCloud. Here's what I'm unsure about: I understand that the 'CloudKit Dashboard' has 'Security Roles'. I thought these were meant to set permissions for accessing and modifying users' data, but I found there was no change even when I removed all 'Permissions' from 'Default Roles'. Can you clarify? I'd like to know what _world, _icloud, and _creator in Default Roles mean respectively. I would like to know what changes the creation, read, and write permissions make. Is it better to just use the default settings? Here's what I understand so far: Default Roles: _world: I don't know _icloud: An account that is not my device but is linked to my iCloud _creator: My Device Permissions: create: Create data read: Read data write: Update and delete data. I'm not sure if I understand this correctly. Please explain.
1
0
199
1w
Signing in
I'm struggling to sign in to Icloud, its linked to my PC. I cannot access other applications on the PC until I sort out the password issue.I have reset the password on MAC, but there is a ''verification failed notification. To access your end-to-end encrypted data, including passwords and other features, sign in to an Apple device to receive a verification code. '' But upon clicking ''OK,'' it takes you back to sign in and won't let you go past this dialogue box. It's taken me over an hour to follow all the instructions-not helping
7
1
203
2w
System files taking up way to much space
I am using an iPhone 11 running iOS 18 Developer Beta 1. Recently, I've encountered a significant problem with my system storage. As of now, my system files are occupying 44 GB of my 128 GB drive, which is an excessive amount. Here's a detailed overview of the issue: Problem Description: My system files are consuming an unusually large amount of storage—44 GB out of 128 GB. Steps Taken: I attempted to resolve this by cleaning up my pictures, but the system file size continued to grow. I also tried clearing the caches, but this did not help. Error Messages: I haven't received any specific error messages, but some of my apps keep crashing intermittently. Frequency of the Issue: This issue is constant and does not seem to resolve on its own. Impact: I am unable to update or download new apps. I cannot download new pictures. I am unable to update to iOS 18 Developer Beta 2 due to insufficient space. Additional Information: The problem began around a week ago. At that time, the system files were around 10 GB, which was already concerning, but it has now ballooned to 44 GB. This storage issue is severely impacting the functionality of my iPhone, and I'm seeking assistance to identify the cause and find a solution.
1
1
210
2w
iPadOS 18 Beta - System Data over 40GB
Hello! I am having a serious problem with my iPad Pro 2018 64GB. I had to delete everything, from Photos to Music, to games, to apps. I left only my e-mails (around 0,8GB and work apps like Outlook, Teams, Authenticators). All this only to install the Beta 2 for iPadOS 18. The culprit: Other System Data which at some point it was 42GB. Plus the 12GB iPadOS itself....my 64GB memory is done for. How I am supposed to utilise my iPad in this conditions? I did the same thing with iPadOS 17 Beta, and never ever had this issue, the System Data memory was "flexible" as advertised. In this version, it is only growing larger and never going down. I have restarted the iPad like 10 times, it wasn't going down, only up. I am not going to Reset my entire iPad because it will take me forever to set it up again for my work (I work for a company with a lot of security measures and I need to redo them all after Reset, they are not saved in Cloud). I know Beta wasn't supposed to be all perfect and dandy, but Apple, please, make it at least usable for devices with 64GB memory, because you do offer support for them. If you don't, at least put a restriction and allow the 18 Beta to run only on devices with at least 128GB of memory. Even then, half of it to be utilised by system files that are not my choice to be there, seems like I pay that memory premium tax to increase your stock prices and not my peace of mind. Fix it because my 1000$ iPad is useless right now.
1
3
823
3w
Trying to Update Macbook, Not enough Storage
I’ve been trying to update my Macbook pro for a while now. I’m on version 10.14.6, I’ve been able to get away with not having enough storage for the newer updates but now it is unavoidable as my laptop is nearly unusable. My issue is that I do not have enough storage. I’ve done everything, deleted old files, cleared my trash, deleted apps, etc. Still, the two things taking up the majority of my storage are applications the laptop will not let me delete and the system itself. It’s become incredibly frustrating, especially since the majority of the apps that I can’t delete I don’t even use. Is there a way to bypass this? Or any other possible solution?
0
0
141
3w
Account/data management
I am working on a social media app called "Aura Tracker" where people can add/subtract aura from people based off of their actions. I am new to app development so I don't know how to handle user accounts and aura value changing. Content view code: import SwiftUI struct ContentView: View { var body: some View { ScrollView{ VStack { Text("Aura Tracker") Image(systemName: "sparkles") .imageScale(.large) .foregroundStyle(.yellow) Text("You have "+"#"+" aura") } } } } #Preview { ContentView() } Aura_TrackerApp code: import SwiftUI @main struct Aura_TrackerApp: App { var body: some Scene { WindowGroup { ContentView() } } }
0
0
171
Jun ’24
How to Clear System Data on Mac
How do I clear my system data on my macbook as it is taking up a huge portion of my storage? I have already tried checking if my cache folder in ~/library was too big but it is only 7.42 GB. Also, I checked if time machine was on to find snapshots but it seems I have had it off for a while now and I didn't know. Could this be causing issues and should I have it on from now on? Please help I need more storage.
0
0
206
Jun ’24
Bricked com.apple.homekit.config CloudKit container
How did the issue (probably) occur? The issue appeared in January 2024 after setting up a new Apple TV 4K (tvOS 16.X and updated to latest tvOS after setup) or a new Apple Watch Ultra 2 (watchOS 10.X and updated after setup). Both devices were set up using my personal iCloud and both were set up to use HomeKit. I suspect the issue is related to the creation of a new Home that was subsequently shared to a family member (see below). How did I notice the issue? From the week that followed, I noticed that my iPhone 15 Pro Max tends to get really hot in standby and that the battery drops significantly in the space of a couple standby hours. (Worst case I’ve experienced is about ~80% drop in 4 hours standby) Apple Watch also has huge drops in battery life. Again, to give some perspective: I wear my AW for sleep tracking, sometimes AW will drop ~5% throughout the night, sometimes ~60% (and turn off if it was charged below 60%, making me lose my sleep tracking). My iPad Pro occasionally loses ~30-50% charge over night in standby. I went to the Battery section of the Settings app on my iPhone and iPad and could notice that about 50-75% of the time (over 24h that is), Home Accessories is running in the background. I could not confirm this on Apple Watch as the battery section of Settings does not show per app usage, however clear drops in battery percentage are noticeable from the graph. What's the issue? Seeing the issue arise on three of my four portable Apple devices, I decided to go check on my MacBook Pro M1 Max in Activity Monitor if the same behaviour was to be seen. I quickly realised that the Home Daemon (homed) is permanently running in background at (unusual) high usage. It is the top entry in CPU usage and Uptime. Going into the Console app I can see that the homed daemon on macOS is throwing 3x-5x batches of the same 5 error messages each second. The errors are the following: In the same Console app, connecting to my iPhone and my iPad, I can see the exact same errors occurring at approximately the same rate. What is the issue in technical terms? My CloudKit HomeKit config (com.apple.homekit.config) container is bricked and returns an internal server error The homed/cloudd daemons do not have a backoff policy and retry fetching the CloudKit database instantly on failure. This leads to an infinite loop of network requests going out and draining my battery on all devices massively. How did I try to solve the issue? All these measures were unsuccessful: Restarting all devices All devices are on the latest version Deleting the Home app where possible Turning off Home, Keychain and iCloud Drive in iCloud settings Signing out of iCloud and signing in again Using the HomeKit Reset mobileconfig profile where possible (http://appldnld.apple.com/iOSProfiles/HomeKitReset.mobileconfig) Use the previously mentioned reset profile in combination with a HomeKit Architecture downgrade (http://appldnld.apple.com/iOSProfiles/KeepLegacyHome.mobileconfig) On macOS, delete ~/Library/HomeKit Sending sysdiags using the Feedback Assistant (FB13529370, still open) Manually revoking all (pending and accepted) home invitations and deleting all homes from the Home app Removing all Apple TVs and HomePods from my iCloud account Reseting and repairing Apple Watch Disabled Advanced Data Protection on iCloud Logging out of all my devices’ iCloud, use the reset profile, wait 20min, login to iCloud, the issue reappears in the console (while no other devices are logged in) Changing Apple ID password and choose to log out all devices, log in again into a single device, use the reset profile, wait 20min, and the issue reappears in the console To be absolutely sure it is an iCloud issue and not a local misconfiguration (that could be solved by resetting all my devices), I took an older iPhone 12 Pro and set it up as a new device with no apps/account/data, just a blank installation of iOS. As one would expect, the issue is not present and the Console app does not show any errors. As soon as I log into my iCloud account, the Home daemon homed throws the same 5 errors over and over and the battery draining issue magically appears. This confirms my theory that it is indeed an iCloud issue on the server-side and not a client-side issue. Reseting my devices would not help fix the issue as demonstrated by a blank iOS installation on a separate iPhone 12 Pro getting the same error just by logging into my iCloud account. I’ve had an Apple Support case for over five months, it has been (unsuccessfully) escalated twice to engineering. While many basic troubleshooting steps have been taken, nothing helped. Also, while the Apple Support agent is really trying their best to help me, they understand the symptoms of the problem but not the root cause which I tried explaining multiple times. Essentially we’re sticking to the Apple Support instructions they have, and doing basic diagnostics and battery troubleshooting even though I technically understand and can explain the issue to a CloudKit engineer. We even proceeded to do a fresh install of macOS on a separate volume and took diagnostics before and after login in with my Apple ID. They were able to confirm that there is indeed a massive battery drain issue related to my account. The case is still open but is currently leading nowhere, I'm just told to keep my devices updated... How Apple can fix the issue: Investigating the internal server error and fixing the record(s) or the CoreData entity that is throwing the problem Implementing a client-side backoff policy for internal server errors coming from iCloud. Quite trivially by reseting my com.apple.homekit.config container Also worth mentioning: I don’t use a VPN or any Proxy I’m fine with losing all my HomeKit-related data on my iCloud account. At this point I just want the issue to disappear and to have useable battery life on all my devices. I’m giving my consent to the immediate and irrevocable deletion of all my past and present HomeKit-related data.
3
0
456
3w
Core Data error: SQLITE_IOERR_SHMOPEN; what is this?
Hi, when setting up our Core Data stack in our iOS app (manually, with a NSManagedObjectModel/Context & NSPersistentStoreCoordinator) we have reports a rare bug we haven't been able to reproduce. Occasionally when adding a persistent store we get a NSCocoaErrorDomain 256 error (NSFileReadUnknownError) with NSSQLiteErrorDomain=4618 in the user info. That's SQLITE_IOERR_SHMOPEN , which the SQLite docs describe this way: I/O error within the xShmMap method on the sqlite3_io_methods object while trying to open a new shared memory segment It seems to specifically /not/ be a SQLITE_FULL error. Do you know what type of issue can cause this? Or where/how I can start tracking this down?
1
0
282
Jun ’24
Webview localStorage gets cleared if navigate away from page on iOS
I'm experiencing an issue with WKWebView and localStorage. I've set up a standard WKWebView with the configuration: configuration.websiteDataStore = WKWebsiteDataStore.default() Everything works fine in the emulator (iOS 16.x, 17.0), but on my iPhone 13 running iOS 17.4, I encounter a problem. When I set a localStorage value on my local HTML page, navigate to another URL within the webview, and then return to the original page, the localStorage is cleared. This behavior is new and wasn't happening before. Has anyone else encountered this or have any suggestions on how to fix it? The localstorage should be persistent as it always has been.
1
0
494
May ’24
CloudKit + CloudSave for Unity not building in Xcode
I'm trying to integrate the option to the player to save their data in the cloud, I integrate the CloudKit, change some stuff to make it work and build in Xcode to my phone. But when I try to integrate the CloudSave, 50 unnasigned symbols jump,like this one: Undefined symbol: _CKContainer_Default I managed to fix them by updating the recommended settings for Xcode. But then 4 more errors appear: Sandbox: il2cpp(12538) deny(1) file-read-data /Users/Username/Test Apple Kit 2022/Build/Il2CppOutputProject/IL2CPP/build/deploy_arm64/il2cpp So, don't let me build and I've looked everywhere but no one seems to had this same error
1
0
344
May ’24