When test support code relies on production code, a diamond can occur. If this occurs across packages, it can lead to duplicated symbols and incorrect behavior at runtime despite no warnings at build time. This only occurs in Xcode and top-level application testing. This doesn't occur when the code being tested is in a separate package.
I'm trying to understand how to correctly manage shared test support code which needs to access production code, or if this is the correct way and it is an Xcode bug.
For a minimized example project, see https://github.com/rnapier/SupportCode.
The setup includes three packages: Dependencies, which manages all the dependencies for the app and tests; Core which contains core logic and test support; and Feature, which relies on Core an contains feature-related logic and test support.
Building this system causes Core.framework to show up three times in DerivedData:
./App.app/PlugIns/AppTests.xctest/Frameworks/Core_59974D35D_PackageProduct.framework
./App.app/Frameworks/Core_59974D35D_PackageProduct.framework
./PackageFrameworks/Core_59974D35D_PackageProduct.framework
When unit tests are run, there is a collision on the symbol for Keychain:
objc[48914]: Class _TtC8Keychain8Keychain is implemented in both /Users/ornapier/Library/Developer/Xcode/DerivedData/App-grdjljgevqofhqgflgtrqvhvbtej/Build/Products/Debug-iphonesimulator/PackageFrameworks/Core_59974D35D_PackageProduct.framework/Core_59974D35D_PackageProduct (0x100a98118) and /Users/ornapier/Library/Developer/CoreSimulator/Devices/216C441E-4AE5-45EC-8E52-FA42D8562365/data/Containers/Bundle/Application/7197F2F2-EB26-42FF-B7DB-67116159897D/App.app/PlugIns/AppTests.xctest/AppTests (0x1011002c0). One of the two will be used. Which one is undefined.
This is not a benign warning. There are two distinct copies of _TtC8Keychain8Keychain and test cases will access one and the app will access a different one. This leads to mismatches when accessing static instances such as .shared.
I believe this dependency graph should work, and it does work as long as the top-level testing system is a Swift module. But if it is the application, it builds successfully, but behaves incorrectly in subtle ways.
Testing
RSS for tagDetect issues like logic failures, UI problems, and performance regressions by running tests on your app.
Posts under Testing tag
74 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I'm seeking advice on distributing a beta iOS app to a business partner for internal testing, but we're encountering a challenge due to their organization's use of Managed Apple IDs.
Problem
We are developing an iOS app for B2B use and need to provide our partner organization with a beta version for testing. However, this partner organization strictly utilizes Apple Managed IDs for all their employees. Their devices are configured in a way that employees cannot use personal Apple IDs on their company devices.
This effectively prevents the use of TestFlight, as TestFlight requires personal Apple IDs for testers.
We understand TestFlight is the standard recommendation for beta distribution, but it seems incompatible with organizations heavily invested in Managed Apple IDs and their associated security policies.
Question
What are the recommended alternative methods for distributing our iOS beta app to this organization for testing, considering these constraints? Are there any official Apple-recommended solutions for B2B beta testing in this scenario when TestFlight is not viable due to Managed Apple ID restrictions?
Any insights, suggestions, or alternative approaches would be greatly appreciated. We want to ensure we're following best practices and respecting the partner organization's IT policies while still enabling them to effectively test our application.
Thank you in advance
I'd like to implement unit tests that exercise keys made available via a persistent token interface. However, when attempting to list available tokens by passing kSecAttrAccessGroupToken as the kSecAttrAccessGroup to SecItemCopyMatching from a unit test, -34018 is returned. It succeeds without the kSecAttrAccessGroup, which makes sense given the unit test binary does not have com.apple.token Keychain Group. The Xcode UI indicates "Capabilities are not supported" for the unit test binary when attempting to add a Keychain Sharing capability to enable use of persistent tokens. This feels like a dead end but begs the question is there any way to implement unit tests to exercise a persistent token interface? It seems like the only path may be write unit tests that drive an independent app that handles the interactions with the persistent token.
Hello,
I'm building an expense management app and have the necessary FinanceKit entitlements. However I'm based in India and hence do not have access to an Apple Card. Is there anyway to test FinanceKit with some sort of mock data?
I have tried following the developer documentation and built a minimal implementation to share via Testflight to my users. However it's failing to get any transaction data.
I'm unable to debug the code myself and if anyone here has valid entitlements along with Apple Card, I'd appreciate if you could debug an example project I made below:
https://github.com/tanmays/FinanceKitExample
Feedback #FB14136552
Hello, everyone!
I'm currently working on creating tests for a study project in Swift. My current task is to create a test to check if a file is saved correctly.
The workflow in the app is as follows:
Launch the app.
Open a file within the app.
Modify the file.
Save it inside the app.
Save it to the Files app.
I need to verify if the saved file in the Files app is identical to a base file stored in the app bundle.
Initially, I thought I could solve this by creating a UI test, which I've already implemented up to a certain point. The UI test successfully navigates through the workflow steps until it's time to compare the saved file with the base file.
The problem is that I cannot open a saved file from the Files app in a UI test because it operates in a sandboxed environment and cannot interact with external app scopes.
So, my question is: What should I do in this case?
Would it be better to create a unit test specifically for testing the save function and ensure the UI test only verifies if the expected filename exists in the Files app?
I would prefer an end-to-end (E2E) test that covers the entire workflow, but it seems Swift splits tests into Unit and UI test groups, making this approach less straightforward.
Any suggestions or best practices would be greatly appreciated!
In my macOS app I have a SwiftUI list that starts like this:
List(selection: $selection) {
HStack {
Label("Staging", systemImage: "arrow.up.square")
Spacer()
WorkspaceStatusBadge(unstagedCount: model.statusCounts.unstaged,
stagedCount: model.statusCounts.staged)
}
(where WorkspaceStatusBadge is a custom view that just contains a Text)
I'm trying to set the accessibility ID of that first cell so I can find it in XCUITest. If I apply the accessibilityIdentifier() modifier to the HStack, it instead sets the ID of the two static text elements inside it, and the cell still has no ID.
I could find the cell based on the ID of the child staticText, but I have some other cases where this doesn't work as well.
If I use .accessibilityElement() on the HStack, then XCUI sees a cell containing a Group element with the ID. This might be workable, but it's certainly not ideal.
So how do I set the ID of the cell itself?
Hi,
Testflight app is showing "Couldn't Load Apps. TestFlight is currently unavailable. Try again." error each time when i trying to open it last 2 days. I'm tried to uninstall/re-install TestFlight app, but error still remain.
Can anyone confirm this error?
Devices which is affected with the same error: iPad 6 (2018) / iOS 17.7, iPad Pro / iOS 16.7.9, iPad Air 2 / iOS 15.8.2
So this is a long shot. My apple device has been hacked. In March, my credit card, which is in apple pay, started to get used, until May. It was used for thousands of dollars. In July i discovered installed and generally “invisible” files in the files app. I’ve called All IPhone that was a contact file.
when i started deleting everything from my phone, all messages and photos and accounts, it became obvious i was signed into the app store in a sandbox account i never signed up for or into. I believe this is one method by device as compromised through apple.
does anyone have any ideas on if it would be possible for a hacker to use my apple pay through some scam developer who had initiated a testing agreement between myself and them?
All tests build and run locally just fine. Xcode Cloud can build my code, but always fails to run tests with the below errors. How can I even begin to troubleshoot this?
I think my setup is pretty straightforward. Just a simple test plan that execute some unit tests with Swift Testing.
Run command: 'xcodebuild test-without-building -destination 'platform=iOS Simulator,id=1EB80431-1A0B-4AD8-8EA6-968EA09C3F23' -resultBundleVersion 3 -resultBundlePath /Volumes/workspace/resultbundle.xcresult -resultStreamPath /Volumes/workspace/tmp/resultBundleStream679e7ce9-a095-4be5-8dfa-4c9df982e547.json -IDEPostProgressNotifications=YES -DTDKDisableSymbolCopying=YES -test-timeouts-enabled YES -maximum-test-execution-time-allowance 1800 -hideShellScriptEnvironment -maximum-parallel-testing-workers 8 -testProductsPath /Volumes/workspace/TestProducts.xctestproducts'
(6378) encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted. (Underlying Error: Test crashed with signal ill before starting test execution.))
May be related to:
https://developer.apple.com/forums/thread/725660
Topic:
Developer Tools & Services
SubTopic:
Xcode Cloud
Tags:
XCTest
Testing
Xcode Cloud
Swift Testing
Hi developers,
I'm searching for a kind of way of working to develop my apps on a different machine than testing and final building.
For development I have a MacBook Pro m4 and for testing I want to outsource this to a Mac mini m1. I was searching for a solution and also contacted the support, but the answer wasn't really helpful.
Any ideas how to setup this configuration to automate this kind of tests?
Thanks a lot!
I have uploaded an beta version into Testflight and added few member under internal testing. However, no one can receive an internal testing invitation email. I tried to re-upload a new version and re-create a new internal testing group but no luck.
Thank you so much.
My current project is similar to Facebook In size. Is there an alternative to MVVM that will produce the same outcome without so many files. Performance is very poor.
Hi everyone,
I'm getting this error when I try to test my app on my iPhone.
If any other developers who have gotten the same error could help, that would be great.
Thanks, Oliver
Background:
We are developing an App for both Windows, Android and iOS.
Our process is that virtually every pull request must be tested by a tester before being pushed to the main branch.
Up until now, we have been distributing the 3 versions to our testers via Microsoft AppCenter. Unfortunately, AppCenter is stopping per 31 March 2025 and we are looking for an alternative method.
As the Play Store isn't really useful for us for distributing android apps (a test build can take a few hours before appearing according to their documentation), we may have to look into setting up our own distribution website for our apps.
As such I was wondering, rather then using Test Flight for iOS, to also distribute the iOS app via our own website to our testers as it would be easier for our testers to have everything together.
Even though our apps are build and signed using an "ad hoc" provisioning profile, it's still not possible to just install the .IPA files just by downloading it.
The actual question:
So my question is, how can I install our app to our testers from a website. Do I have to set the link as something specific?
Or has AppCenter been using a trick not available to us mere mortals?
To clarify: I am only asking for distributing to our testers using the ad hoc provisioning profile with the test devices registers at apple. I am NOT asking for distribution to end users, that goes via the App Store as usual.