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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

Classic Linker error after renaming project
We are renaming the project and a Static Library the is critical to the operation on the app is not found during compiling. We have the same project working fine. We have reviewed the project.pbxproj file and searched for erroneous linking, reviewed the Target settings and there is nothing obviously wrong. (Copied and secured the original) Typically workflow is: Clean Delete Derived Data dir D/l Swift Packages Build/Run The team has many years using Xcode / Swift and the project and this is not clear how to resolve. We have scoured SO and the solutions do not apply. Facts: -No cocoapods -Search Paths all set Linker all set Thoughts?
0
0
140
Mar ’25
App Not Appearing in "Available Apps" List in Watch App
I’ve developed an Apple Watch extension for an existing iOS app. When I run the app on the watch via Xcode using the simulator, everything works fine. However, when I try to install it on my iPhone, the Watch app doesn’t show it in the "Available Apps" list, so I can't install it on the watch. The Apple Watch is connected to my iPhone, and I can see other apps available for installation without any issues. I also created a brand new project with watchOS support to troubleshoot, but the same problem occurred. Any ideas on how to resolve this?
2
0
574
Nov ’25
Upload Symbols Failed
Hi there - when attempting to upload the latest build of my macOS app to App Store Connect via Xcode's Organizer I'm now greeted with this warning. I don't even know what it's attempting to tell me.. Yes, I understand what dSYMs are for - but the UUIDs don't appear anywhere in my workspace (full text search on the folder), in the build log, or the ..thing.. the 'Export' button generates. Any help much appreciated, ATM I don't even know where to start. Cheers, Jay
1
0
307
Mar ’25
Xcode playground export is doesn't work
I am having issues with exported playgrounds from Xcode, when I try to open my exported swift fill I get the following message: "Couldn't load settings from contents.xcplayground" Xcode Version: Version 16.2 (16C5032a) Steps to reproduce Create new playground in Xcode. File->Export Open exported file. The issue still press persist after reinstalling Xcode.
0
0
214
Jan ’25
XIB file is showing an old version
I am trying to update my AboutView.xib file (https://git.callpipe.com/AccelerateNetworks/an-mobile-ios/-/blob/main/Classes/Base.lproj/AboutView.xib) through the xcode interface builder, and the changes that I make are correctly reflected in the wysiwyg, as well as in the file itself. However, I whenever the app is built and installed, it shows an older version of the about page. Things I have tried to resolve this are (not listed in order): Product > Clean Build Folder Uninstall and reinstall the app Restart the phone Restart xcode Restart the computer Test a build created through xcode cloud rm -rv ~/Library/Developer/Xcode/DerivedData rm -rf ~/Library/Caches/com.apple.dt.Xcode rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache" Changing something in the xib file (hoping it will recognize a change) The only time the about page has shown something different is when I deleted the xib entirely. The project still built and deployed to the test device, but the about page was completely blank. This tells me I am working with the correct file, and when I look at the xml contents of the file, I can't find any of the old strings that are showing up. What the editor shows: What the app shows:
2
0
332
Jan ’25
Rare EXC_BAD_ACCESS (SIGBUS) KERN_PROTECTION_FAILURE crash when running function?
The following function could run several hundred times with no problem but will occasionally cause a EXC_BAD_ACCESS (SIGBUS). The last time it was a KERN_PROTECTION_FAILURE perhaps meaning it is trying to write to a read only memory but previously it was KERN_INVALID_ADDRESS. I have tried debugging tools to no avail. Can anyone see any reason why the following function could be causing this. Just in case the function is a red herring the only other thing that was running is a AVQueuePlayer that contains 11 tracks, but the crash happens mid song making it unlikely. The function includes running other functions so below is all related functions that happen as a result of a swipe gesture. func completeLeft() { let add1 = Int(tiles[Square - (squares2move + 2)].name ?? "0") ?? 0 let add2 = Int(currentNode.name ?? "0") ?? 0 let add = add1 + add2 if add.isMultiple(of: 9) == false { if squares2move == 0 { self.moveinprogress = 0 return } moveLeft1() } if add.isMultiple(of: 9) { squares2move += 1 moveLeft2() } func moveLeft1() { var duration = TimeInterval(0.1) duration = Double(squares2move) * duration self.soundEffect = "swipe" self.playEffects(Volume: self.effectsVolume) let move = SKAction.move(to: positions[Square - (squares2move + 1)], duration: duration) currentNode.run(move, completion: { self.tiles[Square - (squares2move + 1)].name = self.currentNode.name self.tiles[Square - 1].name = "" self.currentNode.position = self.positions[Square - (squares2move + 1)] self.newNumber() }) } func moveLeft2() { var duration = TimeInterval(0.1) duration = Double(squares2move) * duration self.soundEffect = "swipe" self.playEffects(Volume: self.effectsVolume) let move = SKAction.move(to: positions[Square - (squares2move + 1)], duration: duration) currentNode.zPosition = currentNode.zPosition - 1 currentNode.run(move, completion: { self.currentNode.position = self.positions[Square - (squares2move + 1)] self.tiles[Square - 1].name = "" self.currentNode.name = "\(add)" self.tiles[Square - (squares2move + 1)].name = "\(add)" if add > self.score { self.score = add } if add > self.currentgoal { self.levelComplete()} else { self.playEffects2(soundEffect: "Tink", Volume: self.effectsVolume, Type: "caf")} if self.currentNode.childNode(withName: "Label") == nil { self.currentNode.texture = SKTexture(imageNamed: "0.png") let Label = SKLabelNode(fontNamed: "CHALKBOARDSE-BOLD") Label.text = "\(add)" Label.name = "Label" let numberofdigits = Label.text!.count if numberofdigits == 1 { Label.fontSize = 45 * self.hR} if numberofdigits == 2 { Label.fontSize = 40 * self.hR} if numberofdigits == 3 { Label.fontSize = 32 * self.hR} if numberofdigits == 4 { Label.fontSize = 25 * self.hR} Label.horizontalAlignmentMode = .center Label.verticalAlignmentMode = .center Label.fontColor = .systemBlue Label.zPosition = 2 self.currentNode.addChild(Label) self.currentNode.zPosition = self.currentNode.zPosition + 1 var nodes = self.nodes(at: self.positions[Square - (squares2move + 1)]) nodes = nodes.filter { $0.name != "Tile" } nodes = nodes.filter { $0 != self.currentNode } nodes = nodes.filter { $0 != self.currentNode.childNode(withName: "Label") } for v in nodes { v.removeFromParent()} } else { let Lbl = self.currentNode.childNode(withName: "Label") as? SKLabelNode Lbl!.text = "\(add)" let numberofdigits = Lbl!.text!.count if numberofdigits == 1 { Lbl!.fontSize = 45 * self.hR} if numberofdigits == 2 { Lbl!.fontSize = 40 * self.hR} if numberofdigits == 3 { Lbl!.fontSize = 32 * self.hR} if numberofdigits == 4 { Lbl!.fontSize = 25 * self.hR} self.currentNode.zPosition = self.currentNode.zPosition + 1 var nodes = self.nodes(at: self.positions[Square - (squares2move + 1)]) nodes = nodes.filter { $0.name != "Tile" } nodes = nodes.filter { $0 != self.currentNode } nodes = nodes.filter { $0 != self.currentNode.childNode(withName: "Label") } for v in nodes { v.removeFromParent()} } self.moveinprogress = 0 }) } } func moveLeft() { var duration = TimeInterval(0.1) duration = Double(squares2move) * duration self.soundEffect = "swipe" self.playEffects(Volume: self.effectsVolume) let move = SKAction.move(to: positions[Square - (squares2move + 1)], duration: duration) currentNode.run(move, completion: { self.tiles[Square - (squares2move + 1)].name = self.currentNode.name self.tiles[Square - 1].name = "" self.currentNode.position = self.positions[Square - (squares2move + 1)] self.newNumber() }) }
0
0
211
Mar ’25
testSession.setSimulatedError(.purchase(.invalidQuantity), forAPI: .purchase)
I am trying to test this simulated Error. The issue is, I can't get this to trigger through the simulatedError function. Error will always end up as an unknown error Example code snippet: @available(iOS 17.0, *) func testPurchase_InvalidQuantity() async throws { // Arrange testSession.clearTransactions() testSession.resetToDefaultState() let productID = "consumable_1" try await testSession.setSimulatedError(.purchase(.invalidQuantity), forAPI: .purchase) guard let product = await fetchProduct(identifier: productID) else { XCTFail("Failed to fetch test product") return } let option = Product.PurchaseOption.quantity(4) let result = await manager.purchase(product: product, options: option) switch result { case .success: XCTFail("Expected failure due to invalid quantity") case .failure(let error): print("Received error: \(error.localizedDescription)") switch error { case .purchaseError(let purchaseError): XCTAssertEqual(purchaseError.code, StoreKitPurchaseError.invalidQuantity.code) default: XCTFail("Unexpected error: \(error)") } } } In the above code snippet, I have an Unexpected Error. But if i remove try await testSession.setSimulatedError(.purchase(.invalidQuantity), forAPI: .purchase) I will receive a XCTFail in the success of my result. So when I set the quantity to a -1, only then can I correctly receive an invalidQuantity. Does anyone know why the try await testSession.setSimulatedError(.purchase(.invalidQuantity), forAPI: .purchase) would fail to work as directed? I have tests for all the generic errors for loadProducts API and the simulatedError works great for them
1
0
369
Mar ’25
UI Testing Issues
Hi everyone, I've been working on an iOS app for about a year and a half. That application comes with unit and UI automated testings. Recently I started the development of the tvOS application so I added a new target and used the same bundle id as I want to eventually share purchases. What I need I'm working on an application that uses VLC (Need to play media more exotic than MP4) through these two pods pod 'MobileVLCKit', '3.6.0' (Only for iOS) pod 'TVVLCKit', '3.6.0' (Only for tvOS) What works Compilation works fine for both targets Unit tests work fine for both targets UI tests work fine ONLY for the original iOS target What doesn't work and how it fails When I launch the UI tests for the tvOS target, the compilation succeeds, but I get an error when calling app.launch() from my XCTestCase. Failed to get launch progress for <XCUIApplicationImpl: 0x600000c61e90 abergia.com.iptv at ...AppPath...>: App installation failed: Unable to Install “...AppName...”. This app is not made for this device. This app was not built to support this device family; app is compatible with ( 1, 2 ) but this device supports ( 3 ). (Underlying Error: Unable to Install “...AppName...”. This app is not made for this device. This app was not built to support this device family; app is compatible with ( 1, 2 ) but this device supports ( 3 ). What I tried Single target - Both Pods It looks like I can 'cheat' a little the system and make the Xcode target compatible with both iOS and tvO, but when declaring both pods inside the same CocoaPod target, the installation fails as one of the library is not compatible. Use a newer version of VLC (4.0.0) Works BUT that version is way too unstable, I will eventually use it again once they fix all the issues. Different Bundle ID Changing the bundle id of the tvOS application resolves the issue BUT I really want to use the same bundle id to share the purchases. Not UI testing the tvOS version It's an option I'm starting to contemplate out of frustration but I'm sure that we have people here who can help me!
1
0
305
Mar ’25
Prevent 2 videos from playing at once
Im building a video feed that scrolls and acts similar to TikTok or equivalent. Running into an issue where the video doesnt stop playing after you scroll to the next video, but stops only after the video after that. so it takes 2 scrolls for the video to stop playing, meanwhile every video starts playing when its in view normally, but because it takes 2 scrolls for the first video to stop, there are always 2 videos playing at the same time. Is there a function i can add so that only one video plays at a time? I tried the activeIndex with the onappear / on disappear but that didnt change anything other than all the videos following the first video wouldnt play. Here is some of the code I have, I need some dire help here. Swift Pros only - thank you in advance! import AVKit import MapKit struct LiveEventCard: View { let event: CustomEvent var isActive: Bool // Determines if the video should play let onCommentButtonTapped: () -> Void @EnvironmentObject var watchlistManager: WatchlistManager @EnvironmentObject var liveNowManager: LiveNowManager @State private var player: AVPlayer? var body: some View { GeometryReader { geometry in ZStack { // Video Player if let videoURL = event.fullVideoPath(), FileManager.default.fileExists(atPath: videoURL.path) { VideoPlayer(player: player) .frame(width: geometry.size.width, height: geometry.size.height) .onAppear { initializePlayer(with: videoURL) handlePlayback() } .onChange(of: isActive) { _ in handlePlayback() } .onDisappear { cleanupPlayer() } } else { // Error Placeholder Rectangle() .fill(Color.black.opacity(0.8)) .frame(width: geometry.size.width, height: geometry.size.height) .overlay( Text("Unable to play video") .foregroundColor(.white) .font(.headline) ) } // Gradient Overlay at the Top VStack { LinearGradient( gradient: Gradient(colors: [.black.opacity(0.7), .clear]), startPoint: .top, endPoint: .bottom ) .frame(height: 150) Spacer() } .edgesIgnoringSafeArea(.top) // Event Title + Subtitle VStack(alignment: .leading, spacing: 4) { Text(event.name ?? "Unknown Event") .font(.title2) .fontWeight(.bold) .foregroundColor(.white) Text("\(event.genre ?? "Genre") • \(event.time ?? "Time")") .font(.subheadline) .foregroundColor(.white.opacity(0.8)) } .padding([.top, .leading], 16) .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading) // Buttons at Bottom-Right VStack(spacing: 12) { // Like Button ActionButton( systemName: liveNowManager.likedEvents.contains(event.id ?? "") ? "heart.fill" : "heart", action: { toggleLike() }, accessibilityLabel: liveNowManager.likedEvents.contains(event.id ?? "") ? "Unlike" : "Like" ) Text("\(liveNowManager.likesCount[event.id ?? ""] ?? 0)") .font(.caption) .foregroundColor(.white) // Watchlist Button ActionButton( systemName: watchlistManager.isInWatchlist(event: event) ? "checkmark.circle" : "plus.circle", action: { toggleWatchlist(for: event) }, accessibilityLabel: watchlistManager.isInWatchlist(event: event) ? "Remove from Watchlist" : "Add to Watchlist" ) // Profile Button ActionButton( systemName: "person.crop.circle", action: { /* Profile Action */ }, accessibilityLabel: "Profile" ) // Comments Button ActionButton( systemName: "bubble.right", action: { onCommentButtonTapped() }, accessibilityLabel: "Comments" ) // Location Button ActionButton( systemName: "mappin.and.ellipse", action: { /* Map Action */ }, accessibilityLabel: "Location" ) } .padding(.trailing, 16) .padding(.bottom, 75) .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottomTrailing) } } } // MARK: - Player Management private func initializePlayer(with videoURL: URL) { if player == nil { player = AVPlayer(url: videoURL) } } private func handlePlayback() { guard let player = player else { return } if isActive { player.play() } else { player.pause() } } private func cleanupPlayer() { player?.pause() player = nil } // MARK: - Actions private func toggleWatchlist(for event: CustomEvent) { if watchlistManager.isInWatchlist(event: event) { watchlistManager.removeFromWatchlist(event: event) } else { watchlistManager.addToWatchlist(event: event) } } private func toggleLike() { liveNowManager.toggleLike(for: event.id ?? "") } }
1
0
347
Jan ’25
CoreBluetooth Scan not working when OS upgraded to 18.3.1
Hi, I currently have an app that connect to an arduno via CoreBluetooth. However, the app no longer discovers the arduino when the operating system was upgraded to iOS 18.3.1, however on iOS version 17.6.1 the ardiuno was discoverable I was able to test this theory on two different phones each with different iOS versions. I see that it is failing to find the peripheral at the scan however the logs indicate that the central state is powered on. Why are my peripherals no longer being discovered with this update? and what is the solution?
3
0
294
Mar ’25
Xcode Git integration destroyed my git local repository
This is using Xcode 16.2 (16C5032a), MacOS 15.2, on MacbookPro 16 M1 Pro. I have two repositories, one for an application and another one for a framework. The repository framework is integrated into the application one as git submodule. I was going to push the submodule to Github using Xcode git integration. It detects some conflicts and ask to pull. I pull. A window appears with some conflicting files (5 or 6). Review them. While reviewing something in Xcode crashed, but as Xcode was still up and running, ignored the crash. Decided to cancel the conflicts window and inspect my local files. Pull again but this time I decided to pull both repos. Review the conflicting changes and decided to cancel again to continue by hand in a terminal. Then, I notice that the project for the submodule is in red and that the "Changes" tab shows a bunch of files with and admiration mark. I go to the submodule folder in Finder and... everything inside the submodule folder was gone, disappeared, lost... everything, even the ".git" folder (only remained a binary folder for a component I use for the framework but is empty). I decided to run a recovery tool. It finds nothing to recover inside that folder, nothing. A lot of files even from years ago but nothing inside that folder? how is that possible? I filled a Feedback assistant issue: FB16307182 Could it be possible that Xcode "moved" everything to another place (I'm desperate so I'm starting to think in absurd explanations) Thanks
1
0
434
Jan ’25
CoreData in Swift Packages
I am having issues loading my model from a Swift Package with the following structure: | Package.swift | Sources | - | SamplePackage | - | - Core | - | - | - SamplePackageDataStack.swift | - | - | - DataModel.xcdatamodeld | - | - | - | - Model.xcdatamodel ( <- is this new? ) As mentioned, I am not required to list the xcdatamodeld as a resource in my Package manifest. When trying to load the model in the main app, I am getting CoreData: error:  Failed to load model named DataModel Code: In my swift Package: public class SamplePackageDataStack: NSObject {     public static let shared = SamplePackageDataStack()     private override init() {}     public lazy var persistentContainer: NSPersistentContainer = { let container = NSPersistentContainer(name: "DataModel") container.loadPersistentStores(completionHandler: { (storeDescription, error) in             if let error = error as NSError? {                 fatalError("Unresolved error \(error), \(error.userInfo)")             }         })         return container     }()     /// The managed object context associated with the main queue. (read-only)     public var context: NSManagedObjectContext {         return self.persistentContainer.viewContext     }     public func saveContext () {         if context.hasChanges {             do {                 try context.save()             } catch {                 let nserror = error as NSError                 fatalError("Unresolved error \(nserror), \(nserror.userInfo)")             }         }     } } Main App: import SamplePackage class ViewController: UIViewController { override func viewDidLoad() { &#9;&#9;&#9;&#9;&#9;super.viewDidLoad() &#9;var container = SamplePackageDataStack.shared.persistentContainer         print(container) &#9;&#9;} }
5
0
5.5k
Jul ’25
Xcode crash when recording UI test
I'm trying to use Xcode UI tests for the first time. I added a UI Tests target and set up the signing, then opened the default AppnameUITests.swift file. I added a new function named testAboutPage(), clicked inside the block and clicked the Record UI Test button (red circle) at the bottom of the editor window. If the app is already running when I do this, Xcode crashes immediately. If the app is not running, Xcode builds and runs the app, then crashes. I've seen reports of this going back years, but none of the posts have a solution. I do have a crash log to share. Does anyone know how to get past this? This forum won't let me upload the complete crash log because it exceeds the size limit, but here's the first part through the stack trace of the crashed thread: Process: Xcode [46652] Path: /Applications/Xcode.app/Contents/MacOS/Xcode Identifier: com.apple.dt.Xcode Version: 16.2 (23507) Build Info: IDEApplication-23507000000000000~2 (16C5032a) App Item ID: 497799835 App External ID: 870964517 Code Type: ARM-64 (Native) Parent Process: launchd [1] User ID: 503 Date/Time: 2025-02-04 12:58:05.5200 -0800 OS Version: macOS 15.3 (24D60) Report Version: 12 Anonymous UUID: 144B0B99-8D44-736B-0D9A-1F6FA6DF85F7 Time Awake Since Boot: 48000 seconds System Integrity Protection: enabled Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Termination Reason: Namespace SIGNAL, Code 6 Abort trap: 6 Terminating Process: Xcode [46652] Application Specific Information: abort() called Application Specific Signatures: ((result)) != nil Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x18a3b3720 __pthread_kill + 8 1 libsystem_pthread.dylib 0x18a3ebf70 pthread_kill + 288 2 libsystem_c.dylib 0x18a2f8908 abort + 128 3 IDEKit 0x109e81554 +[IDEAssertionHandler _handleAssertionWithLogString:assertionSignature:assertionReason:extraBacktrace:] + 964 4 IDEKit 0x109e819e4 -[IDEAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:] + 876 5 DVTFoundation 0x10600d358 _DVTAssertionHandler + 424 6 DVTFoundation 0x10600d4d8 _DVTAssertionFailureHandler + 196 7 IDEKit 0x10a1f99e4 -[IDEUIRecordingManager _workspaceTabController] + 176 8 IDEKit 0x10a1fa528 __94-[IDEUIRecordingManager _startRecordingWithLaunchSession:alwaysAskForAPIAccess:reservedNames:]_block_invoke_3 + 252 9 DVTFoundation 0x10611fc9c __DVT_CALLING_CLIENT_BLOCK__ + 16 10 DVTFoundation 0x1061206c4 __DVTDispatchAsync_block_invoke + 152 11 libdispatch.dylib 0x18a237854 _dispatch_call_block_and_release + 32 12 libdispatch.dylib 0x18a2395b4 _dispatch_client_callout + 20 13 libdispatch.dylib 0x18a248040 _dispatch_main_queue_drain + 984 14 libdispatch.dylib 0x18a247c58 _dispatch_main_queue_callback_4CF + 44 15 CoreFoundation 0x18a5139d0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 16 CoreFoundation 0x18a4d35bc __CFRunLoopRun + 1996 17 CoreFoundation 0x18a4d2734 CFRunLoopRunSpecific + 588 18 HIToolbox 0x195a41530 RunCurrentEventLoopInMode + 292 19 HIToolbox 0x195a47348 ReceiveNextEventCommon + 676 20 HIToolbox 0x195a47508 _BlockUntilNextEventMatchingListInModeWithFilter + 76 21 AppKit 0x18e04a848 _DPSNextEvent + 660 22 AppKit 0x18e9b0c24 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 688 23 AppKit 0x18e03d874 -[NSApplication run] + 480 24 IDEKit 0x109e50f14 -[IDEApplication run] + 192 25 AppKit 0x18e014068 NSApplicationMain + 888 26 dyld 0x18a06c274 start + 2840
1
0
497
Feb ’25
Download Container downloads only partial container
In Xcode Version 16.2 (16C5032a) - and previous versions too, the download container in the Devices & Simulators functionality no longer works. It will start downloading the container, however it will also: show NO download progress fail to download the whole container (the downloaded container is missing whole directories, eg. AppData/Library is missing - where my application stores the CoreData db) show no errors This was tested with the XCode version stated above (and previous versions) and with iPhone XR (18.1.1 - MR42CN/A) and with iPad (17.7.2 - MR7F2FD/A). How can I debug this issue / make the Xcode download the whole container? Running on Mac mini 15.1.1 (24B91).
2
0
228
Feb ’25
DYLD, symbol '_objc_claimAutoreleasedReturnValue' not found
When I finished updating the system (Mac: 15.3.1 (24D70) Xcode: Version 16.2 (16C5032a)), the following situation occurred in the Archive package: Termination Description: DYLD, symbol '_objc_claimAutoreleasedReturnValue' not found, expected in '/usr/lib/libobjc.A.dylib', needed by '/private/var/containers/Bundle/Application/60C6E2BE-661A-4BA9-98CC-6C222F20452B/Blurams.app/Blurams' Highlighted by Thread: 0 A startup crash occurs on a system with iOS16 or earlier How to solve this problem? The issue is currently blocking the release of the version
1
0
281
Mar ’25