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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

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
102
Mar ’25
Issue with Module Import and Archiving a Mixed Swift/C Library Using Swift Package Manager
Hello everyone, I’m encountering an issue when trying to build and archive my library BleeckerCodesLib using Swift Package Manager. My project is structured with two targets: CBleeckerLib: A C target that contains my image processing code (C source files and public headers). BleeckerCodesLib: A Swift target that depends on CBleeckerLib and performs an import CBleeckerLib. Below is the relevant portion of my Package.swift: // swift-tools-version:5.7 import PackageDescription let package = Package( name: "BleeckerCodesLib", platforms: [.iOS(.v16)], products: [ .library(name: "BleeckerCodesLib", targets: ["BleeckerCodesLib"]) ], targets: [ .target( name: "CBleeckerLib", publicHeadersPath: "include" ), .target( name: "BleeckerCodesLib", dependencies: ["CBleeckerLib"] ) ] ) Directory Structure My project directory looks like this: BleeckerCodesLib/ ├── BleeckerCodesLib.xcodeproj/ │ └── xcuserdata/ │ └── robertopitarch.xcuserdatad/ │ └── xcschemes/ │ └── xcschememanagement.plist ├── BleeckerCodesLib.h ├── Package.swift └── Sources/ ├── CBleeckerLib/ │ ├── bleecker-lib.c │ └── include/ │ ├── bleecker-lib.h │ └── CBleeckerLib.h └── BleeckerCodesLib/ ├── UIImage+Extensions.swift ├── ImageProcessingUtility.swift ├── APIManager.swift ├── BleeckerCodesLib.swift ├── CameraView.swift ├── RealTimeCameraView.swift └── BleeckerCameraWrapper.swift Code Example In my Swift code (for example, in BleeckerCodesLib.swift), I import the C module as follows: import SwiftUI import UIKit import CBleeckerLib // Import the C module public struct BleeckerCodes { public struct DetectedCode { public let code: String public let corners: [CGPoint] public init(code: String, corners: [CGPoint]) { self.code = code self.corners = corners } } // Initialization function public static func initializeLibrary() -> String { bleecker_init() // Call the C module function return "BleeckerCodesLibrary initialized!" } // ... other functions } The Problem When I try to compile or archive the project using commands such as: xcodebuild archive -project BleeckerCodesLib.xcodeproj -scheme BleeckerCodesLib -destination "generic/platform=iOS" -archivePath "archives/BleeckerCodesLib" I receive the error: "no such module 'CBleeckerLib'" Any assistance or step-by-step guidance on resolving this integration issue would be greatly appreciated. Thank you in advance!
0
0
246
Feb ’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
Fetch Changes not working Xcode 16.2
I have cloned a private repo from GitHub and for the most part it seems to be working fine. e.g. commit, push and pull are working. However, Fetch Changes doesn't seem to work at all. It pops up a brief message as if it is working, but the status of my local branch under the Source Control Navigator -> Repositories does not get updated. Even after a push, the status still tells me I am ahead on the local branch. If I add a new file on the GitHub website, Fetch Changes will not see it and the repository status remains unchanged. All of these changes are immediately visible in 'Fork' (3rd party Git GUI). If I restart Xcode the status is updated correctly, but it does not keep up with further changes. Anything I can do other than avoid using Xcode for GitHub tasks? Update: This might just be a problem with the Source Control Navigator views not updating. I just found that if I change branch, the "Repositories" section will not reflect the branch change until I exit and re-enter that view. e.g. click on "Changes" and back into "Repositores" to see the update. That workaround does not impact the out of date repo status though (how many commits am I ahead or behind). Seems very buggy...
0
2
334
Jan ’25
FamilyControls Framework info.plist missing
We are trying to create a screentime app using the Family Controls as well as Device activity frameworks. The build succeeds but while pushing to an iphone we are getting an info.plist file for deviceactivity.framework could not be found error. For reference when using the Screentime API a physical device must be used not a simulator. When we remove the device activity framework this error also occurs for the family controls framework. We have added the Family Controls(development) Capability and applied for the distribution capability. We have redownloaded xcode multiple times on the main device, deleted derived data, and redownloaded all of the iphone SDKs and the issue still persists.
0
0
238
Mar ’25
My app stops at 90% on testfight and doesn't download
I am creating an imessage sticker pack and I am having an issue with an update of my app. It publishes to test flight but I can't download it to test. My app has an extension of imessage. I have tried: Checking the size of the animated stickers. All are below 500kb My version number is 4.1.1. so no 0 I am really no sure what to do. Any suggestions would be appreciated.
0
0
214
Jan ’25
Getting an error in Xcode after resting simulator
I just made clean data on simulator then started getting the below error built on Xcode ? Showing Recent Issues Entitlements file "Clinic.entitlements" was modified during the build, which is not supported. You can disable this error by setting 'CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION' to 'YES', however this may cause the built product's code signature or provisioning profile to contain incorrect entitlements.
0
0
320
Feb ’25
Error Missing required module 'RxCocoaRuntime' in xcframeworks
Hi. I have a xcframework that has a dependency on 'RxSwift' and 'RxCocoa'. I deployed it using SPM by embedding it in a Swift Package. However when I import swift package into another project, I keep getting the following error: "Missing required module 'RxCocoaRuntime" How can I fix this? Below are the steps to reproduce the error. Steps Create Xcode proejct, make a dependency on 'RxSwift' and 'RxCocoa' (no matter doing it through tuist or cocoapods) Create XCFramework from that proejct. (I used commands below) xcodebuild archive \ -workspace SimpleFramework.xcworkspace \ -scheme "SimpleFramework" \ -destination "generic/platform=iOS" \ -archivePath "./SimpleFramework-iphoneos.xcarchive" \ -sdk iphoneos \ SKIP_INSTALL=NO \ BUILD_LIBRARY_FOR_DISTRIBUTION=YES xcodebuild archive \ -workspace SimpleFramework.xcworkspace \ -scheme "SimpleFramework" \ -archivePath "./SimpleFramework-iphonesimulator.xcarchive" \ -sdk "iphonesimulator" \ SKIP_INSTALL=NO \ BUILD_LIBRARY_FOR_DISTRIBUTION=YES xcodebuild -create-xcframework \ -framework "./SimpleFramework-iphoneos.xcarchive/Products/Library/Frameworks/SimpleFramework.framework" \ -framework "./SimpleFramework-iphonesimulator.xcarchive/Products/Library/Frameworks/SimpleFramework.framework" \ -output "./SimpleFramework.xcframework" Embed in Swift Package, and deploy. // swift-tools-version: 6.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "SimplePackage", platforms: [.iOS(.v16)], products: [ .library( name: "SimplePackage", targets: ["SimplePackage"]), ], dependencies: [ .package(url: "https://github.com/ReactiveX/RxSwift", from: "6.8.0") ], targets: [ .binaryTarget( name: "SimpleFramework", path: "Sources/SimpleFramework.xcframework" ), .target( name: "SimplePackage", dependencies: [ "SimpleFramework", "RxSwift", .product(name: "RxCocoa", package: "RxSwift") ] ) ] ) Download Swift Package in another project and import module. I resolved this by removing dependencies from the Swift Package, downloading package in another project, and fetching dependencies by cocoapods. Thist works, but I don't want to use another dependency manager while using SPM. Development Environment CPU : Apple M4 Max MacOS : Sequoia 15.3 Xcode : 16.2
0
0
252
Mar ’25
Bonjour Capabilities
I'm a noobie but doing a tutorial where it requires me to add these capabilities to my project. Access Wi-Fi Information Network Extentions Bonjour Services I have the Access Wi-Fi and Network Extentions installed but I could not find Bonjour Services Any help would be much appreciated! Thanks
0
0
151
Jan ’25
XLSXWriter Help
Hello, I am brand new to development in Xcode. I have created a Mac app that I need to use XLSXWriter to export a workbook and sheet. Is GitHub the only place for this download or is there an apple developer specific area to get the library? Thanks
0
0
132
Jan ’25
Deep link to a file in Xcode
Hi, is there documentation on how to write a deep link that will open Xcode on a given file, and optionally a line number? I know about xed, and I would like exactly that functionality, but in link form, so that I can link to a certain file from an app such as Obsidian or from a README.md file. I checked Xcode's Info.plist and it understands several URL schemes, the most promising of which is xcode://, which successfully launches the app, but no matter what I tried, I get an error dialog telling me that Xcode did not understand the URL. Any help on this topic would be greatly appreciated. Victor
0
0
295
Mar ’25
How to make RealityKit both parent and child entities accessible to UI tests?
I have a SwiftUI RealityKit app, and I am writing UI tests for it. The app has entities that have children. All entities have an accessibilityComponent so that they can be found by UI tests. If I set isAccessibilityElement = true for the parent, the UI tests find the parent. If I set isAccessibilityElement = false for the parent, and isAccessibilityElement = true for the child, the UI tests find the child. If I set isAccessibilityElement = true for the parent as well as for the child, the UI tests find only the parent. How can I make parent and child entities both be accessible by the UI tests?
0
0
284
Feb ’25
Run on multiple simulators
I am developing a game that has 3 team members. I can manually start up 3 simulators and run the game for developing/testing but seem like there should be a simple way to click build/run and have it launch on all three automatically. Does anyone know how to do this or if its even possible without writing some scripts?
0
0
67
Mar ’25
Swift Package Manager - Package Download Issue
We have developed a custom iOS framework called PaySDK. Earlier we distributed the framework as PaySDK.xcframework.zip through GitHub (Private repo) with two dependent xcframeworks. Now, one of the clients asking to distribute the framework through Swift Package Manager. I have created a new Private repo in the GitHub, created the new release (iOSSDK_SPM_Test) tag 1.0.0. Uploaded the below frameworks as Assets and updated the downloadable path in the Package.Swift and pushed to the GitHub Main branch. PaySDK.xcframework.zip PaySDKDependentOne.xcframework.zip PaySDKDependentTwo.xcframework.zip When I try to integrate (testing) the (https://github.com/YuvaRepo/iOSSDK_SPM_Test) in Xcode, am not able to download the frameworks, the downloadable path is pointing to some old path (may be cache - https://github.com/YuvaRepo/iOSSDK_SPM/releases/download/1.2.0/PaySDK.xcframework.zip). Package.Swift: // swift-tools-version:5.3 import PackageDescription let package = Package( name: "iOSSDK_SPM_Test", platforms: [ .iOS(.v13) ], products: [ // Products define the executables and libraries a package produces, making them visible to other packages. .library( name: "iOSSDK_SPM_Test", targets: ["PaySDK", "PaySDKDependentOne", "PaySDKDependentTwo"] ) ], targets: [ // Targets are the basic building blocks of a package, defining a module or a test suite. // Targets can depend on other targets in this package and products from dependencies. .binaryTarget( name: "PaySDK", url: "https://github.com/YuvaRepo/iOSSDK_SPM_Test/releases/download/1.0.0/PaySDK.xcframework.zip", checksum: " checksum " ), .binaryTarget( name: "PaySDKDependentOne", url: "https://github.com/YuvaRepo/iOSSDK_SPM_Test/releases/download/1.0.0/PaySDKDependentOne.xcframework.zip", checksum: " checksum " ), .binaryTarget( name: "PaySDKDependentTwo", url: "https://github.com/YuvaRepo/iOSSDK_SPM_Test/releases/download/1.0.0/PaySDKDependentTwo.xcframework.zip", checksum: " checksum " ), .testTarget( name: "iOSSDK_SPM_TestTests", dependencies: ["PaySDK", "PaySDKDependentOne", "PaySDKDependentTwo"] ) ] ) Steps I followed: I have tried below steps, Removed the local repo and cloned new rm -rf ~/Library/Caches/org.swift.swiftpm/ rm -rf ~/Library/Developer/Xcode/DerivedData/* Can anyone help to identify the issue and resolve? Thanks in advance.
0
0
434
Jan ’25