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

Xcode Documentation

Post

Replies

Boosts

Views

Activity

Xcode 15 doesn't fix Info.plist management bugs introduced in Xcode 14
Xcode 14 introduced some ridiculous Info.plist management bugs which are not yet fixed in Xcode 15: The bugs are manifested in the General and Info tabs of target management: -The Build value in the General tab is not in sync with the CFBundleVersion value in the Info tab (that is, changing the value in the General tab won't affect the Info tab and vice versa). -The App Category value in the General tab isn't in sync with the LSApplicationCategoryType value in the Info tab. -Additional document type properties in the Info tab cannot be added: clicking "Click here to add..." doesn't do anything. -Document types in Info tab cannot be deleted: once you added a document type instance (even as a test) there's no way to remove it.
3
0
2.3k
Jul ’23
SwiftData Fatal error: failed to find a currently active container
I'm new to Apple development and decided to learn using SwiftData and Xcode 15 beta 4 (though I'm starting to think I don't need that extra challenge). I've worked through many issues--with you all's help--but this is one I can't figure out and hasn't shown up in my searches. I'm working on the traditional task list app (with a Task model). I've tried several approaches to app structure, but each time I eventually hit this same error. It doesn't happen when I set up the new Xcode project, but eventually it does. I've cleaned the build folder, restarted the Simulator, and even rebooted the Macbook I'm working on. Here's what happens when I click Product > Run: the app builds successfully the Simulator displays a white screen as expected then the error appears. Here are the error messages: In the debug area it says: SwiftData/ModelContainer.swift:159: Fatal error: failed to find a currently active container for Task Failed to find any currently loaded container for Task) and in the warning in the editor says Thread 1: Fatal error: failed to find a currently active container for Task The debugger is highlighting this line in the call stack (not sure if that's useful as a newbie): #7 0x0000000100bb6d90 in Task.init(id:title:priority:) at /var/folders/3v/q8g4z9bx4lb9z6t7mhgwgghw0000gn/T/swift-generated-sources/@__swiftmacro_10BadgerTool4Task5ModelfMm_.swift:2 Here's the code: The Task model isn't complex: // Task.swift import Foundation import SwiftData @Model class Task { @Attribute(.unique) var id: UUID var title: String var priority: String init(id: UUID = UUID(), title: String, priority: String = "None") { self.id = id self.title = title self.priority = priority } } I have the model container set in the context of the highest view: // BadgerToolApp.swift import SwiftUI import SwiftData @main struct BadgerToolApp: App { var body: some Scene { WindowGroup { NavView() .modelContainer(for: Task.self) } } } I tried moving all other views one layer down (which is why the unnecessary NavView is there): // NavView.swift import SwiftUI import SwiftData struct NavView: View { @State var selectedCollection: Collection? @State var selectedTask: Task? var body: some View { NavigationSplitView( sidebar: { SideBarView(selectedCollection: $selectedCollection, selectedTask: $selectedTask) }, content: { ContentListView(selectedCollection: $selectedCollection, selectedTask: $selectedTask) }, detail: { TaskDetailView(selectedCollection: $selectedCollection, selectedTask: $selectedTask) } ) } } Trying to isolate my mistake I removed everything else related to SwiftData (except for the imports) and gave my views hard-coded data for the simulator like this: // SideBarView.swift import SwiftUI import SwiftData struct SideBarView: View { @Binding var selectedCollection: Collection? @Binding var selectedTask: Task? let collections = presetCollections //temp data var body: some View { List(collections, id: \.id, selection: $selectedCollection){ collection in NavigationLink(collection.name, value: collection) } List{ Text("All Tasks") Text("Settings") } .navigationTitle("Collections") } } Everything works as expected if I comment out the .modelContainer() modifier on the call to NavView view I change the Task definition from the @Model class to a regular struct like this: // Task.swift // with @Model removed import Foundation struct Task: Hashable { var id: UUID var title: String var priority: String init(id: UUID = UUID(), title: String, priority: String = "None") { self.id = id self.title = title self.priority = priority } } What am I missing? Could it be a bug? Thanks for your help!
12
4
11k
Jul ’23
Warning when archiving product in Xcode with AppIntent extension
When building my app for debugging in Xcode I don't get any warning, only when archiving the product: MyIntent.appex is an ExtensionKit extension and must be embedded in the parent app bundle's Extensions directory, but is embedded in the parent app bundle's ../../../BuildProductsPath/Release/MyApp.app/Contents/Extensions directory. The MyIntent.appex is listed in the main target's Frameworks, Libraries and Embedded Content section and its Build Phase Embed ExtensionKit Extensions with Destination ExtensionKit Extensions. The extension also seems to work, since the app intent is correctly listed in the Shortcuts app. Is this an Xcode bug or do I need to do something different?
2
1
885
Jul ’23
Error reporting test coverage in Xcode 14.3.1
Xcode is throwing an error when attempting to report test coverage after running unit tests. Showing All Messages Failed to merge raw profiles in directory /{my project dir}/DerivedData/{my project name}/Build/ProfileData/A98EC493-3AB4-4B1C-B7FC-BC5D77B23EE3 to destination /{my project dir}/DerivedData/{my project name}/Build/ProfileData/A98EC493-3AB4-4B1C-B7FC-BC5D77B23EE3/Coverage.profdata: Aggregation tool '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/llvm-profdata' failed with exit code 1: warning: /{my project dir}/DerivedData/{my project name}/Build/ProfileData/A98EC493-3AB4-4B1C-B7FC-BC5D77B23EE3/997F01E3-3735-4897-AE00-31EBB0A9E8D3-57885.profraw: invalid instrumentation profile data (file header is corrupt) error: no profile can be merged Anyone else seeing this issue?
12
1
3.6k
Jul ’23
Apple Watch cannot reconnect
None of my existing apps (both in-AppStore and in-development) nor even a brand new WatchOS app can be installed to my Apple Watch. While using Xcode to build and deploy to my Watch, I get this: ”Waiting to reconnect to Apple Watch Xcode will continue when the operation completes.” However, this dialog persists and never completes. I’m running all of the latest: MacOS 14 beta 4, Xcode 15 beta 5, Watch OS 10 beta 4, iOS 17 beta 4. I’ve tried resetting my Watch (with “Erase All” option) and restarting the Mac, the phone and the watch. Any help?
38
15
15k
Jul ’23
Third-party SDK's privacy report are not shown when 'Generate Privacy Report' button tapped.
In Xcode 15, when performing an Archive build and clicking the 'Generate Privacy Report' button, it is believed that the app creates a PrivacyReport PDF file by inspecting the PrivacyInfo.xcprivacy file used by the Third-party SDKs within the app. However, upon testing, it appears that only the PrivacyInfo.xcprivacy file from the app itself is included in the generated PDF, and the PrivacyInfo.xcprivacy file from Third-party SDKs is not being included. For example, I placed the PrivacyInfo.xcprivacy file inside the 'MyFramework' project and created an xcframework with it. Then, I added MyFramework.xcframework into the TestApp and clicked the 'Generate Privacy Report' button after an Archive build, I encountered an error saying, 'The archive does not contain any PrivacyInfo.xcprivacy files.' (Of course, the added xcframework is already included in the TestApp target.) If you know the solution, please help me out.
8
5
7.0k
Aug ’23
Xcode 15 beta 5 – iOS 17 Simulator runtime not available
I downloaded Xcode 15 beta 5 and I'm trying to work on my app, but it's having a problem with the simulator. It can't find the runtime I guess. This is the first time I've ran into this. When I try to run, this is what I get: The com.apple.CoreSimulator.SimRuntime.iOS-17-0 simulator runtime is not available. runtime profile not found using "System" match policy Download the com.apple.CoreSimulator.SimRuntime.iOS-17-0 simulator runtime from the Xcode Settings. Not sure what to do here. I also installed the latest iOS 17 developer beta on my device and Xcode doesn't work with that either. I can't help but think the development team forgot something here.
13
9
14k
Aug ’23
GenerateAssetSymbols wrongly renaming image assets
Xcode generates symbols for image and color assets now (which is super nice!). We noticed an issue when generating code symbols for our image assets. We have an image named inputContour and one named inputContourColor. Xcode was not able to generate a symbol for inputContourColor and instead produced the following warning: #warning("The \"inputContourColor\" image asset name resolves to the symbol \"inputContour\" which already exists. Try renaming the asset.") It turns out that the generator automatically removes the color suffix when creating the code symbol. For color assets, this probably make sense (so tealColor would become just teal), but this should not be applied to image resources.
10
1
4.6k
Aug ’23
Wrong fonts loaded from Storyboards in Xcode 15
We use Storyboards and custom fonts in our app. Once we started developing new features for iOS 17 and did the first build in Xcode 15, we've noticed that in quite a few places incorrect fonts are set to views. In some places it is incorrect weight, while in other it's completely different font. Some observations: Fonts may change the next time app is build. E.g., instead of SF Pro Display Semibold we got SF Pro Display Heavy, and then after few relaunches it switched to Nunito Bold 😵‍💫 We’ve ensured that correct font is set in Storyboard, and even tried to re-assign it. That didn’t help. All custom fonts are properly added to a target and are registered in info.plist All custom fonts are listed in UIFont.familyNames, so they are indeed registered with the system. Wrong fonts are loaded on both development environment and in TestFlight builds We’ve never experienced anything similar before Xcode 15 What we've tried: Re-assigning fonts in Storyboard. Creating new Storyboard in Xcode 15 and copying screens into it. I wonder if anybody else having similar issues and maybe knows the workaround. Thank you. P.S. I've filed a Feedback to Apple: FB12903371
29
22
10k
Aug ’23
iOS 17.0 beta 5 (21A5303d) simulator fails to install
=> Cannot copy the image because the disk is almost full The disk of my Mac is not full. Or is it another logical disk? Every time I try to install the iOS 17.0 simulator (21A5303d) it creates a copy of itself and fails. It is filling my HD and I do not know how to delete those files. And it differs by the last letter. Different versions? Registering simulator runtime with CoreSimulator failed. Domain: DVTDownloadableErrorDomain Code: 29 User Info: { DVTErrorCreationDateKey = "2023-08-09 20:41:08 +0000"; } Cannot copy the image because the disk is almost full Domain: com.apple.CoreSimulator.simdiskimaged.SimDiskImageError Code: 14 --** System Information macOS Version 14.0 (Build 23A5312d) Xcode 15.0 (22004) (Build 15A5219j) Timestamp: 2023-08-09T17:41:08-03:00
14
5
11k
Aug ’23
SwiftData error: NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release
I am using SwiftData for my model. Until Xcode 15 beta 4 I did not have issues. Since beta 5 I am receiving the following red warning multiple times: 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release This seems to be a CoreData warning. However, I am not using CoreData directly. I have no way to change the config of CoreData as used by SwiftData. My model just uses UUID, Int, String, Double, some of them as optionals or Arrays. I only use one attribute (.unique).
5
2
2.2k
Aug ’23
Xcode 15 Beta 6:Background Fetch debug was not work properly
Background Fetch debug was work properly in xcode 14。But was not work properly in Xcode 15 Beta 6. I have done these steps: -[x] Use Xcode - Debug - Simulate Background Fetch, performFetchWithCompletionHandler didnot receive the system callback. -[x] Use Xcode-Scheme-Edit Scheme-Run-Launch due to background fetch event。the feature is enable。but launch isn't background launch。and didnot receive the system callback。 Is it a bug in Xcode 15 Beta。 Could anyone give me some advices? Thank you
3
1
735
Aug ’23
Xcode Canvas Simulator cause multiple diagnosticd processes to run and 100% CPU
The Xcode Canvas Simulator (for Xcode 14 and even 15 ..beta 6) cause multiple springboard and diagnosticd processes to run at nearly 100% CPU , cause the MacBook M1 to heat. This happens every time. This is usually triggered after the Canvas show an error which live previewing the code as I edit it. I have tried clearing the derived data but it doesn't seem to help. This happens with all projects. I am unable to use live previews because of this issue. The are often other processes with the string Poster in them. Like PhotosPosterProvider , CollectionsPoster , ExtragalacticPoster running high on usage at the same time.
28
20
6.1k
Aug ’23
DeviceActivityReport based views are blank on iOS 16 whith apps built with Xcode 15 beta
Hi ! We are super exited to switch to Xcode 15 when it will be released, but we have a major issue : Apps built with Xcode 15 beta fail to show DeviceActivityReport base view on iOS 16. The following message shows in the console : ] [default] LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler} 2023-07-31 14:54:12.568332+0200 Opal[57940:4651501] [default] Attempt to map database failed: permission was denied. This attempt will not be retried. 2023-07-31 14:54:12.568420+0200 Opal[57940:4651501] [db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=66, _LSFunction=_LSServer_GetServerStoreForConnectionWithCompletionHandler} We Opened a bug report at the end of june but got no answer from Apple (FB12416769). It's 100% reproductible with a very simple sample project If you guys could report the issue as well, it would be nice !
8
4
2.3k
Aug ’23
Xcode 15 beta 8 | iOS 17 simulator RAM consumption significantly grows with each test run
When using Xcode 15 beta 8 / iOS 17 beta 8 simulator runtime, we can see in Activity Monitor that memory used by "SimRenderServer" proccess grows significantly with each UI test run. It reproduces even on an empty test, that just wait for a second without launching the application. Memory usage doesn't go down when test run finishes, so each consecutive run adds more to it. For example, create an new project with a UI test // The contents of the test don't actually matter func testExample() async throws { try await Task.sleep(for: .seconds(1)) } Run this test repeatedly 100+ times and observe the "SimRenderServer" process in the Activity Monitor. From what we observed it only reproduces when "Preferred Capture Format" in the test plan configuration is set to "Video". Setting it back to "Screenshot" does no result in growing memory usage. This was reproducible on macOS Sonoma beta / macOS Ventura 13.5.1. Feedback was submitted FB13098749.
3
8
1.9k
Sep ’23
AR 3D object tracking using LIDAR.
Hi there, i have recently started development in swift Ui. I wanted to ask whether it is possible to design an AR app which generates and tracks a 3d model or .scn based on a real world 3d model if .usdz format is used. for example i want to generate and track the movement of an aeroplane in AR and i have .scn file but i want a real world object as an anchor like a pen or pencil and i want to use its 3d data in .usdz format. i know you can use ARobjects abnd object tracking but it uses .arobject format and doesnot use LiDAR. important thing is that i want to use Lidar tracking not point cloud. is it possible? point me in right direction Thank you. I am using xcode 15 & ios 17 beta
1
1
735
Sep ’23