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

Posts under Xcode tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

How to configure Signin with Google in Xcode 15 for IOS
I'm working on my 1st IOS app and I'm trying to follow the instructions from: https://developers.google.com/identity/sign-in/ios/start-integrating It instructs me to edit the info.plist file but I can't find it in my project (it appears that Xcode 15 doesn't generate the file anymore?). Do I have to add the Google client IDs somewhere else in the UI? If yes, does anyone have links to a step-by-step instruction on how to do it? I'm really new to this. Thanks!
0
0
120
Jun ’24
Xcode 15.4 from the App Store will not open on MacOS 14.5
Howdy! New Apple developer here, running a MBP 2023 M2. A year ago I used Xcode to test a Flutter app I was working on, as well as a Godot app I was making. It worked fine to open, edit, and test those projects in the simulator. Today I attempted to open Xcode and it would never load past the following window: I let it sit there and spin for probably 30 minutes while I did other tasks, but it never changed. Here is what I tried after discovering the issue: Google various generic terms relating to "No selection" and "xcode". Restart the computer. No change. Update MacOS. I hadn't updated to the latest 14.5. No change afterward when opening Xcode. Update Xcode. I updated to the latest version in the App Store 15.4. No change after update. Remove Xcode (move app to Trash from Applications, remove Library/Developer, empty trash) and fresh install from App Store. No change when opening Xcode. Reinstall command line tools (since they were removed in step 3) "xcode-select --install" and then used the UI to continue install. No change. I can't really think of what else to do, as there's not a lot of information to go off of. I don't even know what that loading screen is supposed to show when it works (maybe a list of recent projects?). All options on the Xcode menu bar and the window itself are unresponsive and just show the spinning beach ball as the cursor. What else can I do to 'reset' Xcode, and/or to clear out whatever files are preventing it from loading? Thank you in advance!
3
0
731
Jun ’24
Binding to Shared User Defaults might fail in Xcode storyboards
While binding to the Shared User Defaults in .xib files is very easy I had hard times to achieve application wide preferences in projects based on storyboards. The behavior is a bit strange/unexpected and even in Xcode 15.4 it seams not to be completely solved. Issue is that IB only creates a single instance of a Shared User Default controller for the first scene, where it was requested and linking to this instance from other scenes offers no functionality. Even worse IB suggests this as first binding proposal. Here an example to deal with this issue. add slider and label to view of ViewController in IB storyboard add MenuItem to windows menu in the Application Scene When running the app this menu item remains disabled as no action is connected bind value of the created menu item to the Shared User Defaults with Model Key Path: “showTerminal“ This creates a Shared User Defaults Controller instance that we use later. Now running the app the menu item is enabled and the checkmark toggles each time add a checkbox to the view add a User Default Controller to the View Controller Scene This must be repeated for any further Window- or View- Controller scene where a binding to the user defaults is required. bind the checkbox to the newly added User Defaults Controller (but not the Shared User Defaults Controller) keeping the suggested Controller key values and set the Model Key Path to “showTerminal“ as above now bind the slider and the label to the same User Defaults controller using an identical Model key If accidentally bound to the Shared User Defaults Controller (this is what IB suggests) no functional binding will take place! Register the defaults early (before the nib is being loaded) to set default values like for example: class AppDelegate: NSObject, NSApplicationDelegate { override init() { super.init() UserDefaults.standard.register(defaults: [ "first": 0.0 , "showTerminal": false ] ) } … } [https://github.com/MissingManual/UserDefaultsBindingsInStoryboard] ATTENTION: Suggestion is, to create the first Defaults Controller as a Shared User Defaults Controller inside the Application scene. Somehow Xcode remembers settings of the Shared User Default Controller and otherwise bindings might fail. MESSAGE: Never bind to the “Shared User Default Controller“ but to individually created “User Default Controller“ for every scene, unless it is the very first time. Alternatively you can set a let variable as @objc let defaults = UserDefaults.standard for example in each ViewController and then bind to this by Bind to: ViewController Controller Key: Model Key Path: defaults.
0
0
197
Jun ’24
Enable code coverage in the build settings of a particular target
We got an app that uses DriverKit. So we have the main target of the app and another target for DriverKit. We would like to turn on code coverage for testing. To do so we enable it in the scheme settings. Unfortunately this doesn't work because DriverKit doesn't support code coverage option. This happens because all settings set in the scheme settings get carry out for all the targets. So this the error you get: File cannot be open)ed, errno=2 path=/Applications/code.app/Contents/Developer/Toolchains/XcodeDefault.ctoolchain/usr/lib/clang/15.0.0/ lib/darwin/libclang_rt.profile_driverkit.a in '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/ 15.0.0/lib/darwin/libclang_rt.profile_driverkit.a' After talking with a couple of Apple engineers ( thanks for your help btw :) ) about a similar problem related with Address Sanitiser, they helped me adding a custom setting in build settings for the main target so address sanitiser can be enabled only for the main target. Unfortunately we didn't have enough time to cover the code coverage problem and they suggested to post a question in this forum to find out the KEY to set up code coverage in build settings Thanks
1
0
151
Jun ’24
Scheme Setting Not Persisting For Associated Target
I have an Xcode 15.4 project with 4 targets (i.e. 2 UI and 2 CLI). Next, I'm looking to set a unique scheme for each target but it keeps changing to one of the previously set schemes. For example, I have the following four targets and I would like to have the associated: Target 1 - > Scheme 1 Target 2 -> Scheme 2 Target 3 -> Scheme 3 Target 4 -> Scheme 4 When the target is selected, shouldn't the corresponding scheme be updated in the Xcode toolbar? Or is there a setting that I'm missing to enable/disable within Xcode that would resolve this issue? Finally, I'm seeing similar behavior in Xcode 16 beta 1.
1
0
163
Jun ’24
IDE generated *varname problem
When Xcode IDE inserts IBOutlet or autocompletes method signatures, it places the * char next to the var name: @property (weak) IBOutlet NSButton *aButton; - (NSString *)someMethod:(NSString *)param1 { } But my convention is put the * char right after the type name: @property (weak) IBOutlet NSButton* aButton; - (NSString*)someMethod:(NSString*)param1 { } Is there anyway to tell Xcode to follow my convention?
0
0
195
Jun ’24
Previewing your app’s interface in Xcode
// // ContentView.swift // HardApp // // Created by Besleaga Alexandru Marian on 14.06.2024. // import SwiftUI struct ContentView: View { var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundColor(.accentColor) Text("Hello, world!") } .padding() } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } } // A SwiftUI preview. #Preview { Use of unknown directive '#Preview' // The view to preview. } I'm trying to learn Xcode and got stuck on these error that I receive when trying to apply the macro #Preview, how can declare the directive so I can use it in my own code for the preview it offers ? Kind Regards
1
0
219
Jun ’24
CommandGroup, Xcode 16b1, and Swift 6
I suspect this will be a "wait for the next beta" item, but thought I'd throw it out here in case anyone knows of a workaround. Mac app compiling under Xcode 16 beta 1. Trying to get rid of all warning that would stop the adoption of Swift 6 -- Strict Concurrency Checking is set to Complete. I'm down to one warning before I can enable swift 6. SwiftUI.Commands Main actor-isolated static method '_makeCommands(content:inputs:)' cannot be used to satisfy nonisolated protocol requirement; this is an error in the Swift 6 language mode That's because I've added menu commands to the app. It's very easy to reproduce. import SwiftUI @main struct CommandApp: App { var body: some Scene { WindowGroup { ContentView() } .commands { HelpCommand() } } } struct HelpCommand: Commands { var body: some Commands { CommandGroup(replacing: .help) { Button("Help me") { // } } } } The suggested fix is telling me what change I should make ot _makeCommands. At least that is how I'm reading it.
0
2
242
Jun ’24
Developer Team not showing up in Xcode 15.4
Hi there, I currently hold an Apple Developer account that has two teams associated with it. One is my personal team, for which I pay for the Apple Developer Program. The other is a corporate account for which I am working. Despite seeing both teams in the Apple Developer (web) portal, I am only able to see one of them in the Xcode account settings page. I have reached out to Apple Developer support over the phone, and have been advised to post this issue here to better access support.
1
0
203
Jun ’24
Xcode16 Beta Compilation Error: Reserved Keyword 'module' Issue
While compiling with the Xcode Beta1 version, the 'module' keyword used in the previous method as a parameter is now recognized as a reserved keyword, causing compilation errors and preventing our project from continuing to run. Please fix this issue as soon as possible. Additionally, I would like to vent: It's quite uncomfortable that the MacOS Beta version cannot be downgraded directly. I am now facing the dilemma of being unable to open Xcode 15 and having Xcode 16 fail to compile.
4
0
424
Jun ’24
Xcode 16 crash trying to remove a package dependency
Feedback Submitted FB13898610 Xcode crashes with below. Pressing the "-" to remove a package dependancy. Solutions most welcome 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 [27376] Application Specific Information: abort() called Application Specific Signatures: NSInvalidArgumentException Application Specific Backtrace 0: 0 CoreFoundation 0x00007ff815134dc6 __exceptionPreprocess + 242 1 DVTFoundation 0x000000011257fd3e DVTFailureHintExceptionPreprocessor + 448 2 libobjc.A.dylib 0x00007ff814c24e9d objc_exception_throw + 48 3 CoreFoundation 0x00007ff81504f400 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 604 4 CoreFoundation 0x00007ff81504f18a +[NSDictionary dictionaryWithObjects:forKeys:count:] + 49 5 DevToolsCore 0x000000012118ca09 -[PBXTarget removePackageProductDependencies:] + 1053 6 DevToolsCore 0x00000001211b1c65 -[PBXTarget packageReferenceWillBeRemoved:] + 273 7 CoreFoundation 0x00007ff8150b742a -[NSArray makeObjectsPerformSelector:withObject:] + 252 8 DevToolsCore 0x000000012116200c -[PBXProject(PBXTargetedNotifications) packageReferenceWillBeRemoved:] + 267 9 DevToolsCore 0x0000000121157026 -[PBXProject removePackageReference:] + 219 10 Xcode3UI 0x0000000128db10c8 __56-[Xcode3PackageReferenceListViewController removeItems:]_block_invoke + 319 11 Xcode3UI 0x0000000128db0c7b -[Xcode3PackageReferenceListViewController removeItems:] + 1925 12 AppKit 0x00007ff81891e34d -[NSApplication(NSResponder) sendAction:to:from:] + 337 13 IDEKit 0x00000001162a8e5f __37-[IDEApplication sendAction:to:from:]_block_invoke + 315 14 DVTFoundation 0x000000011257f51d DVTInvokeWithFailureHint + 78 15 IDEKit 0x0000000116202bc0 -[IDEApplicationController application:setFailureHintMessage:duringBlock:] + 118 16 IDEKit 0x00000001162a8f2b -[IDEApplication _invokeWithFailureHint:block:] + 105 17 IDEKit 0x00000001162a8cb8 -[IDEApplication sendAction:to:from:] + 333 18 AppKit 0x00007ff81891e1c3 -[NSControl sendAction:to:] + 86 19 AppKit 0x00007ff81891e0f5 __26-[NSCell _sendActionFrom:]_block_invoke + 131 20 AppKit 0x00007ff81891dffe -[NSCell _sendActionFrom:] + 171 21 AppKit 0x00007ff81891df46 -[NSButtonCell _sendActionFrom:] + 96 22 AppKit 0x00007ff81891ae32 NSControlTrackMouse + 1823 23 AppKit 0x00007ff81891a6ef -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 125 24 AppKit 0x00007ff81891a5b6 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 666 25 AppKit 0x00007ff8189199ab -[NSControl mouseDown:] + 666 26 AppKit 0x00007ff818918353 -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 4582 27 AppKit 0x00007ff818891177 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 313 28 AppKit 0x00007ff818890e23 -[NSWindow(NSEventRouting) sendEvent:] + 345 29 IDEKit 0x0000000116269d6a -[IDEWorkspaceWindow sendEvent:] + 158 30 AppKit 0x00007ff819043470 -[NSApplication(NSEventRouting) sendEvent:] + 1456 31 IDEKit 0x00000001162a8a7f -[IDEApplication sendEvent:] + 308 32 AppKit 0x00007ff818bfe8de -[NSApplication _handleEvent:] + 65 33 AppKit 0x00007ff81872209a -[NSApplication run] + 640 34 IDEKit 0x00000001162a888a -[IDEApplication run] + 54 35 AppKit 0x00007ff8186f5ff3 NSApplicationMain + 816 36 dyld 0x00007ff814c59366 start + 1942 Kernel Triage: VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x7ff814fac14a __pthread_kill + 10 1 libsystem_pthread.dylib 0x7ff814fe4ebd pthread_kill + 262 2 libsystem_c.dylib 0x7ff814f0aa79 abort + 126 3 IDEKit 0x116226509 +[IDEAssertionHandler _handleAssertionWithLogString:assertionSignature:assertionReason:extraBacktrace:] + 1178 4 IDEKit 0x1162278c3 -[IDEAssertionHandler handleUncaughtException:] + 749 5 IDEKit 0x116227c00 IDEHandleUncaughtException + 94 6 IDEKit 0x1162a9370 -[IDEApplication reportException:] + 79 7 AppKit 0x7ff818722129 -[NSApplication run] + 783 8 IDEKit 0x1162a888a -[IDEApplication run] + 54 9 AppKit 0x7ff8186f5ff3 NSApplicationMain + 816 10 dyld 0x7ff814c59366 start + 1942
1
2
259
Jun ’24
Saving custom fonts to XCode 14 issue
Sorry for repeating this post, but an answer is desperately needed. Whenever I add custom fonts to "Fonts provided by application" the fonts are not retained and the "Fonts provided by application" setting disappears. This happens when I leave the Custom IOS Target Properties/Info tab. I have attempted this with numerous otf/ttf fonts. Using macOS Monterey 12.7.5 and X Code 14.2. See before and after screenshots.
5
0
258
Jun ’24
MacOs 16 - Xcode 16 beta - XCBBuildService quit unexpectedly
Translated Report (Full Report Below) Process: XCBBuildService [19515] Path: /Applications/Xcode.app/Contents/SharedFrameworks/XCBuild.framework/Versions/A/PlugIns/XCBBuildService.bundle/Contents/MacOS/XCBBuildService Identifier: com.apple.dt.XCBBuildService Version: 16.0 (23000.0.209.4) Build Info: XCBuild-23000000209004000~20 (16A5171c) Code Type: ARM-64 (Native) Parent Process: Xcode [1187] Responsible: Xcode [1187] User ID: 501 Date/Time: 2024-06-13 18:52:42.9964 -0300 OS Version: macOS 15.0 (24A5264n) Report Version: 12 Anonymous UUID: E79CA726-937A-A4A4-9B42-9DF9455F3181 Time Awake Since Boot: 1300 seconds System Integrity Protection: enabled Crashed Thread: 15 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Termination Reason: Namespace SIGNAL, Code 6 Abort trap: 6 Terminating Process: XCBBuildService [19515] Application Specific Information: abort() called Kernel Triage: VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter Thread 0:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x19c7ece14 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x19c7ff5b0 mach_msg2_internal + 80 2 libsystem_kernel.dylib 0x19c7f59b8 mach_msg_overwrite + 480 3 libsystem_kernel.dylib 0x19c7ed15c mach_msg + 24 4 CoreFoundation 0x19c916b40 __CFRunLoopServiceMachPort + 160 5 CoreFoundation 0x19c9153f8 __CFRunLoopRun + 1228 6 CoreFoundation 0x19c9148bc CFRunLoopRunSpecific + 608 7 CoreFoundation 0x19c98f6a0 CFRunLoopRun + 64 8 libswift_Concurrency.dylib 0x273f30e50 swift_task_asyncMainDrainQueueImpl() + 40 9 libswift_Concurrency.dylib 0x273f30e10 swift_task_asyncMainDrainQueue + 92 10 XCBBuildService 0x1021eb924 main + 84 11 dyld 0x19c4ad298 start + 2876 Thread 1: 0 libsystem_kernel.dylib 0x19c7ed990 read + 8 1 XCBServiceCore 0x102604e88 closure #3 in ServiceHostConnection.resume() + 552 2 XCBServiceCore 0x1026063c1 partial apply for specialized thunk for @escaping @callee_guaranteed @Sendable @async () -> (@out A) + 1 3 XCBServiceCore 0x10260692d partial apply for closure #1 in closure #1 in OS_dispatch_queue.async(group:qos:flags:execute:) + 1 4 XCBServiceCore 0x10260692d partial apply for closure #1 in closure #1 in OS_dispatch_queue.async(group:qos:flags:execute:) + 1 5 XCBServiceCore 0x1026061d1 specialized thunk for @escaping @callee_guaranteed @Sendable @async () -> (@out A) + 1 6 XCBServiceCore 0x1026063c1 partial apply for specialized thunk for @escaping @callee_guaranteed @Sendable @async () -> (@out A) + 1 7 libswift_Concurrency.dylib 0x273f31921 completeTaskWithClosure(swift::AsyncContext*, swift::SwiftError*) + 1 Thread 2:: llb_buildsystem_build 0 libsystem_kernel.dylib 0x19c7f05ac __psynch_cvwait + 8 1 libsystem_pthread.dylib 0x19c82e894 pthread_cond_wait + 1204 2 libc++.1.dylib 0x19c764578 std::__1::condition_variable::wait(std::__1::unique_lockstd::__1::mutex&) + 28 3 llbuild 0x1032f3308 (anonymous namespace)::BuildEngineImpl::executeTasks(llbuild::core::KeyType const&) + 4552 4 llbuild 0x1032f038c llbuild::core::BuildEngine::build(llbuild::core::KeyType const&) + 580 5 llbuild 0x103309ac4 (anonymous namespace)::BuildSystemImpl::build(llbuild::buildsystem::BuildKey) + 208 6 llbuild 0x103309ca0 llbuild::buildsystem::BuildSystem::build(llvm::StringRef) + 260 7 llbuild 0x1032fc3f0 llbuild::buildsystem::BuildSystemFrontend::build(llvm::StringRef) + 56 8 llbuild 0x1032833a8 0x103268000 + 111528 9 XCBBuildSystem 0x10275b640 partial apply for closure #13 in BuildOperation.build() + 28 10 libswift_Concurrency.dylib 0x273efc564 TaskLocal.withValue(:operation:file:line:) + 368 11 XCBUtil 0x10225d92c closure #1 in closure #1 in static Task<>.detachNewThread(name:_:) + 324 12 XCBUtil 0x102230064 thunk for @escaping @callee_guaranteed () -> () + 28 13 Foundation 0x19e3a1de0 NSThread__block_start + 76 14 libsystem_pthread.dylib 0x19c82e2e4 _pthread_start + 136 15 libsystem_pthread.dylib 0x19c8290fc thread_start + 8
3
2
280
Jun ’24
iOS 18 Simulator poor performance
I installed Xcode 16 beta on Sonoma 14.5 and tried to run my app on the simulator, but it's practically impossible to use. It's extremely slow and unresponsive. After doing some research, I noticed that launching any application causes the simulator to flood the system with logs. This triggers the diagnosticd process, which increases memory and CPU usage, worsening over time. The memory usage peaked at 10GB before I decided to close the simulator. Has anyone else experienced this issue? Is there any solution for this?
5
9
755
4w
Getting Logging Error: Failed to initialize logging system. when running app
Hello, For some reason since yesterday whenever I run an build and run an app on my Mac I get this issue: Logging Error: Failed to initialize logging system. Log messages may be missing. If this issue persists, try setting IDEPreferLogStreaming=YES in the active scheme actions environment variables. I tried to create an iOS app and this is the issue I get in the console when running it on simulator. This issue also appears on old projects I have. Setting IDEPreferLogStreaming=YES in environment variables does fix the issue and the error no longer appears but why is it appearing in the first place and how can I get rid of it? Here is a screenshot: Thanks in advance for your help.
1
0
373
Jun ’24
Rosetta Destinations not showing Xcode 16
In Xcode 16 Rosetta option is not available, Actually I'm facing some architectural issue in non rosetta simulators. The code will run only Rosetta simulators. could not find module 'module name' for target 'x86_64-apple-ios-simulator' In Xcode 15 it's available under Product -> Destination ->Destination Architecture. enter image description here
2
0
211
Jun ’24
Package.resolved modified unexpectedly when switching git branches outside of Xcode
We've recently increased our use of SPM in our iOS app's Xcode project. However, we've noticed that if the Xcode project is open when we switch to a different git branch using another tool (e.g. git on the command line or in a 3rd-party GUI), the Package.resolved file is modified unexpectedly. We've received some conflicting advice about the purpose and appropriate treatment of the Package.resolved file. Some say to add it to .gitignore. On the other hand, the docs say: …be sure to commit your project’s Package.resolved file to your Git repository. This ensures a reliable CI workflow that always uses the expected version of a package dependency. For now, our workaround is to use Xcode to switch git branches, but this seems like an unusual limitation. We're on Xcode 15.3/15.4. There is discussion on the Swift Forums of potentially related problems: https://forums.swift.org/t/xcode-automatically-updating-package-resolved/41900
4
0
261
3w
Public generated asset symbols
Is there currently an option to make generated asset symbols public? If not, would it be possible to set the generated asset symbol so they are public. It's quite common to have an apps design system implemented in a separate framework. Currently the generate assets symbols is useless for this as they can't be access in the framework consumer. It would be great to add it to this new dropdown in Xcode 16 or along side it. (113704993 in the release notes) So the options would be Internal, Public and Off. This should affect the symbols, the extensions and the framework support. (There's a post on the swift forums about this as well here: https://forums.swift.org/t/generate-images-and-colors-inside-a-swift-package/65674)
0
6
360
Jun ’24
Official VSCode extension to support .pbxproj file type
Apple mentions that they are willing to support developers on various platforms. One of them is VS Code. I just wonder if Apple tries to give official support for Xcode project files like the extension below. https://marketplace.visualstudio.com/items?itemName=mariomatheu.syntax-project-pbxproj We can download and use this extension, yes but I just wonder if Apple considers to publish any extension like above on VSCode marketplace officially?
0
0
139
Jun ’24