I have changes the screenshot and process for app review but it doesn't work.
Unable to Add for Review
The items below are required to start the review process:
There are still screenshot uploads in progress.
its benn 1 hour please fix it
iCloud & Data
RSS for tagLearn how to integrate your app with iCloud and data frameworks for effective data storage
Post
Replies
Boosts
Views
Activity
I am a simple mac seller ,i buy broken laptops from people and repair them to sell
so one day one my customer asked to show him video of 4 my laptops
after he got only video all became iCloud LOCK
Summary - my case numbers are 102302104385 + Case Number: 102309395011
my story is simple
the customer asked me about video of the Macbook , because as he told me , he was need a confirmation about how are laptops are looks like
i do not see any suspicious action here , customer just want me to show him the laptop like online
So i did it - just send him video - and that is all
then he asked to send video about 3 more Macbooks
after it he asked me to Use Erase All Content and Settings
so i was sure that there will be no problem - because i just replaced the motherboard two weeks ago - so what can be wrong
so when i did it - the Macbook asked if the apple server let him activation and it was refused
Somehow person who get the video about laptop did a copy of a signal that apple laptop send to apple activation server and connected it to his apple id and after it enabled FMI FMD - but all time my laptops was turned off
But i have video confirmation in my cases that all laptops are without any Apple Id and have new and fresh mac os
so after it i was not able to pass the activation because i was scammed and unknown person connected 4 my laptops to unknown account , so after that i was not able to pass the activation
so in fact they are all bricked now
he asked me to pay 1000 $
i told apple about it and they answer me that it is just my fairy tail and it is not possible
i told them that there is a hole in security and identification of apple devices during enabling FMI FMD but as i see they do not care - i think it must about 100 same cases or 1000 - maybe after it they will take care about it
so now i wonder if there any more victims who have the same problem ?
or check here at youtube ServisTT
also i and apple support did full apple diagnostic about all devices - i want apple to compare mac addresses and other mac information with the signal that was emulated with the scammer to prove my words - because the scammer was at different location and his emulation device or software was different between my original one macbook
Steps to reproduce
https://www.youtube.com/watch?v=58AgEcZvrYg&t=98s or check here at youtube ServisTT
Expected results
i want apple to compare mac addresses and other mac information with the signal that was emulated with the scammer to prove my words - because the scammer was at different location and his emulation device was different between my original one
also if you find out that he used Hardware UUID - so why not to mask it or hide or make enable to see only with the password
Actual results
NO ONE TRUST ME AND NO ONE WANT TO HELP ME
In Xcode (Mac OS Catalina), when trying to create an application to access a database, I receive syntax errors, resulting from the installed version of SQlite (below 3.30) does not allowing generation of virtual columns.
After updating to 3.46 the version installed on system, this does not occur if I execute such queries directly in SQlite, via Terminal.
How do I get Xcode to access and use the system updated version ?
Thanks in advance
Hello,
im trying to parse a JSON Request into a Swift Data Model. The specific bug happens with the nutriscore.
It works perfectly fine if I do my request and Decode or Encode the Model directly. But when im trying to add it to the Database the field is empty.
Somehow when im iterating through each product (my model) and console log it, it works. But only if there is one product in my database. sometimes when im adding another product, it somehow deletes(?) all nutriscores and the console log prints "nil" for all products. even for the product it worked before.
This right here is the way I insert into my database which should be perfectly fine. And the printing works also perfectly fine and it always displays the correct nutriscore
func dataScanner(_ dataScanner: DataScannerViewController, didAdd addedItems: [RecognizedItem], allItems: [RecognizedItem]) {
for item in addedItems {
if case let .barcode(barcode) = item {
performAPIRequest(with: barcode.payloadStringValue!) { result in
switch result {
case .success(let product):
...
var descriptor: FetchDescriptor<Product> {
var descriptor = FetchDescriptor<Product>(
predicate: #Predicate { $0.code == product.code }
)
descriptor.fetchLimit = 1
return descriptor
}
var products: [Product] = []
products = try! self.parent.context.fetch(descriptor)
print(product.nutriscore ?? "no nutri"); //WORKS PERFECTLY FINE!!
if let existingProduct = products.first {
existingProduct.amount! += 1
existingProduct.lastScannedAt = Date()
} else {
self.parent.context.insert(product)
}
self.processMeals()
case .failure(let error):
print("Error: \(error)")
}
}
}
}
}
This has to be a SwiftData Bug, or why doesn't it work
Is there any good framework that can ease process of syncing strings, structs, bools across devices using icloud.
Currently app doesn't use any cloud functionality.
Any help will be greatly appreciated.
I'm currently working on a Swift app whose data storage and authentication part is managed by Firebase.
I would like to offer my users the possibility of using their Apple account for account creation.
To do this I added Apple as a “Connection Provider” in the Firebase console settings.
This part works without problem, when the user clicks on the “Sign in with Apple” button a popup appears asking if they agree to share this information (first and last name / email address) for account creation.
After entering the password, the user is authenticated and their account is created on Firebase.

