Posts

Post not yet marked as solved
0 Replies
356 Views
I have two apps which uses the CloudKit public folder so that my users can access data. There's also a private database for them to save data. One is supposed to be able to access the public database without being logged into an iCloud account. And it was working fine. But now, with the simulator, I get the titled error message. It's fine on a device. But, if I log into the simulator with my iCloud account, I can access the public data.
Posted
by SpaceMan.
Last updated
.
Post not yet marked as solved
6 Replies
677 Views
I currently have a UIKit app which uses a UIStoryboard and which has a tab bar controller. I removed the tab bar controller from the storyboard and created a tab bar app in SwiftUI which has the UIKit views represented as UIViewControllerRepresentable within structs. I changed the visionOS app destination from 'visionOS Designed for iPad' to 'visionOS' because I want to see the tabs on the left side in visionOS. I got a ton of warnings and some errors. I fixed the errors (which were related to user location). But the warnings are with regards to the storyboard and storyboard segue. The app runs perfectly fine but the warnings warn that UIStoryboard and UIStoryboardSegue will not be supported in a future version of visionOS. I wonder first why this was done and second, how much time will I have to fix the warnings? Could I release the app as is and fix later or will the support be dropped in a short timeframe? One of the ways to create views for view controllers in UIKit is through a storyboard. If you kill those in visionOS, then you restrict a big way that one can embed a UIKit view controller in SwiftUI.
Posted
by SpaceMan.
Last updated
.
Post marked as solved
3 Replies
802 Views
I actually have found a workaround to an issue I reported on earlier. Here it is by example. let predicate = #Predicate<Data> { data in data.result == result && data.variable?.starts(with: SomeString) ?? false } Note the data.variable?. and the ?? false. This works. I still don't think I should have to discover these things. Something needs to be fixed on Apple's end.
Posted
by SpaceMan.
Last updated
.
Post not yet marked as solved
3 Replies
1.1k Views
I'm in the process of converting one of my apps to SwiftData. I converted the other ones over. This app has a much more involved Schema, but SwiftData seems to handle it well. My issue is when I try to fetch data based on a. #Predicate. Here's my code. let predicate = #Predicate<Data> { data in data.result == result && data.variable!.starts(with: SomeString) } let sortBy = [SortDescriptor<Data>(\.result] let descriptor = FetchDescriptor<Data>(predicate: predicate, sortBy: sortBy) if let theData = try? context?.fetch(descriptor) { The if let at the bottom fails. Note that 'variable' is optional while result is not. I have to use ! in the predicate since it's a bool that is returned. If my predicate were just data.result == result, then all is well. I can then check the received data for the second condition in the predicate just fine. It just doesn't work inside of the Predicate. The same is true if I used contains. Anybody else having this issue? I'm using Xcode 15.0 beta 6.
Posted
by SpaceMan.
Last updated
.
Post marked as solved
9 Replies
1.5k Views
I have an app that uses Core Data and CloudKit that I am trying to convert into a SwiftData CloudKit app. Things were working very well until this most recent beta (beta 5) of Xcode 15.0. I have image data which the app saves as Data in external storage. I let Xcode convert my Core Data model in to a SwiftData model. As I said, things were working well. I could turn the image data into an Image for SwiftUI. That is, until beta 5. With beta 5, I get the following. SwiftData/BackingData.swift:210: Fatal error: 'try!' expression unexpectedly raised an error: Swift.DecodingError.dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON." Well the data is NOT JSON, it is image data and yet, I get this fatal error. Does anybody else see this? I have saved data using the app on the beta 5 simulator using SwiftData and I have verified that the data is correct using my core data app. The images are fine.
Posted
by SpaceMan.
Last updated
.
Post not yet marked as solved
0 Replies
336 Views
A good while back, I created a Mac Catalyst version of an app. The app uses UICalendarView for both iOS and Mac. I have multiple date selection enabled. In the past, I thought I could select multiple dates on the Mac without needing to use the Command key modifier. And now I can't. Is this a change or am I dreaming? How can I go back to being able to select multiple dates without using the command key modifier?
Posted
by SpaceMan.
Last updated
.
Post not yet marked as solved
0 Replies
277 Views
I am testing out the new MagnifyGesture SwiftUI feature. My suggestion is to bring the view being magnified to the top of all views in the hierarchy while it is being magnified. I've submitted the suggestion in Feedback Assistant. Any comments on this suggestion?
Posted
by SpaceMan.
Last updated
.
Post marked as solved
1 Replies
936 Views
I have SwiftData and CloudKit working on a new version of my UIKit app. The current version uses CoreData/CloudKit I have a question. How does one know when there there is new or deleted data to update a view in a UIKit app with SwiftData? CoreData has NSPersistentStoreRemoteChangeNotificationOptionKey. What does SwiftData have that's equivalent? It's not feasible to redo my whole app to use SwiftUI at this stage.
Posted
by SpaceMan.
Last updated
.
Post marked as solved
3 Replies
547 Views
I have an app with a CloudKit Public Database in which a CKRecord can contain a CKAsset or two that holds the url of image data. I don't want to always obtain the image data so my desiredKeys excludes the CKAsset key in the CKRecord in that case. I use the following Swift function. var (matchResults, queryCursor) = try await database.records(matching: query, desiredKeys: desiredKeys) The desiredKeys variable could be an array of strings with the keys of CKRecord fields I want to return or nil if I want all of the data including the asset data. After I have the records, I do the following. if let imageAsset = record["ImageAsset"] as? CKAsset, let url = imageAsset.fileURL, let data = try? Data(contentsOf: url) { self.imageData = data } However, when I exclude the "ImageAsset" key from the desiredKeys array, my if let imageAsset contains the asset information. Looking at the received data, I can see that other keys that I exclude are not being downloaded, but the CKAsset url appears to be downloaded. Why? I expected that the if let would have been nil and the code within the if let would not have been executed.
Posted
by SpaceMan.
Last updated
.
Post marked as solved
3 Replies
1.7k Views
I have used Xcode for app signing since its inception. Before that, I managed signing like everybody else did - manually. Today I uploaded the iOS version of my app fine, but when I tried to upload the macOS version, I got the following. Invalid Provisioning Profile Signature. The provisioning profile included in the bundle com.blablabla.BlaBla [com.blablaba.BlaBla.pkg/Payload/BlaBla.app] cannot be used to submit apps to the Mac App Store until it has a valid signature from Apple. For more information, visit the macOS Developer Portal. This is the first time that I've gotten this error. I am probably missing something simple. At least, I hope that I am. Can anybody help me? I am using Xcode 14.3.
Posted
by SpaceMan.
Last updated
.
Post marked as solved
3 Replies
1.1k Views
I added Core Data to my app. My core data model has an Entity with 3 Binary Data attributes with external storage along with other attributes. I saved an array of data to core data and when I examine the result on CloudKit Dashboard, I see two of the three data record fields are of type Bytes and one is of type CKAsset. Looking at a particular piece of data in the cloud (I added Queryable to recordName), I see the CKAsset data as 'Binary File (645.17KB)' and the Bytes data as '77+9UE5HDQ (660.66KB)'. Will this pose a problem? Why isn't the data all CKAssets in CloudKit? Will the Bytes record field hold enough data? Searching the web, I've see others having problems with Binary Data and Core Data Plus CloudKit in the past, but nobody has mentioned this specific result.
Posted
by SpaceMan.
Last updated
.
Post not yet marked as solved
0 Replies
332 Views
I am working on an update to one of my apps. The app uses CloudKit and utilizes the Public and Private databases. The user data is stored in the Private database. I have created methods to convert from CKRecords of the user's type to Codeable Structs and encode in json format and decode the json data into the array of Structs. I also have a method to create a CKRecord of the user's type from the Struct data. I am working on giving the user the option of replacing the CKRecords in the cloud with CKRecords created from a json file. I have a method which deletes all of the CKRecords followed by a method which uploads the CKRecords created from the json data. If I wait a while after this operation without using the app, it works well. But if I try to access the saved CKRecords shortly after the methods are executed, I have mixed results. Sometimes, I get less than what I uploaded and sometimes I get more than what I uploaded. I use try await on both methods and use the return value of the first method (delete) as an input into the second method (upload). Both the delete and upload methods use modifyRecords(saving: saveRecords, deleting: recordIDs, savePolicy: .allKeys, atomically: false) I do not use the modifyRecords method to do both at the same time. I use two modifyRecords methods. In all cases, the results show that the operations completed successfully even when there was an issue. I'd like for the delete method to delete all of the data and for the upload method to upload all of the json data without requiring an excessive delay.. Any advice would be most appreciated.
Posted
by SpaceMan.
Last updated
.
Post marked as solved
1 Replies
442 Views
I have burned the midnight, no, 2 AM oil to knock out the ton of Sendable warnings on my app. I have worked the issues, but have two functions remaining where I am stuck. The functions are both CloudKit functions. One of them is shown in the image. I am at a loss on how to clear this warning. Any amount of help would be most appreciated.
Posted
by SpaceMan.
Last updated
.
Post marked as solved
2 Replies
878 Views
CKRecord is a class which does not conform to the Sendable protocol. Its fields consist of NSStrings, NSData and others which are not Sendable. I understand that Apple is incrementally modifying objects to be sendable, but I am experiencing and I would assume others are experiencing a very large number of warnings (for now) about CKRecords and Sendable. It may be too much to make CKRecord Sendable and it may be too much to create a Sendable version of CKRecord, but it would be nice if it could at least be investigated. My particular situation is I have created a Protocol named CKMethods which some of my view controllers use to download and upload CKRecords. I suddenly have a large number of warnings about non-sendable types being sent from main actor-isolated context to non-isolated instance method. The CKRecords sent to and from the protocol do not get mutated and I have never had a problem with data races in the years that I have had this protocol. At some point, the warnings will probably become errors and I definitely do not want to get to that point. I am still coming up to speed on Swift Concurrency, so there may be a more simple solution than the one I am working on - creating a Sendable Struct for every CKRecord type that I have in my app and modifying all of the methods to pass the Struct instead of a CKRecord and convert the Struct to a CKRecord for upload and convert the CKRecord to the Struct for download.
Posted
by SpaceMan.
Last updated
.
Post marked as solved
13 Replies
7.2k Views
I have a major issue with @ObservedObject.I have the following statement@ObservedObject var model: UserDatain a good number of views and before Beta 5, I did not have to pass this variable into the preview, nor did I have to pass his variable into other views which already have the above statement.But now I do have to and it's a mess. Is there anyway around this?
Posted
by SpaceMan.
Last updated
.