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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Activity

OSLog output in Xcode console ignoring OSLogIntegerFormatting?!
In my Swift macOS app, I use OSLog logging via the line: logger.log("••• channel \(channel, format: .octal(minDigits: 3))") .. and the Xcode console shows: ••• channel 29 .. the formatting to octal and minDigits are ignored. I've searched high and low for why this is happening (another app with the same line results in correct Xcode console output). The Console.app does show the correct output: ••• channel 035 Any suggestions regarding what I'm not understanding? Thanks.
6
0
781
Jul ’24
Simulator iOS 15 Can't Response touch on Xcode 15.4
I have a problem with my xcode. I try to install apps xcodes to manage multiple xcode. My xcode version on 15.2(i try to run on iOS 15 SE1 it's no problem) and after that i try to install xcode 16 beta 3 i try to run iOS 15 SE1 the simulator blank. After that, i delete xcode 16 beta 3 and use xcode 15.2 i try to run on Simulator SE1 iOS 15 the simulator can't response touch. I try to trigger with Device menu on simulator Home, lock, trigger screenshot, etc. The simulator not response touch. How to solve this problem ? how to remove all simulator if uninstall xcodes.
13
9
4.5k
Jul ’24
Xcode 16 beta 3 can't load Teams in VM
I'm currently setting up a new build environment. Our old build server was a small M1 Mac Mini set up to build our, up-to-now, only app. Since we now have a second app (and probably more to come) and have some issues building all on the same mac (gem versions, flutter versions, etc.) I now set up a virtualized build environment. I'm currently running a MacOS 15 beta 3 VM on a M2 Mac Mini also on MacOS 15 beta 3. The VM has all basic tools inside, including Xcode 16 beta 3 and is logged in with our AppleID for our build server. The VM is spun up with a non-persistent storage before the build, installs the gem's/flutter in the correct version, checks out the code and builds it. Now I'm getting an error on the build, that I have to select a development team, but he team is already selected and the build is working fine on the old M1 Mac Mini. It is suggested to login to Xcode, so I logged in to Xcode in the VM, which itself was successful, but when loading the teams I'm getting the following error: Decoding Error There was a failure decoding response: (HTTP 401, 60 bytes) The data couldn't be read because it isn't in the correct format.. The account info is correct, it's the same account that is logged in to MacOS and it's the same account from the old build system. I guess this somehow has to do with the MacOS VM (before MacOS 15 it was not possible to signin to an apple id, this is also the reason why I use the beta). Is there any chance to fix this and get it working? We are not able to use Xcode cloud builds (or any other cloud services) due to corporate policies. We are also not able to buy a dedicated Mac Mini for every app (too expensive and too much time needed for maintenance).
6
2
3k
Jul ’24
Xcode 16 Beta 3: "Cannot expand accessors on variable declared with 'let'"
Running into this new issue in beta 3. All of our immutable model attributes are now triggering swift compiler error from the title (tied to swift 6 - warning in swift 5). Neither warning or error show up on previous builds. Anyone else running into this? Hopefully not a limitation on swiftData that attributes must be mutable? filed as: FB14379932 (new in Xcode 16 beta3: "cannot expand accessors on variable declared with 'let'" in SwiftData Models)
5
5
2.6k
Jul ’24
Now: "Sandbox: rsync.samba(1384) deny(1) file-write-create"
Hi, my project with Google Mobile Ad SDK pod is facing a lot of issues. It's now the one in the title. Literally every post I found is about setting the User Script Sandboxing in the build option to no. But mine is already no. Any advice? A little more info, at first it was "Command PhaseScriptExecution failed with a nonzero exit code". I clean the build folder. It changed to "Sandbox: rsync.samba([some other number]) deny(1) file-read-data". I cleaned the build folder again. Then it changed to the title one. Not sure if this is relevant. Many many thanks!
3
1
6.3k
Jul ’24
Xcode UI test cannot tap menu button in form
Apparently UI tests are unable to tap menu buttons but can tap regular buttons inside forms. Earlier today I was able to see in the Simulator that the UI test tries to tap the button by tapping the center of the containing form row, which works for regular buttons, but not for menu buttons. In fact, when trying in the SwiftUI preview in Xcode it seems that menu buttons have to be tapped exactly on top of them, while regular buttons can be tapped anywhere in the form row. (Now I’m not able to see touches performed by the UI test anymore in the Simulator for an unknown reason, even though I have “Show single touches” enabled in the Simulator settings.) How can I open a menu button in a UI test? The UI code: struct ContentView: View { @State private var label1 = "Menu 1" @State private var label2 = "Menu 2" var body: some View { NavigationStack { Form { LabeledContent("Menu 1") { Button(label1) { label1 = "Menu 1 tapped" } .accessibilityIdentifier("menu1") } LabeledContent("Menu 2") { Menu(label2) { Button("Button") { } .accessibilityIdentifier("button") } .accessibilityIdentifier("menu2") } } } } } #Preview { ContentView() } And the test: final class problemUITests: XCTestCase { func testExample() throws { // UI tests must launch the application that they test. let app = XCUIApplication() app.launch() app.collectionViews.element(boundBy: 0).buttons["menu1"].tap() app.collectionViews.element(boundBy: 0).buttons["menu2"].tap() app.collectionViews.element(boundBy: 0).buttons["button"].tap() } }
2
0
661
Jul ’24
Could not build module 'UIKit' - XCode 16 Beta 3
I have an old project that combines Objective-C with Swift and it is compiling just fine in XCode 15 but is not compiling on XCode 16 Beta 3. There are multiple errors such as: "could not build module 'UIKit'" "could not build module 'CoreMedia'" "could not build module 'CoreLocation'" Among the errors there is this one about failing to emit precompiled header in the Bridging header file of the project. I've tried re-installing XCode 16 Beta 3, re-installing the simulator, restarting the computer and I've also created a sample project that also combines swift and Ojb-c and that one compiles just fine. Any clues? Thanks!
11
3
5.1k
Jul ’24
Waiting to reconnect to [DEVICE NAME]
Hi, the 'Waiting to reconnect to [DEVICE NAME]' error is repeatedly occurring. Previous preparation error: Developer Mode disabled. To use[DEVICE NAME] for development, enable Developer Mode in Settings → Privacy & Security. Of course, the developer mode is already turned on and I've used the connection between my devices via XCode until yesterday. But it suddenly happened. I have several devices(iOS/iPadOS) so I've tried them all, but they are all having the same situations. What I've tried: Re-install XCode Rebooting mac and iPhone Safe boot my mac Disable and enable developer mode
9
6
5.7k
Jul ’24
Xcode16 linker error
I am building my project and it build failed on Xcode 16.0 Beta 2 use Default linker(I think it's -ld_new). Undefined symbols for architecture arm64: "__mh_execute_header". But when using the -ld64 linker, this error will not be reported. I am confused. Does -ld_new have any special handling for __mh_execute_header? Thanks for any help!
2
1
2.9k
Jul ’24
Symbolicating crash report pointing to some wrong method
We are developing an Xcframework that contains Objc + Cpp code. Cpp code is internal to the framework so we are stripping all the symbols. Framework is using few build options to strip off internal symbols: Build PostProcessing - Yes Strip Style - Non-Global Symbols Other Cpp flags - $(OTHER_CFLAGS) -fvisibility-inlines-hidden -fvisibility=hidden Now when a crash happens due to "abort()" function, the topmost symbol (of the framework) is symbolicated to totally different method. But if crash happens due to some other reason, then symbolication works fine. We have tried atos command as well as Mac symbolicator. Both show same behaviour. To explain the issue in more details, here is a GitHub link. It contains all the details on how to reproduce the issue. Build settings are similar to our project settings. https://github.com/bmahajanZ/apple-build-issue
1
0
270
Jul ’24
Symbolicating crash report pointing to some wrong method
We are developing an Xcframework that contains Objc + Cpp code. Cpp code is internal to the framework so we are stripping all the symbols. Framework is using few build options to strip off internal symbols: Build PostProcessing - Yes Strip Style - Non-Global Symbols Other Cpp flags - $(OTHER_CFLAGS) -fvisibility-inlines-hidden -fvisibility=hidden Now when a crash happens due to "abort()" function, the topmost symbol (of the framework) is symbolicated to totally different method. But if crash happens due to some other reason, then symbolication works fine. We have tried atos command as well as Mac symbolicator. Both show same behaviour. To explain the issue in more details, here is a GitHub link. It contains all the details on how to reproduce the issue. Build settings are similar to our project settings. https://github.com/bmahajanZ/apple-build-issue
3
0
581
Jul ’24
Pairing Apple watch series 9 with Xcode version 15.4
Hi, I am trying to pair an Apple watch series 9 with Xcode version 15.4. I followed the following steps and the Apple watch does not appear as an available device in the list of run destinations in the drop down menu at the top of the Xcode window. I switch developer mode on for the iPhone 15. I was able to pair my Apple watch series 9 with the iPhone 15 following instructions on the iPhone. I turn on the 'Associated Domains Development' and 'WidgetKit Developer Mode' modes in the Settings -> Developer menu of the Apple watch. I connect the iPhone with the Macbook running Xcode using a cable and pair the two devices. The iPhone appears as an available iOS device. However, when I change the target to a watchOS app, the Apple watch does not appear as an available device. I am able to install and run an App developed in Xcode on the iPhone. Can step by step instructions for installing and running a watchOS App on an Apple watch series 9 be shared. Thank you.
1
0
446
Jul ’24
Xcode.app crashes after opening new project
It will shows a dialog when I launch Xcode.app. You don’t have permission to save the file “DeveloperDiskImages” in the folder “Developer”. Then, I clicked OK to move on. Then, I choose the button "Create New Project", the app just crashed immediately. I also tried to manually create the folder "DeveloperDiskImages" in /Users/howardchung/Library/Developer/ It will not show the dialog while launching Xcode.app, but also crashed in "Create New Project".
1
0
368
Jul ’24
Linker changes in Xcode 16 / macOS 15?
I have existing code in production that links against the mach-o library, and uses the following code: NSData *data = [NSData dataWithBytes: getsectiondata(&_mh_execute_header, "__TEXT", "__somePlist_plist", &len) length:len]; In order for this to compile with Sequoia Beta 4 and Xcode 16 beta 4, I have to replace _mh_execute_header with _mh_dylib_header. If I don't, the compiler raises the following error: ld: Undefined symbols: __mh_execute_header, referenced from: -[MyClass init] in MyClass.o clang: error: linker command failed with exit code 1 (use -v to see invocation) Any idea why the linking behavior might have changed? Should I file a bug? (I realize this is a C issue, not Objective-C - but didn't find a tag for that) Thanks!
16
0
6.1k
Jul ’24
How to build projects once?
Hi, I have been tasked with porting our C++ codebase from Windows/Linux to MacOS. Our setup uses Premake to generate platform specific project files. On Windows it creates a Visual Studio solution and project files, on Linux it creates makefiles, and on MacOS it generates an Xcode workspace and project files. Our project hierarchy looks something like this: Solution/Workspace S Project A (shared library) Project B (shared library) Project C (shared library) Projects D to R (About a dozen or so - all shared libraries) Project V (application) Project W (application) Project X (application) Project Y (application) Project Z (application) Projects B and C depend on A. Projects D to R are dependent on some or all of the projects A, B, and C. Each application is dependent on projects A, B, and C, and some of the intermediate projects D to R. (The exact dependencies vary according to the application.) Additionally, some applications can load shared libraries dynamically according to their state/settings. I.e., not all shared library dependencies are known at build time. Initially all building typically happens on the command line. Once our build script has run Premake to generate the project files, it proceeds to build everything. Further builds can happen within Visual Studio/Xcode as part of the normal workflow. However, building must happen on the command line for DevOps CI/Release builds. On Windows, for example, MSBuild lets me build the entire solution for a given configuration (Debug/Release/etc) in a single command. This builds projects A, B, C in order, followed by the intermediate projects (D to R), followed by the applications (V to Z). Each project is built once. Same deal for Linux. Make builds each project in turn according to the dependencies with a single command. Each project is build once. On MacOS, however, xcodebuild doesn't let me just build the entire workspace for a given configuration. I can specify a workspace, but then I have to also specify a scheme. Or I can just specify a specific project. However, when I build a specific project, Xcodebuild always builds all dependencies. So my build script at the moment explicitly builds projects D to R, followed by applications V to Z. This, however, leads to the ridiculous situation of Xcode building projects in the following order: D, C, B, A E, C, A F, C, B, A G, B, A etc... V, F, G, H, C, B, A W, G, I, C, B, A X, K, C, B, A etc... With the obvious effect of our MacOS builds taking 20+ times longer than their Windows/Linux counterparts. So, my main questions are: Is it possible to just build every project in the workspace once? Or if that can't be done, is it possible to not build project dependencies? I.e., can I just build the single project I specify? If neither of those are possible, how can I optimise my builds so that they don't take half a day to complete? I should point out, removing the project dependencies isn't an option. If project A is genuinely out of date, it should be built if I build one of the applications. Xcode should be smart enough to realise that it doesn't need to build everything every time.
3
0
785
Jul ’24
Disable automatic InfoPlist.xcstrings generation
Hi all, I am trying to localise the purpose strings in my Info.plist file, for that I am using the InfoPlist.xcstrings file. In my app I have multiple targets, each with a different display name, the problem that I am facing is that when the InfoPlist.xcstrings file is automatically updated in each build the CFBundleDisplayName is always added to the file which forces me to have just one name for every target. So, I would like to know how others approach this problem and how can I resolve my situation. The ideal solution was that there was a way for me to disable this automatic generation (or at least trigger it by hand) once I have added all the purpose strings that I want to localise in multiple languages. If not, having one InfoPlist.xcstrings per target will also so it, although it will be a little harder to maintain. AFAIK, there's no documentation on the InfoPlist.xcstrings generation, so any help will be very much appreciated. Thank you all in advance
2
0
1.5k
Jul ’24