Post

Replies

Boosts

Views

Activity

Testing CloudKit Apps using the simulator
Hey everyone! I'm starting a new Multiplatform application with Core Data and CloudKit checked off. Before continuing I want to make sure the data is persisting between devices BUT can't figure out how to test that with the simulator. I can run the app on my Mac (under my apple account), can't run it on my phone (didn't download the beta), and when I try to log into the simulator with my Apple ID it gives me a "Verification Failed - An unknown error occurred". How do you test synced data between simulated devices???
2
0
1.5k
Jun ’22
Issue with "Could not find or use auto-linked library zlib"
I've added a package to my Mutliplatform project (Shout) that is now causing an error. When I attempt to build my program on my MacOS Ventura I get a warning "Could not find or use auto-linked library zlib" and six errors about undefined symbols from the zlib library: _deflate, _deflateEnd, _deflateInit_, _inflate, _inflateEnd, and _inflateInit_ I've added paths to my target's Build Settings under Library Search Paths and it doesn't seem to help. Has any one seen anything like this and can help me build the project? It was working with the previous version of my app on the previous stable version. I am running the beta Ventura with the new Xcode version and started a new app to move my code over in parts.
0
1
836
Jun ’22
Good tutorial for hooking CloudKit into a SwiftUI project.
I'm working on hooking up a Multiplatform app with CloudKit (using CoreData) and I was wondering if anyone knows any current tutorials to help me understand the process better? I was trying to wrap my head around the WWDC 2022 tutorial CoreDataCloudKitDemo but it isn't SwiftUI and I'm getting bogged down by the non-relevant code. Thanks everyone :)
1
0
1.7k
Jun ’22
Canceling an Edit: When to alert?
During one of the WWDC talks this year I remember hearing that when a user clicks cancel on an edit form you should show an alert warning them about discarding the changes before leaving. YET if there aren't any changes we should just exit when canceled. Looking back at that I wonder how do you know if there are no changes? Right now I load the Core Data Entity fields on my page and set them one by one on save. Is there a better way that would also make it easier to know when to leave and when to warn when canceling? Are there any examples of this? Thanks everyone.
6
0
1.7k
Jun ’22
MacOS Sidebar is closed on default when app is run
Hi, I'm creating a SwiftUI MacOS app with a NavigationSplitView consisting of a Sidebar and Detail. It works great; however, whenever I ran the app the sidebar is hidden. As a user I can easily click the button or menu option to bring it back BUT it's frustrating to do AND I need to test the app now. Is there a way to have it open by default when running the app or, at least, programmatically so I can set it as a user default? And/Or a way to make it visible when running UITests? Thanks
1
0
1.1k
Jul ’22
PhotoLibrary won't load on simulator but does on my iPad
I'm creating a multiplatform app on the Beta Xcode and have just migrated code over to set an image from the photo library. When I run the app on my iPad (with beta OS) it works fine. When running the same code on the iOS simulator I end up with a blank view without any images. There are a lot of errors outputted to the console starting with: 2022-07-12 09:59:46.037994-0700 MyAppName[10647:2080202] [UIFocus] TtGC7SwiftUI14_UIHostingViewVS_7AnyView implements focusItemsInRect: - caching for linear focus movement is limited as long as this view is on screen. objc[10647]: Class _EXRunningExtension is implemented in both myPathway/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/ExtensionFoundation.framework/ExtensionFoundation (0x7ff864a43f90) and myPathway/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/ExtensionFoundation.framework/ExtensionFoundation (0x1231e5d48). One of the two will be used. Which one is undefined. objc[10647]: Class EXConcreteExtension is implemented in both myPathway/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/ExtensionFoundation.framework/ExtensionFoundation (0x7ff864a43fe0) and myPathway/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/ExtensionFoundation.framework/ExtensionFoundation (0x1231e5d98). One of the two will be used. Which one is undefined. objc[10647]: Class EXExtensionPointCatalog is implemented in both myPathway/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/ExtensionFoundation.framework/ExtensionFoundation (0x7ff864a44030) and myPathway/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/ExtensionFoundation.framework/ExtensionFoundation (0x1231e5de8). One of the two will be used. Which one is undefined. and ending with: objc[10647]: Class _EXSceneSessionConnectionResponse is implemented in both myPathway/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/ExtensionFoundation.framework/ExtensionFoundation (0x7ff864a45250) and myPathway/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/ExtensionFoundation.framework/ExtensionFoundation (0x1231e7008). One of the two will be used. Which one is undefined. objc[10647]: Class EXService_Subsystem is implemented in both myPathway/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/ExtensionFoundation.framework/ExtensionFoundation (0x7ff864a452a0) and myPathway/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/ExtensionFoundation.framework/ExtensionFoundation (0x1231e7058). One of the two will be used. Which one is undefined. objc[10647]: Class _EXConnectionHandlerExtension is implemented in both myPathway/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/ExtensionFoundation.framework/ExtensionFoundation (0x7ff864a45318) and myPathway/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/ExtensionFoundation.framework/ExtensionFoundation (0x1231e70d0). One of the two will be used. Which one is undefined. objc[10647]: Class EXXPCUtil is implemented in both myPathway/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/ExtensionFoundation.framework/ExtensionFoundation (0x7ff864a45340) and myPathway/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/ExtensionFoundation.framework/ExtensionFoundation (0x1231e70f8). One of the two will be used. Which one is undefined. 2022-07-12 09:59:47.154471-0700 MyAppName[10647:2080475] [NSExtension] Unable to setup extension context - error: Couldn’t communicate with a helper application. 2022-07-12 09:59:47.154654-0700 MyAppName[10647:2080349] [NSExtension] Async Begin using error: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.mobileslideshow.photo-picker.apple-extension-service" UserInfo={NSDebugDescription=connection to service named com.apple.mobileslideshow.photo-picker.apple-extension-service} 2022-07-12 09:59:47.154847-0700 MyAppName[10647:2080202] UIImagePickerController UIViewController create error: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.mobileslideshow.photo-picker.apple-extension-service" UserInfo={NSDebugDescription=connection to service named com.apple.mobileslideshow.photo-picker.apple-extension-service} I guess I'm wondering if someone else came across this and how you fixed it. Is it an error on my side or the beta software?
2
0
1.7k
Aug ’22
Plist values in Xcode Beta
Hey, I'm coding my app in the Xcode Beta 2 and am attempting to access the HKHealthStore() to add a HKCategorySample. When I run the app and attempt to add the sample I get the following error: Error Domain=com.apple.healthkit Code=4 "Missing com.apple.developer.healthkit entitlement." UserInfo={NSLocalizedDescription=Missing com.apple.developer.healthkit entitlement.} When I make sure to requestAuthorization before running the code I get a different error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NSHealthShareUsageDescription must be set in the app's Info.plist in order to request read authorization for the following types: HKCategoryTypeIdentifierMindfulSession' I'm assuming I need to add to my Info.plist but am unable to figure out how. If I go to my project or project's target and access Build Settings I see the following image: But am unable to edit it. I assuming I want to add NSHealthShareUsageDescription with a String explanation for why I want access but anything I find online is for an older Xcode so I don't know how to do it. Any help to get this working would be really appreciated. Thank you
3
0
2.2k
Sep ’22
Automatic Signing and Entitlements
I have a multiplatform app that I'm coding that uses HealthKit. To get it working I needed to add a custom entitlement to the entitlements file. Specifically "application-identifier". See this solved question for more information: https://developer.apple.com/forums/thread/713829 Now I can only run the app on my simulators and NOT on my phone or Mac as the automatic signing is failing Provisioning profile "iOS Team Provisioning Profile: myName.AppName" doesn't match the entitlements file's value for the application-identifier entitlement. It says to submit a bug report: Automatic signing failed. Xcode failed to provision this target. Please file a bug report at <https://feedbackassistant.apple.com> and include the Update Signing report from the Report navigator. Which I did FB11512832, but is there something I can do to fix this or is it just a wait and see? Error image:
1
0
1.5k
Sep ’22
Publishing changes from async model
I'm attempting to figure out how to display a message to my users when some asynchronous code takes some time to run. So far I've used a sample I found online to create a popup banner and tied the message together using an ObservedObject of the async method on my view and Publishing the values. My sample code project is on a public GitHub repository here. https://github.com/SimplyKyra/CodeAttempts Right now I have an issue as when I set the variables in the async method I'm getting the following error: Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates. Solutions online seem to fix this issue by updating the value on the @mainActor thread but I want these methods to run asynchronously AND update the user on what's happening. What's the best way to update my variables from this location?
2
0
3.7k
Oct ’22
Help finding sample code
Hey, During a developer Q&A today I was referred to a "Sundae shop" (the ice cream) sample code from, I think it was, WWDC 2020. Does anyone know where I can find it? I want it mainly for ObservedObject updates for my view from an async model. Thanks :)
3
0
844
Oct ’22
Display an SVG file in macOS and/or iOS
Hi. I’m developing a multiplatform app for both iOS and macOS and was wondering if there’s any way to display an SVG file in the swiftUI view. I’ve seen ways online once you put the image in the assets file but this will be dynamic coming from outside the program. I just want to display and maybe rotate it but nothing more complicated than that. thanks
1
0
1k
Dec ’22
CloudKit, CoreData, and Encryption
I'm developing a Multiplatform app that uses CloudKit to sync the CoreData between the user's devices. At this time they don't share data between users. I have a single password field on a single Entity and was wondering if there was a simple way to encrypt just this field. I see in CoreData there's a checkbox labelled "Allows Cloud Encryption"... does checking that off magically encrypt it. I checked it off and nothing seemed to change so I unchecked it for now... is there something else I needed to do? And, most importantly, will it work with CloudKit?
1
0
1.8k
Dec ’22
XCTest and setting up a service in the setup and tear down methods?
I'm looking to test my Xcode project using the default file set up XCTestCase... but I need to test it against a service that will need to be started before the test and stopped after the test. I was hoping to start and end it within the setUpWithError and tearDownWithError methods but I don't know how. Is there a way I could run commands from the testing environment? Basically I want to figure out where it's executing from ls one time, move my files over, and then I can go through starting the service setUpWithError, running the tests, and then ending the service tearDownWithError. Specifically the service runs a Docker image and I use a Makefile to make it a simple command. I just want to start and end it from the test environment. Thanks
0
0
815
Dec ’22
Permission denied - Attempting to run Docker from XCTestCase
I'm setting up tests for my Xcode Multiplatform App. To create a test environment I created a docker image that I want to run an XCTestCase against. I understand I'd have to make sure Docker is running before running the test. That said I have a permission denied when trying to connect to the docker daemon socket. Background: I'm using a makefile to store the commands and planned to run the docker build and docker run commands in the setUpWithError while running the docker kill command in tearDownWithError. To run the commands I used Process to execute the shell commands. I'm currently doing this is a test function to get it up and going. Issue: When I try to run the docker command Xcode tells me that it doesn't give me the permission to run it: docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/create?name=remarkable": dial unix /var/run/docker.sock: connect: operation not permitted. See 'docker run --help'. I only want to use Docker to run this specific XCTestCase. Is there anyway to run it from here JUST for the test? Or do I need to manually run docker and kill it before/after I run these tests? Thanks for any help.
0
0
1k
Feb ’23