If I go to the iPhone settings in the Connection and Security section > Sign in with Apple, I can see my app in the list.

Now my problem is at the time of deleting the user's account. When the account is deleted it no longer exists in Firebase as we expected.

An email is also sent by Apple to warn that the application has revoked the account that had been created with “Sign in with Apple”.
And the application no longer appears in the list of applications in the Connection and Security > Connection with Apple from iPhone section.
However, when I click on the “Sign in with Apple” button again, I don’t see the window that asks me if I want to share my connection information.
The app behaves as if I was simply logged out but when I enter my iCloud password I am logged in except in reality it is a new account.
When I look in Firebase I have a new id for my user.

In addition, the user is not really connected to the application since certain views behave as if the user session was empty. The only way is to erase the emulator and make a new build.
I need help finding what's not working in my current code because I've been going around in circles for several days and I really don't understand what's going on.
Here my entire AuthentificationViewModel:
AuthentificationViewModel.txt
The context is to create a model instance in SwitfData and return it.
This model as a unique attribute (defined by @Attribute(.unique)). The application runs fine the first time but on the second run, it fails with EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP).
What the reason behind this crash?
Here is my sample application to duplicate the issue. The issue is reproducible on MacOS and iOS:
import SwiftUI
import SwiftData
@available(iOS 17, *)
@available(macOS 11, *)
@Model
public final class MyModel : CustomStringConvertible {
@Attribute(.unique) var uuid: UUID
init(uuid: UUID) throws {
self.uuid = uuid
}
public var description: String {
return self.uuid.uuidString
}
}
@available(iOS 17, *)
@available(macOS 11, *)
@ModelActor
public actor LocalDatabaseService {
public static let shared = LocalDatabaseService()
let schema = Schema([MyModel.self])
public init() {
self.modelContainer = try! ModelContainer(for: self.schema)
let context = ModelContext(modelContainer)
self.modelExecutor = DefaultSerialModelExecutor(modelContext: context)
}
public func createMyModel(uuid: UUID) throws -> MyModel {
let myModel = try MyModel(uuid: uuid)
let modelContext = self.modelContext
modelContext.insert(myModel)
try modelContext.save()
return myModel
}
}
struct ContentView: View {
var body: some View {
Task {
let id = UUID(uuidString: "9C66CA5B-D91C-480F-B02C-2D14EEB49902")!
let myModel = try await LocalDatabaseService.shared.createMyModel(uuid: id)
print("myModel:\(myModel)")
print("DONE")
}
return VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
}
.padding()
}
}
#Preview {
return ContentView()
}
Note: a workaround is to returned the fetched model instance return try self.getMyModel(uuid: uuid):
func getMyModel(uuid: UUID) throws -> MyModel {
let fetchDescriptor = FetchDescriptor<MyModel>(predicate: #Predicate { $0.uuid == uuid })
let serverList = try modelContext.fetch(fetchDescriptor)
if !serverList.isEmpty {
if let first = serverList.first {
return first
}
}
fatalError("Could not find MyModel with uuid \(uuid)")
}
... but it does not explain the crash.
Here is my current code:
@Model
final public class ServerModel {
@Attribute(.unique) var serverUrl: URL
init(serverUrl: URL) {
self.serverUrl = serverUrl
}
}
@ModelActor
public actor MyDatabaseService {
public static var shared = MyDatabaseService()
public init() {
self.modelContainer = try! ModelContainer(for: ServerModel.self)
let context = ModelContext(modelContainer)
self.modelExecutor = DefaultSerialModelExecutor(modelContext: context)
}
public func listServers() throws -> [ServerModel] {
let descriptor = FetchDescriptor<ServerModel>()
return try modelContext.fetch(descriptor)
}
}
When try to call try await MyDatabaseService.shared.listServers()
There are two problems:
ServerModel is not Sendable
"Reference to static property 'shared' is not concurrency-safe because it involves shared mutable state; this is an error in Swift 6"
For the first one, I can solve it by doing:
public struct Server {
let serverUrl: URL;
}
@Model
final public class ServerModel {
@Attribute(.unique) var serverUrl: URL
init(serverUrl: URL) {
self.serverUrl = serverUrl
}
func getSendable() -> Server {
return Server(serverUrl: self.serverUrl)
}
}
@ModelActor
public actor MyDatabaseService {
(...)
public func listServers() throws -> [Server] {
let descriptor = FetchDescriptor<ServerModel>()
return try modelContext.fetch(descriptor).map { $0.getSendable() }
}
}
I am wondering if there is a smarter solution to this first issue. SwiftData already require to define the model with basic/codable types, so if there was a magic way to get a sendable from the model.
I try to make my model 'Codable' but 'Codable' is not compatible with 'Sendable'.
For my second issue, the singleton issue. I do not really know how to fix it.
Done this model:
@Model
public final class Category: Codable {
var nom: String = ""
@Relationship(deleteRule: .cascade, inverse: \Property.category)
var properties: [Property]?
}
How to create #predicate to search text in like…
let predicate = #Predicate<Category> { category in
searchText.isEmpty || category.nom.localizedStandardContains(searchText) ||
category.properties.contains {
$0.nom.localizedStandardContains(searchText)
}
}
without this error:
SQLCore dispatchRequest: exception handling request: <NSSQLCountRequestContext: 0x6000038dc620>, to-many key not allowed here with userInfo of (null)
Hi,
does someone knows about the bug, that the NSPersistentCloudKitContainer doesn't return CKShares at the first time? Is this an intended behavior?
My current fix:
let container: NSPersistentCloudKitContainer = ....
// Fix begin
let managedObject = .... // Object which is in a share
let record = container.record(for: managedObject.objectID)
// Fix end
let shares = (try? container.fetchShares(in: nil)) ?? []
If I execute exactly the same code without the fix that I fetch the record first, then it returns 0 shares. With the fix it is currently 9 shares (the actual count of the shares).
Another fix:
let container: NSPersistentCloudKitContainer = ....
// Fix begin
let _ = try? container.fetchShares(in: nil)
Thread.sleep(forTimeInterval: 0.1)
// Fix end
let shares = (try? container.fetchShares(in: nil)) ?? []
For that fix it also returns at the second time the expected count of shares. But without the delay it returns also at the second time zero shares.
Anyone had the same problem and if so, how do you solve it correctly?
Thanks!
For a kind of podcast player I need to periodically update a swiftData object to keep track of the listening progress. (Happy to hear if there are better ways) I need to do this in many places in my app so I wanted to extract the modelContext into a Singleton so I can write a global function that starts the timer.
In doing so I stumbled upon a problem: The memory used by my app is steadily increasing and the device is turning hot.
@Observable
class Helper {
static let shared = Helper()
var modelContext: ModelContext?
}
@main
struct SingletontestApp: App {
let modelContainer: ModelContainer
init() {
do {
modelContainer = try ModelContainer(
for: Item.self, Item.self
)
} catch {
fatalError("Could not initialize ModelContainer")
}
Helper.shared.modelContext = modelContainer.mainContext
}
var body: some Scene {
WindowGroup {
ContentView()
}
.modelContainer(modelContainer)
}
}
struct ContentView: View {
@Query private var items: [Item]
var body: some View {
NavigationSplitView {
List {
ForEach(items) { item in
Text(item.timestamp, format: Date.FormatStyle(date: .numeric, time: .standard))
}
}
.toolbar {
ToolbarItem {
Button(action: addItem) {
Label("Add Item", systemImage: "plus")
}
}
ToolbarItem {
Button(action: updateItemPeriodically) {
Label("Change random", systemImage: "dice")
}
}
}
} detail: {
Text("Select an item")
}
}
func addItem() {
withAnimation {
let newItem = Item(timestamp: Date())
Helper.shared.modelContext!.insert(newItem)
}
}
@MainActor
func updateItemPeriodically() { // Doesn't matter if run as global or local func
let descriptor = FetchDescriptor<Item>(sortBy: [SortDescriptor(\.timestamp)])
let results = (try? Helper.shared.modelContext?.fetch(descriptor)) ?? []
let element = results.randomElement()
let timer = Timer.scheduledTimer(withTimeInterval: 2, repeats: true) { timer in // Smaller time intervals worsen the problem
element?.timestamp = Date.now
}
}
}
Calling save() manually or automatically in the timer does not have any effect. I am not sure about my general way of keeping track of listening process so if you think there is a better way, feel free to correct me.
Thanks for your help
Xcode NSMetaDataQuery error on device running IOS 17.5 - [ERROR] couldn't fetch remote operation IDs
Xcode 15.4 running on various IOS simulators and hardware devices from IOS 14.5 to 17.5.
Part of my code presents a backup/restore page to the user which uses NSMetaDataQuery to update the GUI for files being uploaded or downloaded in iCloud. On every device I run the code everything works as expected EXCEPT one which is an iPhone 11 running IOS 17.5 (as of yesterday 17.5.1); there I get the following error once I start the query:
[ERROR] couldn't fetch remote operation IDs: NSError: Cocoa 257 "The file couldn’t be opened because you don’t have permission to view it." "Error returned from daemon: Error Domain=com.apple.accounts Code=7 "(null)""
Due to this error I am getting no query updates and thus unable to display whether the file needs to upload, download or is synchronised.
I am not initiating any upload or download of the backup file since it is placed in the ubiquitous container and I leave the up/download of the file over to IOS; all I do with the query is monitor the status of the file and take appropriate action to show the user the percentage of up/downloaded file.
As said before it is only the one device causing me headaches so I don't know whether it has anything to do with IOS 17.5 that Apple have made changes that I am unaware of. I have access to an iPhone and an iPad running some version of IOS 16 and it's performing flawlessly. I have no other IOS17+ device to test on.
The code runs very well on any 17.5 simulator, but we all know there are always some differences running code on a Device vs Simulator.
Running 'startAccessingSecurityScopedResource()' which has been suggested by some returns 'true' on the simulator and 'false' on a device, but even then all devices work except one; so that does not seem to be the solution. Changing the query predicate has not helped either.
How do I drill down to find the culprit - I'm at my wits' end.
My very simple query initializer, startup & observers:
(Please note, the code shown here is what's left after commenting out everything else. This was done to show that the problem really DOES lie with the Query)
query = NSMetadataQuery.init()
query.operationQueue = .main
query.searchScopes = [NSMetadataQueryUbiquitousDocumentsScope]
query.predicate = NSPredicate(format: "%K LIKE %@", NSMetadataItemFSNameKey, fileUrl.lastPathComponent)
query.operationQueue?.addOperation({ [weak self] in
self?.query.start()
self?.query.enableUpdates()
})
}
func addNotificationObservers() {
NotificationCenter.default.addObserver(
self,
selector: #selector(queryDidStart(_:)),
name: .NSMetadataQueryDidStartGathering,
object: query)
NotificationCenter.default.addObserver(
self,
selector: #selector(queryGathering(_:)),
name: .NSMetadataQueryGatheringProgress,
object: query)
NotificationCenter.default.addObserver(
self,
selector: #selector(queryDidUpdate(_:)),
name: .NSMetadataQueryDidUpdate,
object: query)
NotificationCenter.default.addObserver(
self,
selector: #selector(queryDidFinishGathering(_:)),
name: .NSMetadataQueryDidFinishGathering,
object: query)
}
We worked with SwiftData, and once CloudKit was integrated, the synchronization worked well. Even if I rerun the app, it works just as well.
However, when I delete the app and reinstall it, I get a Token Expired error and CloudKit doesn't work properly.
My code is organized like this
public lazy var modelContext: ModelContext = { ModelContext(modelContainer) }()
private lazy var modelContainer: ModelContainer = {
let schema = Schema([
Entity1.self,
Entity2.self,
Entity3.self,
])
let modelConfiguration = ModelConfiguration(
schema: schema,
groupContainer: .identifier("myGroupContainer"),
cloudKitDatabase: .automatic
)
do {
return try ModelContainer(for: schema, configurations: [modelConfiguration])
} catch {
fatalError("Could not create ModelContainer: \(error)")
}
}()
The error content is as follows
error: CoreData+CloudKit: -[PFCloudKitImportRecordsWorkItem fetchOperationFinishedWithError:completion:]_block_invoke(707): <PFCloudKitImporterZoneChangedWorkItem: 0x3022c0000 - <NSCloudKitMirroringImportRequest: 0x3036e7ac0> 1A7E53D4-E95B-423F-8887-66360F6D8865> {
(
"<CKRecordZoneID: 0x301bb1bf0; zoneName=com.apple.coredata.cloudkit.zone, ownerName=__defaultOwner__>"
)
} - Fetch finished with error:
<CKError 0x301bb5650: "Partial Failure" (2/1011); "Couldn't fetch some items when fetching changes"; uuid = 3F346302-C3EE-4F72-820C-988287C92C0A; container ID = "MyContainerID"; partial errors: {
com.apple.coredata.cloudkit.zone:__defaultOwner__ = <CKError 0x301bb1830: "Change Token Expired" (21/2026); server message = "client knowledge differs from server knowledge"; op = 515034AC3ADC4348; uuid = 3F346302-C3EE-4F72-820C-988287C92C0A>
}>
error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _importFinishedWithResult:importer:](1390): <PFCloudKitImporter: 0x3000a1240>: Import failed with error:
<CKError 0x301bb5650: "Partial Failure" (2/1011); "Couldn't fetch some items when fetching changes"; uuid = 3F346302-C3EE-4F72-820C-988287C92C0A; container ID = "MyContainerID"; partial errors: {
com.apple.coredata.cloudkit.zone:__defaultOwner__ = <CKError 0x301bb1830: "Change Token Expired" (21/2026); server message = "client knowledge differs from server knowledge"; op = 515034AC3ADC4348; uuid = 3F346302-C3EE-4F72-820C-988287C92C0A>
}>
Forcing the ModelContainer to be reinitialized fixes the problem,
it's a problem to get this error in the first place,
the error doesn't even go to fatal for me, so I don't even know how to verify that it's happening.
Is there something I'm doing wrong, or do you have any good ideas for solving the same problem?
As of yesterday all queries my app makes to the CloudKit database, and requests via the CloudKit console result in 500 internal errors. We have made no changes to the database or app that could have caused this.
The status page for CloudKit database is green.
Here is a response from the CloudKit console:
{code: 500, message: "internal-error", reason: "Internal error", detailedMessage: undefined, requestUuid: "808955a2-e564-459e-ba9b-1101917ce1a4"}
While Query Record show error:
{
"code": 500,
"message": "internal-error",
"reason": "Internal error",
"requestUuid": "c10d378f-7133-4bea-a40d-d957f80f5de4"
}
Every record type in this container show same error.
But other containers of my apps works will.
I have my desktop in the iCloud. On a regular basis, my iCloud comes to a point where it wants to upload every single file again, so it sets every existing file on "Waiting for upload", and takes 3 – 5 days to reupload everything. I don’t know what causes this, it comes out of the blue sometimes. During that time, I can’t copy files, and can’t open some programs like Xcode. How can I avoid this?
Hello
I have a swiftUI/swiftData document based app. In this I have created a singleton object using the folllowing in my ContentView struct:
@Query private var persistantStores:[PersistantStateManagerStorage]
@State private var stateManager: PersistantStateManagerStorage?
I then, call the following on the onAppear and onDisappear calls on the top level HStack{} item in my view
.onAppear(){
if let store = persistantStores.first
{
self.stateManager = store // data.first
} else
{
self.stateManager = PersistantStateManagerStorage()
modelContext.insert(stateManager!)
try? modelContext.save()
}
}.onDisappear(){
print("bye bye")
self.stateManager = nil
}
I then wrap my view inside a
if let stateManager = stateManager {}
block to unwrap the optional, and bind to values with a call such as
Stepper("Nudge Amount", value: Bindable(stateManager).nudgeAmount, in: 1...20)
I have to use Bindable(stateManager) rather than $stateManager as the $stateManager doesn't know its been unwrapped
All of this works fine until I close a document, at which point I get a crash with the message "SwiftData/BackingData.swift:124: Fatal error: Unable to get value - no backing Managed Object" which appears to happen when trying to access some of the properties of my persistantStore object (which has been retired)
I assume that my persistantStore object being an optional is part of the problem but I can't work out a better method of doing what I am trying to do
Recently, I have been using SwiftData as a data persistence tool in my new SwiftUI app.
My app utilizes CLLocationManager for background location tracking to wake up the app and update SwiftData-related data. When the app is in the foreground or background, SwiftData's @Query can normally retrieve data. However, once the user manually terminates the app and it receives a location-based wake-up, SwiftData's @Query no longer retrieves data. I have looked through many resources and haven't found any similar documentation. I wonder if anyone can give me some suggestions?
We started to see some crashes in our iOS app a few seconds after launch with the following reason:
Exception Type: EXC_CRASH (SIGILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: SIGNAL 4 Illegal instruction: 4
when calling [NSPersistentContainer loadPersistentStoresWithCompletionHandler:].
I've looked through Understanding the exception types in a crash report page, but couldn't find this type there.
Any ideas what could it be?
I recently converted a Core Data app to use CloudKit. Before the conversion, the sqlite file was around 25MB. After the conversion, the file grew to over one gigabyte. I ran sqlite3_analyzer on the new file and found that a single table, ANSCKRECORDMETADATA, used 95% of the storage, 998MB.
Is this to be expected? I confess that the conversion was a bit bumpy. Maybe I did something to create a monstrosity.
If not expected, should I revert to the old Core Data file, create a new CloudKit container, and repeat the conversion.