Build, test, and submit your app using Xcode, Apple's integrated development environment.

Xcode Documentation

Post

Replies

Boosts

Views

Activity

Simulator not working
Since its update to iOS 18.0, I have not been able to use the Simulator in Xcode at all. It is stuck loading for a very long time, and then it crashes. I managed to get it to start once, but it used up all of my system's memory immediately. I have not had any problems with the Simulator before the iOS 18.0 update. Additionally, after the Simulator crashing, the StoryBoard usually stops working as well, until I restart Xcode. (I use an M1 MacBook Air with 8GB of RAM)
0
0
111
4d
StoreKit Testing with different Country Codes
I am writing unit tests that change the country by setting the .storefront property of SKTestSession to different country codes. I have made sure that the country codes I am using are indeed valid based on ISO 3166-1 alpha-3 region code standards. My default storefront in the StoreKit Configuration file is "USA" but in the unit test, I set it to say "IND" and it runs my test. In the production code, when I print await Storefront.current?.countryCode, I indeed get "IND" as expected. Now when I change the value to say "RUS" by assigning it to the SKTestSession instance, the printed value in production code is still "IND" from the previous assignment. If I call .resetToDefaultState() on the session after first test passes with "IND", it defaults to "USA" but when I set it to "RUS" in my test after it, it stays on "USA". Basically the value does not change after the first change and calling reset resets it to configuration file default but reassigning a new value has no effect on Storefront. What am I doing wrong? Btw, I have tested with both XCTest and Swift Testing but the testing framework has nothing to do with this issue. I am on Xcode 16, macOS 15, Swift 6
1
0
127
5d
Compile problem on Sonoma 14.7 with Command Line Tools
I have problems compiling a C++ code on a new MacBook Pro, which I didn't encounter on a previous machine. The error message is as follows. In file included from multipacting/src/genptab.h:12: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/usr/include/c++/v1/iostream:43: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/usr/include/c++/v1/ios:223: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/usr/include/c++/v1/__locale:15: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/usr/include/c++/v1/__memory/shared_ptr.h:24: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/usr/include/c++/v1/__memory/allocation_guard.h:15: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/usr/include/c++/v1/__memory/allocator_traits.h:14: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/usr/include/c++/v1/__memory/construct_at.h:23: /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/usr/include/c++/v1/new:241:14: error: no type named 'size_t' in namespace 'std'; did you mean simply 'size_t'? operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS; ^~~~~ /Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/include/stddef.h:46:23: note: 'size_t' declared here typedef SIZE_TYPE size_t; ^
1
0
81
5d
Xcode 16.0 Crashing on macOS 15: NSInvalidArgumentException
Hello everyone, I’m facing a frustrating issue with Xcode 16.0 crashing immediately upon startup after I upgraded to macOS 15.0. Any help appreciated! Translated Report (Full Report Below) Process: Xcode [10530] Path: /Applications/Xcode.app/Contents/MacOS/Xcode Identifier: com.apple.dt.Xcode Version: 16.0 (23051) Build Info: IDEApplication-23051000000000000~2 (16A242d) App Item ID: 497799835 App External ID: 869020508 Code Type: X86-64 (Native) Parent Process: launchd [1] User ID: 501 Date/Time: 2024-09-28 01:24:51.5167 +0100 OS Version: macOS 15.0 (24A335) Report Version: 12 Bridge OS Version: 9.0 (22P353) Anonymous UUID: D25ADD90-233B-1703-21AC-A6FA4E3D75B8 Sleep/Wake UUID: F37B53C4-1D4C-40B4-AA91-30FD1B0B2D51 Time Awake Since Boot: 14000 seconds Time Since Wake: 6748 seconds System Integrity Protection: enabled Crashed Thread: 1 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Termination Reason: Namespace SIGNAL, Code 6 Abort trap: 6 Terminating Process: Xcode [10530] Application Specific Information: abort() called Application Specific Signatures: NSInvalidArgumentException Application Specific Backtrace 0: 0 CoreFoundation 0x00007ff8086186d6 exceptionPreprocess + 242 1 DVTFoundation 0x000000010ded4173 DVTFailureHintExceptionPreprocessor + 448 2 libobjc.A.dylib 0x00007ff8080ffc00 objc_exception_throw + 62 3 CoreData 0x00007ff80f587f49 -[NSPersistentContainer loadStoreDescriptions:withCompletionHandler:] + 745 4 CoreData 0x00007ff80f336a75 -[NSPersistentContainer loadPersistentStoresWithCompletionHandler:] + 421 5 XcodeCloudKit 0x0000000122d8b178 $sSo21NSPersistentContainerC13XcodeCloudKitE24xcc_loadPersistentStoresSo0A16StoreDescriptionCyYaKFTY0 + 392 6 XcodeCloudKit 0x0000000123038b41 $s13XcodeCloudKit11PersistenceO8CoreDataO11CoordinatorV4load33_18A3EDB99D4ACDAD00E5493367C885E4LL9containerySo21NSPersistentContainerC_tFyyYacfU0_TQ1 + 1 7 XcodeCloudKit 0x0000000122a40ca1 $s12XcodeCloudUI5AlertV6ButtonV0aB3KitE12editWorkflow5forId9workspace6windowAESS_xSo8NSWindowCtAF17WorkspaceProviderRzlFZyyYbScMYccfU_yyYacfU_TATQ0 + 1 8 XcodeCloudKit 0x0000000122a85ec1 $sxIeAgHr_xs5Error_pIegHrzo_s8SendableRzlTR10Foundation3URLVSg_Tg5TQ0_ + 1 9 XcodeCloudKit 0x0000000122b4f941 $s13XcodeCloudKit5StoreC17UpdateCoordinatorC11updateTeams33_E402E4AAA8712E61E54F530D6C0BBC6ALL12teamSessionsySayAA11TeamSessionCG_tYaKFyScgyyts5Error_pGzYaKXEfU_yyYaKcfU_TATQ0_ + 1 10 libswift_Concurrency.dylib 0x00007ffd0e1fb441 _ZL23completeTaskWithClosurePN5swift12AsyncContextEPNS_10SwiftErrorE + 1 Thread 0:: Dispatch queue: com.apple.main-thread 0 libswiftCore.dylib 0x7ff819ddd124 swift_conformsToProtocolMaybeInstantiateSuperclasses(swift::TargetMetadataswift::InProcess const*, swift::TargetProtocolDescriptorswift::InProcess const*, bool)::$_1::operator()((anonymous namespace)::ConformanceSection const&) const::'lambda'(swift::TargetProtocolConformanceDescriptorswift::InProcess const&)::operator()(swift::TargetProtocolConformanceDescriptorswift::InProcess const&) const + 4 1 libswiftCore.dylib 0x7ff819ddc1af swift_conformsToProtocolMaybeInstantiateSuperclasses(swift::TargetMetadataswift::InProcess const*, swift::TargetProtocolDescriptorswift::InProcess const*, bool) + 3359 2 libswiftCore.dylib 0x7ff819dda56e swift_conformsToProtocol2 + 78 3 SwiftUICore 0x7ffb12e7da7c 0x7ffb12a27000 + 4549244 4 AttributeGraph 0x7ff919e5934c AGTypeApplyFields2::Visitor::visit_field(AG::swift::metadata const*, AG::swift::field_record const&, unsigned long, unsigned long) + 98 5 AttributeGraph 0x7ff919e51f4e AG::swift::metadata::visit(AG::swift::metadata_visitor&) const + 774
1
0
121
5d
XCode connection to local git server via ssh and certificate broken
The XCode connection to my local git server for pushing does not work. I've added a remote origin to my project pointing to the local git server. Pulling from that server via xcode works. But pushing to this server results in a dialog popping up. this dialog says "The repository rejected the provided credentials" and asks me to select the connection method and the certificate file. When I select the certificate file and press ok then the same error cmes again. Doing the git push via commandline works without a problem.
3
0
95
5d
App is crashing when using "withCheckedContinuation" in Xcode 15 beta 5
We are experiencing an issue with withCheckedContinuation in our Swift project. Our implementation was working perfectly in a previous version of Xcode and continues to work in the simulator. However, it fails to work on a real device. Here’s a brief description of the problem: • Environment: - Xcode Version: Xcode 16.0 Beta 5 - Swift Version: Swift 5 - OS: IOS18 beta 5 • Problem: The code using withCheckedContinuation behaves as expected in the simulator but fails on a physical device. We are receiving a “bad access to memory” error when running on a real device. • What We’ve Tried: 1. Verified that the code works in previous Xcode versions. 2. Tested on different simulators, where it runs without issues. 3. Checked for any obvious errors in memory handling or threading. Code Example: Here’s a simplified version of the problematic code: var body: some View { VStack { Text("Hello, world!") } .padding() .onAppear { Task { await self.checkTrialOrIntroductoryDiscountEligibilityAsync() } } } func checkTrialOrIntroductoryDiscountEligibilityAsync() async { return await withCheckedContinuation { continuation in checkTrialOrIntroDiscountEligibility() { continuation.resume() } } } func checkTrialOrIntroDiscountEligibility(completion: () -> Void) { completion() } }
16
8
1.4k
Aug ’24
Instruments in Xcode 15.3 not showing symbols
When using Instruments in Xcode 15.3 on macOS Sonoma 14.3.1 symbols from system frameworks are not displaying. I've tried creating a template "App" project and running it on the iOS 17.4 simulator without any code changes and still am not seeing symbols so I can be sure it's not unique to my real-world project build settings. If I install Xcode 15.0 and run the same build in the same 17.4 simulator using Instruments 15.0 it shows thread names and symbols for UIKit and other frameworks but is still missing SwiftUI symbols. Instruments 15.3 Instruments 15.0 I've spent 2 days trying to narrow down why I couldn't debug my app and even deleted all my partitions and reinstalled macOS which didn't fix the issue.
6
1
1.8k
Mar ’24
Xcode messages
I posted this as a reply.to a previous post, but got no reply, so here is a new post. I'm using. user defaults in an app with a self defined suite name. I had put aside work on the app for several months, and after returning to work on it, I'm getting xcode messages when testing, several like: "Not updating lastKnownShmemState in CFPrefsPlistSource<0x600000358360> (Domain: mySuiteName, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: Yes): 1169 -> 1181" Can anyone tell me what is wrong or point me to an answer.
2
0
87
5d
Xcode 16.0 (16A242d): xcodebuild fails due "INTERNAL ERROR: Uncaught exception"
Hi!, Did you experienced failure of xcodebuild tool in Xcode 16? I can't build from command line. It fails when I am trying to perform clean, build, test, etc. actions. macOS version: 14.7 (23H124) Xcode 16.0, Build version 16A242d My steps: sudo xcode-select -s /Volumes/Apps/Developer/Xcode/Xcode_15_4_0.app xcodebuild -showBuildSettings -workspace mc.xcworkspace -scheme AllNormalTests_macOS As result showBuildSettings is working as expected when using Xcode 15.4. Command line invocation: /Volumes/Apps/Developer/Xcode/Xcode_15_4_0.app/Contents/Developer/usr/bin/xcodebuild -showBuildSettings -workspace mc.xcworkspace -scheme AllNormalTests_macOS User defaults from command line: IDEPackageSupportUseBuiltinSCM = YES Build settings for action build and target Testability_macOS: ACTION = build AD_HOC_CODE_SIGNING_ALLOWED = YES AGGREGATE_TRACKED_DOMAINS = YES ALLOW_TARGET_PLATFORM_SPECIALIZATION = NO ALTERNATE_GROUP = staff ... Then: sudo xcode-select -s /Volumes/Apps/Developer/Xcode/Xcode_16_0_0.app xcodebuild -showBuildSettings -workspace mc.xcworkspace -scheme AllNormalTests_macOS As result error: Command line invocation: /Volumes/Apps/Developer/Xcode/Xcode_16_0_0.app/Contents/Developer/usr/bin/xcodebuild -showBuildSettings -workspace mc.xcworkspace -scheme AllNormalTests_macOS User defaults from command line: IDEPackageSupportUseBuiltinSCM = YES ** INTERNAL ERROR: Uncaught exception ** Uncaught Exception: -[NSTaggedPointerString unsignedIntegerValue]: unrecognized selector sent to instance 0xbe036b67f7528701 Stack: 0 __exceptionPreprocess (in CoreFoundation) 1 objc_exception_throw (in libobjc.A.dylib) 2 -[NSObject(NSObject) __retain_OA] (in CoreFoundation) 3 ___forwarding___ (in CoreFoundation) 4 _CF_forwarding_prep_0 (in CoreFoundation) 5 -[DVTDeviceManager _startObservingDevice:] (in DVTFoundation) 6 -[DVTDeviceManager _adjustAvailableDevicesForChangeKind:addedObjects:removedObjects:] (in DVTFoundation) 7 __42-[_DVTDeviceLocatorTracker startObserving]_block_invoke (in DVTFoundation) 8 -[DVTObservingBlockToken observeValueForKeyPath:ofObject:change:context:] (in DVTFoundation) 9 NSKeyValueNotifyObserver (in Foundation) 10 NSKeyValueDidChange (in Foundation) 11 NSKeyValueDidChangeWithPerThreadPendingNotifications (in Foundation) 12 __62-[DVTiPhoneSimulatorLocator _startLocatingDevicesInDeviceSet:]_block_invoke_2 (in IDEiOSSupportCore) 13 __DVT_CALLING_CLIENT_BLOCK__ (in DVTFoundation) 14 ___DVTAsyncPerformBlockOnMainRunLoop_block_invoke (in DVTFoundation) 15 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ (in CoreFoundation) 16 __CFRunLoopDoBlocks (in CoreFoundation) 17 __CFRunLoopRun (in CoreFoundation) 18 CFRunLoopRunSpecific (in CoreFoundation) 19 +[DVTKVOConditionValidator waitForCondition:sourceObject:keyPathAffectingConditionBlock:timeout:] (in DVTFoundation) 20 -[Xcode3CommandLineBuildTool _resolveInputOptionsWithTimingSection:] (in Xcode3Core) 21 -[Xcode3CommandLineBuildTool run] (in Xcode3Core) 22 XcodeBuildMain (in libxcodebuildLoader.dylib) 23 -[XcodebuildPreIDEHandler loadXcode3ProjectSupportAndRunXcode3CommandLineBuildToolWithArguments:] (in xcodebuild) 24 -[XcodebuildPreIDEHandler runWithArguments:] (in xcodebuild) 25 main (in xcodebuild) 26 start (in dyld) Abort trap: 6 Simple commands as shown below are working, but not typical build actions. xcodebuild -h xcodebuild -version xcodebuild -showsdks Thank you in advance!
2
0
282
1w
Xcode 15 & 16: macOS app suddenly stops running in simulator
I have been working on Task Management app for macOS (currently using maOS 15.0 on a M1 MacBook Pro) for a while. Nothing fancy, it uses SwiftUI and Core Data. My problem: I make changes to the app, then run it in the simulator and see if everything works as expected. This works fine for maybe three weeks, until at one point it suddenly stops working – I make a minor change, click "Run" in Xcode (this happens in Xcode 15.x and now Xcode 16), the app icon bounces in the dock, but then no window opens. The app is built and I can see in the console that there are the usual notifications, but I cannot use the simulator anymore. I tried cleaning the Build Folder, resetting the Computer, reinstalling Xcode – nothing helps. What occasionally helps is renaming the Bundle Identifier, but now I only got it to run the simulator once more, then it stopped working. The only solution I have is to manually rebuild the whole app under a new name – that is, recreating the Core Data model and all files, which I have done three times. And now it stopped working again. Does anyone know why this could be? I think Xcode 16 gives me a notification I did not get from Xcode 15: "NSBundle file:///System/Library/PrivateFrameworks/MetalTools.framework/ principal class is nil because all fallbacks have failed" I could not find anything on this. Any ideas are greatly appreciated.
2
0
111
5d
Issue with Xcode 16 - Errors When Splitting Code for Widgets
I’m encountering an issue since I started using Xcode 16. I have a widget in my app, and I'm trying to organize the code by splitting it into different files for better structure. However, when I do this, I get an error: error: Unexpected input file: /Users/******/Desktop/TestApp/TestAppWidget/Provider.Swift (in target 'TestAppWidgetExtension' from project 'TestApp') I want to emphasize that if I keep all the code in one file, everything works fine. I've checked the Target Membership, and it's set up correctly. but I don't understand why this is happening only in Xcode 16. Has anyone else experienced a similar issue or has any ideas on why this is occurring? I would appreciate any help!
3
0
162
6d
Xcode 16 build fails randomly with
So this error has randomly appeared to the code that was building previously even with Xcode 16 and since it has appeared it started falling always. Even after cleaning derived data, build folder, re-cloning the app, doing all kinds of voodoos. /Users/kakhi/Library/Developer/Xcode/DerivedData/MyApp-eafqhlqmrdvrhudisvbfymvrnwba/Build/Intermediates.noindex/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/arm64/MyAppabi.json /Users/kakhi/Library/Developer/Xcode/DerivedData/MyApp-eafqhlqmrdvrhudisvbfymvrnwba/Build/Intermediates.noindex/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/arm64/MyApp.abi.json: No such file or directory I've checked the path and there's indeed no .abi.json file but I've never had anything to do with it. Any ideas what I might be missing? Or is this Xcode 16 bug? Also, it was succeeding to build after first appearance on Xcode 16 beta 6 but now it fails to succeed subsequent builds on beta 6 as well :(
0
0
82
5d
Xcode build time frustration
We have a Xcode project consisting of: A mix of Swift and Objective-C code app code ~ 1600 source files. Roughly around 35 {XC}Frameworks. Some of them are binary and some of them are getting built as a dependency to our app, etc. Binary libraries. Most of the frameworks built together with app code are Objective-C or Swift-based, which have their own amount of sources files and framework dependencies. The binary frameworks mostly contain cross-platform C++ code. Our (the poor developers) frustration is that almost all time when we do a insignificant change (or even just tap Cmd-R without any changes) in Swift-file or Objective-C file (.m) and then build again then big sh*t show starts again... For example: Frameworks may get rebuilt even though they are not touched. Tons of app-level files get built again even though no interface changes, etc. was made. Module verifier keeps verifying modules not touched at all, which takes really long time. Xcode 16 didn't seems to improve the situation - on the contrary. Example of an untouched framework that for unknown reason goes trough this every time we build: I know it is hard to come with ideas to solve this for an unknown larger project. But do other people with similar-size projects also experience this or is re-building not an issue for you? Cheers!
4
3
994
2w
"Xcode Build Error: 'Framework not found Reachability' and 'Linker command failed with exit code 1'"
Hello everyone, I'm having trouble building my app in Xcode. When I try to build, I get the following error: "Framework not found Reachability" And also this error: "Linker command failed with exit code 1 (use -v to see invocation)" Does anyone know what might be causing this, or how I can fix it? Any help would be greatly appreciated! Thank you in advance!
0
0
79
5d
Continuous Devicectl Errors: CoreDeviceError 3002, 12010, and 1000 with iOS 18.1/iPadOS18.0
Hello, I’ve been experiencing repeated errors when trying to install my app via flutter run --release on iOS devices using Xcode 16.1 (build 16B5014f) on macOS 15.1. When running the app in debug mode, it sometimes works but takes a long time to install. However, the installation in release mode fails consistently. This issue occurs on both my iPhone and iPad, both running iOS 18.1 and iPadOS 18, respectively. The errors keep rotating between three variations: Error 1: CoreDeviceError 3002 Error executing devicectl: ProcessException: Process exited abnormally with exit code 1: ERROR: Failed to install the app on the device. (com.apple.dt.CoreDeviceError error 3002 (0xBBA)) Connection with the remote side was unexpectedly closed : "XPCErrorDescription" => "Connection interrupted" Error 2: CoreDeviceError 12010 Error executing devicectl: ProcessException: Process exited abnormally with exit code 1: ERROR: The developer disk image could not be unmounted on this device. (com.apple.dt.CoreDeviceError error 12010 (0x2EEA)) Could not read from the device. (com.apple.dt.CoreDeviceError error -402653180 (0xE8000004)) Error 3: CoreDeviceError 1000 Error executing devicectl: ProcessException: Process exited abnormally with exit code 1: ERROR: The specified device was not found. (com.apple.dt.CoreDeviceError error 1000 (0x3E8)) What I've Tried So Far: Reinstalled Xcode, cleaned the build folder, and cleared DerivedData. Tried using both an iPhone and an iPad running iOS 18.1 and iPadOS 18.0. Ensured that Developer Mode is enabled on both devices. Disabled VPNs (Bitdefender) and firewall settings. Manually mounted the developer disk image via Xcode. Restarted the Mac, Xcode, and devices multiple times. Despite these steps, the errors persist, and I’m unable to install the app on either device. I would appreciate any guidance or suggestions on how to resolve this issue. System Information: macOS Version: 15.1 (Build 24B5055e) Xcode Version: 16.1 (Build 16B5014f) Devices: iPhone 14 running iOS 18.1, iPad running iPadOS 18.0 Thank you in advance!
0
0
111
5d
Can't disable "Connect via Network"
I've upgrade my macbook m3 pro to macOS 15, I have 2 iPhones (12 Pro and 16 Pro) - both on iOS 18 and have 3 versions of Xcode installed (15.4, 16.0, 16.1-2 beta) For the past week I'm unable to develop on my physical device and checked all the threads in this forum for a workaround to disable the "Connect via Network". If I'm not connected to VPN on any of my devices, I get the process attached via network after ~20 minutes, but if I try to do it while on VPN it takes forever (not even sure, can't spend 1 hour waiting to be attached or not) What can I do to disable the "Connect via Network" and why is enabled by default and greyed out?
0
2
96
5d
XCode does not recognize my iPhone
I'm trying to run my app on my iPhone and XCode is unable to detect it. Versions (as of time of writing, these are all the latest versions) XCode: 15.0.1 iOS: 17.1.2 macOS: Sonoma 14.1.2 What I've tried Updating all hardware to the latest versions. Restarting all hardware. Clearing cache/derived data. Using different USBC ports/cables. Using the XCode 15.1-Beta 3 (the latest beta) Clearing trusted computers and re-trusting Disabling Multipath Networking (solution for someone else on the dev forums) Creating a brand new xcode project. Disabling all wifi/bluetooth and reconnecting Using different wifi networks Calling mac support (they directed me back here) Scouring forums What happens I start by disconnecting my phone from my computer, clear trusted computers, restart xcode, and start (basically) from a completely blank slate. First I open XCode to my project. Then I connect my iPhone via USBC. I see that XCode says "iPhone not eligible while pairing in progress" (or something like that). I see on my phone that I must trust this computer, I hit trust, I enter my phone's passcode, then that disappears on my phone, and in XCode the message about eligibility disappears. I then click on the device selector to choose between either a simulator or a hardware device and under hardware I only see a message that says "No eligible devices connected to my mac". If I open the "Manage Run Destinations" organizer I see all the simulators there in the simulators tab, but when I go to the Devices tab, I see nothing. Sometimes when I go through this process, I can get a banner to appear up top, but still no device shows up on the left. The banner will show me that it is indeed my iPhone, but it will be missing information like "Serial Number" or "Capacity". Here's a screenshot of what I see. Keep in mind, this banner up top does not always show up when I go through this process. iPhone CAN be detected on my other laptop When I do this exact same thing on my other laptop, everything works just fine. Here are the specs I'm running on that laptop. (using the same cable/wifi network/etc) XCode 15.0.1 macOS: Ventura 13.6.1 iPhone 17.1.2 (I'm using the same iPhone) The only difference here being the macOS version. However, the problem started on my "broken" computer while I was running a previous major macOS version. This problem is actually what prompted my to do a system update to Sonoma. Please for the love of god, halp!!!
13
6
7.6k
Dec ’23
How to prevent duplicate resource bundles from SPM dynamic framework in app extensions?
We use a local swift package in 6 of our app extensions. The product from the local package that we link to each app extension is a dynamic framework. And while the dynamic framework is copied into the final app bundle once, the resource bundles of each target that comprise the dynamic framework is copied into each app extension. I'd much rather have the bundles be copied into the dynamic framework once to prevent app bloat. Here is a visualization of the issue: . └── MyApp.ipa/ ├── MyApp (executable) ├── MyDynamicFramework_TargetA.bundle ├── MyDynamicFramework_TargetB.bundle ├── MyDynamicFramework_TargetC.bundle ├── Frameworks/ │ └── MyDynamicFramework.framework/ │ ├── TargetA │ ├── TargetB │ └── TargetC └── PlugIns/ ├── Widgets.appex/ │ ├── MyDynamicFramework_TargetA.bundle │ ├── MyDynamicFramework_TargetB.bundle │ └── MyDynamicFramework_TargetC.bundle ├── Intents.appex/ │ ├── MyDynamicFramework_TargetA.bundle │ ├── MyDynamicFramework_TargetB.bundle │ └── MyDynamicFramework_TargetC.bundle ├── IntentsUI.appex/ │ ├── MyDynamicFramework_TargetA.bundle │ ├── MyDynamicFramework_TargetB.bundle │ └── MyDynamicFramework_TargetC.bundle ├── NotificationContent.appex/ │ ├── MyDynamicFramework_TargetA.bundle │ ├── MyDynamicFramework_TargetB.bundle │ └── MyDynamicFramework_TargetC.bundle ├── RichPushContent.appex/ │ ├── MyDynamicFramework_TargetA.bundle │ ├── MyDynamicFramework_TargetB.bundle │ └── MyDynamicFramework_TargetC.bundle └── NotificationService.appex/ ├── MyDynamicFramework_TargetA.bundle ├── MyDynamicFramework_TargetB.bundle └── MyDynamicFramework_TargetC.bundle Notice that the resource bundles of Target A, B, and C are copied multiple times causing an unhealthy app size. I'd either like the resource bundles to be copied into MyDynamicFramework or copied once into the app bundle and let the app extensions reference them. Given the SPM + Xcode linking is a black box for the most part, how would I accomplish this?
3
1
789
Mar ’24