The solution I ended up going with is the app opens a socket to listen on, writes out the port it got to a file in SIMULATOR_SHARED_RESOURCES_DIRECTORY, and the test runner reads that file and connects to the port.
I tried using a unix domain socket, but (as the app itself is in C#) the .NET API for that kept throwing PlatformNotSupportedException. I really don't know if there was a real error or if .NET just thinks iOS doesn't support domain sockets.
My approach did still require adding an entitlement, so I'll just have to modify my build script to only include that in the debug build.
Post
Replies
Boosts
Views
Activity
The problem I was running into with my macro turns out to be a compiler bug:
https://github.com/apple/swift/issues/69073
The workaround, of course, is to temporarily copy the expansion into the actual code and comment out the macro expansion.
For the record, the culprit ended up being WKUserContentController.add(_:name:) creating a retain cycle. Once I fixed that, the entire window contents got released properly.
My reason for using SecKeychainCreate/Delete is for testing purposes- I want to test my keychain code without affecting my actual keychain, so I create a temporary one for the duration of the test.
I'm having this issue too, regardless of device or signing settings.
Edit: Selecting a physical device as the destination does indeed make the errors go away.
It looks like I've solved the problem by saving the separator item when I see it in toolbarWillAddItem, and then returning it from toolbar(_:itemForItemIdentifier:willBeInsertedIntoToolbar:) to avoid having a new instance created. That way, removing and re-adding the item works without having exceptions thrown.
The last little snag was to not remove and re-add the separator blindly. The window state may have been preserved across app launches, so I needed to not make assumptions about how the window would initially appear.
It turns out the fix was to copy git out of Xcode.app, rather than using the one in /usr/bin which is just a little placeholder that forwards to xcrun, and that breaks the sandbox.
I tried adding CODE_SiGNING_ALLOWED=NO to the build settings for my test target, and it built successfully, but the tests wouldn't run since the test runner is still signed so it couldn't run an unsigned test bundle.Is there a way to un-codesign an application? Maybe I can do that to the test runner before it runs.
I tried copying git to the test bundle, but still got the same error.How I did it:Created a copy files phase to copy /usr/bin/git into the bundle's executable folder, with "code sign on copy" checkedUsed Bundle(identifier: ···)!.url(forAuxiliaryExecutable("git") to find it at runtimeSet it as the launchPath of a Process object (rather than /usr/bin/git like I was before)