Post

Replies

Boosts

Views

Activity

SwiftData, CloudKit and UIKit - Updating View When Data Changes
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.
1
1
1.4k
Jul ’23
CKAssets Download Even When desiredKeys Excludes Them
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.
3
0
930
May ’23
Xcode Automatically Managing Signing Yet Invalid Profile
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.
3
2
3.2k
May ’23
Core Data Plus CloudKit - Potential Issue / Question about Binary Data w/ External Storage
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.
4
1
1.7k
Apr ’23
Deleting then Replacing CKRecords of a Certain Type - Mixed Results
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.
1
0
459
Apr ’23
@ObservedObject Issue
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?
13
0
8.4k
Dec ’22
iCloud Private Relay Messes Up Map Search on macOS
I'm using my Mac and have macOS 13.0. I searched for 'Vinyl Record Shops' and 'Search Nearby' with Private Relay Enabled and the Map moved to Denver, Colorado while I am in Orlando, Florida. When I disable Private Relay, the search did take me to Orlando, Florida, but when I disabled it just now, it took me to Dallas / Ft Worth. I have 'Maintain General Location' selected. I don't have this issue with iOS 16.1 on my iPhone. Anybody else have this problem?
1
0
619
Nov ’22
About AR Anchor's Orientation (Some Issues and Other Things)
I've been playing around with ARKit and I am interested in the orientation of ARGeoAnchor, ARImageAnchor and ARFaceAnchor. First of all, I notice that Apple says that ARGeoAnchor is based on an East-North-Up orientation, with its x- and z-axes matching the longitude and latitude directions. This should actually be characterized as an East-Up-South orientation (see https://developer.apple.com/documentation/arkit/arconfiguration/worldalignment/gravityandheading). I created an image to illustrate my point. It's the ferry building. Referring to the ARKit 4 presentation (wwdc20-10611), one can see that the 'Ferry Building' label is initially facing south and needs to be rotated by approximately -51.4 degrees about the y axis in order to face in the proper direction. As far as ARImageAnchor is concerned, it appears to me that the coordinate system is as in the below image. This is surprising to me as I would have expected it to be x to the right, y pointing up in the image and z pointing out of the image. It appears that ARPlaneAnchor's orientation is the same as ARImageAnchor. As far as ARFaceAnchor is concerned, its orientation is clearly explained in https://developer.apple.com/documentation/arkit/arfaceanchor and the orientation seems consistent to me. I wish that the other anchors were explained as well. Anyway, feel free to chime in with corrections and comments.
1
0
796
Oct ’22
NavigationStack - No Back Button
I created a very simple project with a NavigationStack and a NavigationLink as follows. Code 1. NavigationLink("Go To Next View", value: "TheView")          .navigationDestination(for: String.self) { val in Text("Value = \(val)")          } This code works fine in the simple project. But when I put this simple code into my existing app's project using a NavigationStack, it navigates to the next view fine, but there is no back button. I am updating my Apple Watch target to use SwiftUI and I want to use NavigationStack. My app does use @ObservedObject and my important data is using @Publish in a singleton class which conforms to ObservableObject. But this NavigationLink code, Code 1, is extremely simple and should work fine, but it does not. The same problem happens with the following code. Code 2 NavigationLink { NextView() } label: {     MainRowView(rowText: "Saved") } When I switch to NavigationView, Code 1 is grayed out, but Code 2 works fine and has a back button. However, as you know, NavigationView is being deprecated, so I really need to fix this or have it fixed. I can't see how this could be a problem with my code as the code snippet is so simple and worked in the simple project.
4
0
2.6k
Aug ’22
AttributeGraph: cycle detected through attribute - ScrollView The Cause
I have a number of 'AttributeGraph: cycle detected through attribute' console messages. On a whim, I commented out the two ScrollViews which I have in the app and the messages stopped. I set a symbolic breakpoint at 'print_cycle' to break when the attribute graph cycle is detected. Sure enough, the ScrollView has become the first responder. #5 0x0000000184488a1c in ___lldb_unnamed_symbol120650 () #6 0x00000001849efd94 in ___lldb_unnamed_symbol168748 () #7 0x00000001849ed128 in ___lldb_unnamed_symbol168728 () #8 0x00000001849ec26c in ___lldb_unnamed_symbol168655 () #9 0x00000001849ec400 in ___lldb_unnamed_symbol168660 () #10 0x0000000184baa210 in ___lldb_unnamed_symbol185453 () #11 0x0000000184baa260 in ___lldb_unnamed_symbol185454 () #12 0x00000001a277ed60 in -[UIResponder _setFirstResponder:] () #13 0x00000001a2b29d38 in -[UIView _setFirstResponder:] () #14 0x00000001a277ed50 in -[UIResponder _setFirstResponder:] () #15 0x00000001a2b29d38 in -[UIView _setFirstResponder:] () #16 0x00000001a2ad55ac in -[UIScrollView _becomeFirstResponder] () I can't remove the ScrollViews, so I wonder if there is anything I can do about this.
0
1
1.2k
Jul ’22