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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

MapKit not working in Swift Playgrounds
This is the complete Playground code: import MapKit import SwiftUI import PlaygroundSupport struct AddressSearchView: View { @State private var region = MKCoordinateRegion( center: CLLocationCoordinate2D(latitude: 37.7749, longitude: -122.4194), span: MKCoordinateSpan(latitudeDelta: 0.01, longitudeDelta: 0.01) ) var body: some View { VStack { Map(position: .constant(MapCameraPosition.region(region))) { } .frame(height: 300) } } } struct AddressSearchView_Previews: PreviewProvider { static var previews: some View { AddressSearchView() } } PlaygroundPage.current.setLiveView(AddressSearchView()) When I try to run this I get this in the debug console: error: Couldn't look up symbols: protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI Hint: The expression tried to call a function that is not present in the target, perhaps because it was optimized out by the compiler. the preview never shows up. If I use other SwiftUI components and not the map it works fine. What is happening? Playground target is Swift 6 macOS (iOS does the same). Xcode 16.2
0
0
301
Mar ’25
This bundle is invalid - Your archive contains paths that are not allowed: [._Symbols]
Hello, I recently updated my app, and in the Transporter app it said that the processing failed. This is the email I recieved: Please correct the following issues and upload a new binary to App Store Connect. ITMS-90048: This bundle is invalid - Your archive contains paths that are not allowed: [._Symbols] I couldn't find anything related to this in XCode or anywhere else on the internet. What did I do wrong? For context, I am developing using Expo and React Native.
3
2
503
Mar ’25
Can I use ARGeoAnchor with simulated locations
I'm trying to evaluate if we can support AR navigation with MapKit. The feature is supposed to be available for users in US. I tried to run the sample on my iPhone: https://developer.apple.com/documentation/arkit/tracking-geographic-locations-in-ar?language=objc But I'm in a location that ARGeoTrackingConfiguration.checkAvailabilityWithCompletionHandler: always return false. I think ARGeoAnchor isn't supported in my location. I tried to use simulated locations by Adding a gpx file when launching the app. Enabling Xcode -> Debug -> Simulate Location -> New York, NY, US But the availability for ARGeoAnchor is still false. Is that possible for me to develop the ARGeoAnchor feature outside of the covered areas?
0
0
114
Mar ’25
Trouble Seeing print debug statements
I am working on an XCode project and I have some Swift functions within a helper functions file. This file has some functions declared that create 3 global variables. These global variables are then used in various views throughout the app. In the functions, there are print statements for when it catches an error. However, when I run the app and I get an error that stems from this file, there are no print statements. How can I have this print statements show up in the debug console?
1
0
461
Mar ’25
XCode 16 run Fastlane fail when called get_version_number function after convert project from groups to folders
My project is using Fastlane 2.226.0. After converted groups to folders on XCode 16, I got an error when executed below function in Fastfile: get_version_number(xcodeproj: "MyProject.xcodeproj", target: "MyProject") Below is the error message output after I ran fastlane: Unable to find XCode build setting: MARKETING_VERSION
0
0
110
Mar ’25
Xcode crash reports from TestFlight
My application is in flightTest mode. I received my first two crash reports in XCODE /Organizer. The context is well described, and I was able to isolate the locations where very serious errors occurred. My application is connected. I'm missing one piece of data in this crash report: the time of the crash. This will help me see what (in my case) static data was being read on the data server at that time. This will help me investigate. Is it possible to obtain this information?
0
0
95
Mar ’25
CloudKit - Friend request / connection
I implemented the cloudkit function, where users can connect with each other. The problem is, that if User A is doing a friend request and User B is accepting the request. The friend entry is correct visible for User B but not for User A. I can see in cloud kit that after the accepted request, the friend connection is set up correctly, also with the correct userID, but it not showing up for User A (the one that send the request) It's in the public database. In this view you sign in using Apple Sign-In and create a specific user ID. Then you can access a global leaderboard to compare with all signed-in users. Additionaly, there’s a friend tab where you can search for and type in a specific user ID. The target user sees the friend request, can accept it, and then the accepted friend appears in their friend list. However, the original requester doesn’t see the connection after acceptance even though CloudKit shows the records Add comment. I've also tried to add a placeholder in for User A, that e.g he send the request and then has a placeholder where it says e.g pending request to User B. After User B accepted the request, the placeholder will go away and no friend connection is displayed, very strange.
1
0
243
Mar ’25
Xcode cannot authenticate my account
I have been using Xcode 16.2 for a long time. I downloaded it from the developer site. I recently downloaded Xcode 16.3. I was offline on an airplane and I got an error authenticating my account. Since then, I have not been able to sign my apps. I was able to create a new app that worked but in my effort to resolve the problem, I deleted my account and now I cannot add it back. I was getting a "bad URL" error. Now I'm getting "Could not connect to the server." I sent an email to Apple Dev Support and they told me to download Xcode from the App Store. I did that and it gave me the same error. Is anyone else having this problem? If Apple Dev Support cannot resolve it, I don't know how I am going to.
1
0
78
Mar ’25
Issue using RealmSwift in a framework versus using it in an app
If I install RealmSwift into an ios app using SPM, I have no problems. However if I install it into an ios framework, then when building there is this error: error: missing required modules: 'Realm.Private', 'Realm', 'Realm.Swift' I have discovered that if I change the import statement from: import RealmSwift to private import RealmSwift then doing that makes this build error goes away (but doing that isn't a feasible workaround as I would like to publicly export classes stored in Realm from the framework). There's no point in posting issues with Realm on their support board as its being deprecated and its tumble weeds on their forum. But I would be very interested in hearing from the Apple expects explanation or speculation on: why is importing the same framework via SPM into a framework xcode project resulting in different behavior then when importing it into an app? why would changing import to private import make the build error go away? TIA
0
0
100
Mar ’25
Tone mapping SDR content for HDR composition
If you have two video segments, one HDR and one SDR, next to one another in a composition, the SDR one appears dark, since its max luminance will be lower than the max luminance of the HDR clip. iMovie handles this well by (reverse) tone mapping the SDR content to make it look HDR in an HDR composition. This is what I want to achieve. I've looked into algorithms to do this, and the best that I can find is the conversion from RGB to YCbCr described in Table 4 of BT.2020, followed by conversion method A (Section 4.2, table 4) of BT.2446-1. I have these implemented in a Core Image kernel, available at this repo. The issue that I'm seeing is that the colors are still much too hot, and while there are frames that appear close to properly tone mapped, it doesn't come close to the accuracy of iMovie's approach. If someone is an expert in colorimetry, etc., I'd really appreciate a breakdown of what I'm doing wrong here. To be specific: Assuming non-constant luminance for the YCbCr conversion Using a Metal Core Image kernel for the actual tone mapping The video composition uses Core Image filters directly The video composition is using BT.2020 colorimetry and the PQ transfer function. Below is a comparison of two screenshots, one using an unaltered HDR asset, and the other using the same asset transcoded to SDR with QuickTime, and reverse tone mapped to HDR for playback. Is there something I'm missing?
3
1
633
Mar ’25
help interpreting crash report (testflight)
I just received this crash report of my Application. It has zero symbol of my App (other crash reports have), so it is very difficult to understand and what meens this mention of: UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore: > Date/Time: 2025-03-19 21:39:54.5577 +0100 Launch Time: 2025-03-19 21:31:29.5543 +0100 OS Version: iPhone OS 18.3.2 (22D82) Release Type: User Baseband Version: 1.40.03 Report Version: 104 Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x00001c7d7b153b10 Exception Codes: 0x0000000000000001, 0x00001c7d7b153b10 VM Region Info: 0x1c7d7b153b10 is not in any region. Bytes after previous region: 30844223027985 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL owned unmapped memory unmapped-unmapped [ 2064K] rw-/rw- SM=PRV owned physical footprint (unmapped) ---> UNUSED SPACE AT END Termination Reason: SIGNAL 11 Segmentation fault: 11 Terminating Process: exc handler [1844] Triggered by Thread: 0 Thread 0 name: Thread 0 Crashed: 0 libobjc.A.dylib 0x0000000181a77c20 objc_msgSend + 32 (:-1) 1 UIKitCore 0x0000000187e7c4c8 -[UIApplication _terminateWithStatus:] + 136 (UIApplication.m:7539) 2 UIKitCore 0x0000000186ed5644 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 112 (_UISceneLifecycleMultiplexer.m:819) 3 UIKitCore 0x0000000187626e8c -[_UISceneLifecycleMultiplexer forceExitWithTransitionContext:scene:] + 164 (_UISceneLifecycleMultiplexer.m:482) 4 UIKitCore 0x0000000187e77c28 -[UIApplication workspaceShouldExit:withTransitionContext:] + 164 (UIApplication.m:4238) 5 FrontBoardServices 0x000000019e08fcd4 __63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke_2 + 72 (FBSWorkspaceScenesClient.m:632) 6 FrontBoardServices 0x000000019e0584c8 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 168 (FBSWorkspace.m:445) 7 FrontBoardServices 0x000000019e08fc74 __63-[FBSWorkspaceScenesClient willTerminateWithTransitionContext:]_block_invoke + 128 (FBSWorkspaceScenesClient.m:629) 8 libdispatch.dylib 0x000000018c2befa8 _dispatch_client_callout + 20 (object.m:576) 9 libdispatch.dylib 0x000000018c2c29f0 _dispatch_block_invoke_direct + 284 (queue.c:515) 10 FrontBoardServices 0x000000019e051378 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 52 (FBSSerialQueue.m:285) 11 FrontBoardServices 0x000000019e0512f8 -[FBSMainRunLoopSerialQueue _targetQueue_performNextIfPossible] + 240 (FBSSerialQueue.m:309) 12 FrontBoardServices 0x000000019e0511d0 -[FBSMainRunLoopSerialQueue _performNextFromRunLoopSource] + 28 (FBSSerialQueue.m:322) 13 CoreFoundation 0x0000000184570f4c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1970) 14 CoreFoundation 0x0000000184570ee0 __CFRunLoopDoSource0 + 176 (CFRunLoop.c:2014) 15 CoreFoundation 0x0000000184573b40 __CFRunLoopDoSources0 + 244 (CFRunLoop.c:2051) 16 CoreFoundation 0x0000000184572d3c __CFRunLoopRun + 840 (CFRunLoop.c:2969) 17 CoreFoundation 0x00000001845c5284 CFRunLoopRunSpecific + 588 (CFRunLoop.c:3434) 18 GraphicsServices 0x00000001d18354c0 GSEventRunModal + 164 (GSEvent.c:2196) 19 UIKitCore 0x000000018710e674 -[UIApplication _run] + 816 (UIApplication.m:3846) 20 UIKitCore 0x0000000186d34e88 UIApplicationMain + 340 (UIApplication.m:5503) 21 UIKitCore 0x000000018747115c UIApplicationMain(_:_:_:_:) + 104 (UIKit.swift:565) 22 maPollution 0x000000010405c240 specialized static UIApplicationDelegate.main() + 28 (/<compiler-generated>:20) 23 maPollution 0x000000010405c240 static AppDelegate.$main() + 28 (AppDelegate.swift:0) 24 maPollution 0x000000010405c240 main + 116 25 dyld 0x00000001aa821de8 start + 2724 (dyldMain.cpp:1338) Thread 1 name:
1
0
65
Mar ’25
SwiftUI Preview Runtime linking failure
Swift Package: I have an old objc library, that is added as XCFramework to swift package as a binary target. targets: [ .target( name: "CoreServices", dependencies: ["OldContainer"], path: "CoreServices" ), .binaryTarget( name: "OldContainer", path: "Frameworks/OldContainer.xcframework" ), ] This serves the purpose, it builds fine and able to run on simulator. However this framework is breaking the Xcode previews. Error: == PREVIEW UPDATE ERROR: [Remote] JITError: Runtime linking failure Additional Link Time Errors: Symbols not found: [ _OBJC_CLASS_$_SCSecureServicesFactory ] ================================== | [Remote] LLVMError | | LLVMError: LLVMError(description: "Failed to materialize symbols: { (static-Login, { __replacement_tag$1015 }) }") == VERSION INFO: Tools: 16C5032a OS: 23G93 PID: 38675 Model: MacBook Pro Arch: arm64e == ENVIRONMENT: openFiles = [ /Users/../Documents/GitHub/Packages/Login/Sources/Login/LoginView.swift ] wantsNewBuildSystem = true newBuildSystemAvailable = true activeScheme = Launch activeRunDestination = iPhone 16 Pro Max variant iphonesimulator arm64 workspaceArena = [x] buildArena = [x] buildableEntries = [ Login Login ] runMode = JIT Executor == SELECTED RUN DESTINATION: Simulator - iOS 18.2 | iphonesimulator | arm64 | iPhone 16 Pro Max | no proxy == EXECUTION MODE OVERRIDES: Workspace JIT mode user setting: true Falling back to Dynamic Replacement: false Based on the error, SCSecureServicesFactory is an objc file inside the XCFramework. Since this is a binary target, I could not add a swift setting module map flag to the XCFramework. Is there any workaround to get the previews working ? Or Am I blocked until the library is converted into swift ?
4
0
689
Mar ’25
Uncategorized (Xcode): Command ClangStatCache failed with a nonzero exit code
I'm encountering an issue while trying to build my iOS app in Xcode for the simulator. Issue: Xcode Version: 15.x macOS Version: 14.x (Sonoma) Simulator: iPhone 16 Pro Error Message: Command ClangStatCache failed with a nonzero exit code Steps Taken: Cleaned build folder (Shift + Cmd + K) Deleted DerivedData (rm -rf ~/Library/Developer/Xcode/DerivedData) Updated Xcode and checked iOS SDK updates Disabled Clang Static Analyzer Cache None of these steps resolved the issue. Any help would be appreciated! Thanks in advance.
0
0
263
Mar ’25
NSE Filtering Entitlement Rejected Repeatedly – Seeking Advice & Possible Solutions
Hi everyone, I’m facing a major roadblock with my family location tracking app, and I need some advice or guidance from the community. Background Back in 2021, I implemented NSE filtering entitlement to send location-based notifications and retrieve the device's location in return (as suggested by Apple’s technical code support). Over time, I built my app around this entitlement, adding many features that depend on it. When Location Push Service Extension was introduced for iOS 15+, I adapted accordingly: NSE filtering was used for devices below iOS 15 Location Push Service Extension was used for iOS 15+ NSE filtering also played a crucial role in: ✅ Accepting/rejecting location-based notifications ✅ Checking device settings & location permissions (since location push won’t work without proper permissions) The Issue In November 2024, I created a new developer account to change my business entity. Since then, I’ve been requesting the NSE entitlement repeatedly for four months, but Apple keeps rejecting it. Meanwhile, they approved the Location Push Entitlement, but without NSE filtering, I’m forced to rewrite a huge part of my app’s core functionality. I’ve sent multiple emails explaining my use case, but I keep getting rejected without any clear explanation or workaround. My Ask Has anyone faced a similar issue with NSE entitlement? Are there any alternative approaches to achieve the same functionality? Any advice on how to escalate this to Apple or get proper feedback on why it's being rejected? I’ve invested years into this app, and a forced rewrite would take months. Any help, insights, or contacts who could assist would be greatly appreciated! Thanks in advance! 🙏
0
0
63
Mar ’25
Help! Golang os.Executable() panic on Xcode16 for iOS app
I have a iOS app using a gobind xcframework library. All went well when using Xcode 15.0 (15A240d), but failed on Xcode 16.2 (16C5032a). It’s confirmed the failure is from only Xcode version difference, all others like source code, lib binary, physical test iPhone all keeping the exact same. After digging, the root comes from golang os.Executable() call (https://pkg.go.dev/os#Executable), which is used in xcframework library. Using Xcode 15.0, os.Executable() returns “/var/containers/Bundle/Application/E80602C7-EFFB-4F1B-9FF8-FBA0E7E3DA76/Runner.app/Runner” as normal. But with Xcode 16.2, os.Executable() panic with err “cannot find executable path”. I’ve checked Xcode&SDK version change history, couldn’t find any clue like relevant permissions restrictions stuff. Could someone please share a hint? Thanks .
2
0
300
Mar ’25
XCode suddenly spending minutes running CLangStatCache
I've been using XCode for development in C++ for several years. Suddenly, today it started having the following problem: Any time I try to compile my code, (even if I just finished successfully compiling it), it spends several minutes running CLangStatCache. This is according to the result of "Perform Action... Build with Timing Summary". Furthermore, if I first delete the ".../DerivedData/SDKStatCaches.noindex" folder, the problem goes away and it compiles immediately. However, it creates a new folder with a 32 Mb file in it, and then has the same problem the next time unless I delete that folder again. I do not want to have to delete this file every time I compile my code. Is there some way to turn this off? What happened that is different today from any other day in the last several years? I did just download and install the latest System software update, including XCode... Did that break something?
1
0
86
Mar ’25
Is Image rendering allowed inside ActivityReportExtension
Versions XCode version: 16.2 iOS version: 17.0 Background I am trying to generate a QR code inside the ActivityReportExtention which encoded the FamilyActivitySelection information. The code is roughly: Question Can I create Image inside the ActivityReportExtension? I cannot even render a simple image (not QR code) inside the extension. How can I debug inside the extension? Logs of the extension are not shown in the console. Code A function to generate QR Code import CoreImage import UIKit func generateQRCode(from string: String) -> UIImage? { let data = string.data(using: .ascii) guard let filter = CIFilter(name: "CIQRCodeGenerator") else { return nil } filter.setValue(data, forKey: "inputMessage") filter.setValue("Q", forKey: "inputCorrectionLevel") // Q for medium quality guard let outputImage = filter.outputImage else { return nil } // Scale the QR code image so it looks clear on screen let transform = CGAffineTransform(scaleX: 10, y: 10) let scaledImage = outputImage.transformed(by: transform) // Create a CIContext and generate a CGImage from the CIImage let context = CIContext() if let cgImage = context.createCGImage(scaledImage, from: scaledImage.extent) { return UIImage(cgImage: cgImage) } else { return nil } } Inside ActivityReportExtension sandbox: struct LineChartView: View { var body: some View { VStack { if let qrImage = generateQRCode2(from: "this is a test") { Image(uiImage: qrImage) .resizable() .scaledToFit() .frame(width: 200, height: 200) } else { Text("QR Code generation failed") } } } }
4
0
265
Mar ’25