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

Xcode Documentation

Posts under Xcode subtopic

Post

Replies

Boosts

Views

Created

Simulator is not working.
Hi, I am a UI designer and a total newbie with coding, so I have been using AI in Xcode to do all my coding for my personal project. Everything was working fine until this morning, when I tried to run my app in the simulator (I didn't even change any code from the last time I ran the simulator) and now the simulator is crashing and freezing and I have been trying to fix it with the AI recommendations, but it seems way too complicated for me to handle even with AI's help. I feel like I need to talk to an expert and guide me out of this hole. Please help. Thank you!
3
0
311
1w
How to eliminate frameworks from being picked up by Xcode
I wrote my own framework and it uses some OpenGL calls, I have my own direct replacements for these calls. But Xcode complains when I try to integrate these calls into a NSApp that all of these calls are deprecated. It must be in some module that Appkit or Cocoa uses to include all the headers as I went through and eliminated all potential references. I could just encapsulate all of this in a separate C or C++ file, but I would rather write it all in Obj-C. I know it's just a warning, but I like to treat warnings as errors to catch as many bugs as possible.
1
0
88
1w
How do I build a framework and be able to use it within the same project
I am building a framework and an app, the framework is a dependent on the app so that works.. But within the app I can't use #import <OpenGL_4_6/OpenGL_4_6.h> But I have to use #import "OpenGL_4_6/OpenGL_4_6.h" I can see the framework being built its in a directory that I can't seem to express with the $ macros for Xcode Library/Developer/Xcode/DerivedData/MGL-bpbwpidwnbulrxgcndprcdmfrosb/Build/Products/Debug I tried to set my framework search path to this.. but to no avail.
4
0
107
1w
Share Issue
We are facing an issue where we share the Taqeem app (https://apps.apple.com/app/id6692622292) but sharing is not working properly. Few iPhone gives image, url however few share only image as shown in attached screenshot. Also with our devices (iPhone 16 Pro, iPhone 14 Pro - especially Pro series) if we share any ad from our app, it is sharing only image and text + url that we share also not get shared. We were using regular code as below. So we believe that Share using UIActivityViewController is having an issue. Images are available at below links. https://ibb.co/RkG70NqH https://ibb.co/dJKBR9jc Code I used is as below. func shareDetails(shareText : String, shareURLString : String) { if let shareURL : NSURL = NSURL(string: shareURLString) { // If you want to use an image let image : UIImage = UIImage(named: "logo.png") let activityViewController : UIActivityViewController = UIActivityViewController(activityItems: [shareText, shareURL, image], applicationActivities: nil) // This lines is for the popover you need to show in iPad activityViewController.popoverPresentationController?.sourceView = topVC?.view // This line remove the arrow of the popover to show in iPad activityViewController.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection.down activityViewController.popoverPresentationController?.sourceRect = CGRect(x: 150, y: 150, width: 0, height: 0) // Pre-configuring activity items if #available(iOS 13.0, *) { activityViewController.activityItemsConfiguration = [ UIActivity.ActivityType.message ] as? UIActivityItemsConfigurationReading } if #available(iOS 13.0, *) { activityViewController.isModalInPresentation = true } topVC?.present(activityViewController, animated: true, completion: nil) } } Thanking You
2
0
90
1w
UISegmentedControl tap position misalignment in Xcode 26 with UIDesignRequiresCompatibility enabled
Environment macOS 15.7.3 Xcode 26.1.1 / 26.2 iOS 18.5 / 26.2 iPhone 16 Pro Simulator and physical device Problem Description When tapping an unselected UISegmentedControl, the selected segment does not match the tapped position. Specifically, tapping the rightmost segment (index: 3) results in the leftmost segment (index: 0) being selected instead. Conditions for Reproduction This issue occurs when all of the following conditions are met: Built with Xcode 26.x UIDesignRequiresCompatibility is set to YES in Info.plist UISegmentedControl is positioned using Auto Layout with leading alignment Segments are added dynamically using insertSegment(withTitle:at:animated:) Note: The issue does not occur when segments are defined statically in Storyboard. Steps to Reproduce Create a subclass of UISegmentedControl that dynamically sets segments: class CustomSegmentedControl: UISegmentedControl { func setSegments(titles: [String]) { removeAllSegments() titles.forEach { title in insertSegment(withTitle: title, at: numberOfSegments, animated: false) } } } In the ViewController, configure the control: override func viewDidLoad() { super.viewDidLoad() segmentedControl.setSegments(titles: ["Item A", "Item B", "Item C", "Item D"]) segmentedControl.selectedSegmentIndex = UISegmentedControl.noSegment } Set UIDesignRequiresCompatibility to YES in Info.plist: <key>UIDesignRequiresCompatibility</key> <true/> Run the app and tap the rightmost segment ("Item D") Expected vs Actual Behavior Expected Actual Tap rightmost segment "Item D" (index: 3) is selected "Item A" (index: 0) is selected What I Tried (Did Not Work) Calling layoutIfNeeded() after adding segments: segmentedControl.setSegments(titles: ["Item A", "Item B", "Item C", "Item D"]) segmentedControl.layoutIfNeeded() // No effect Workarounds Set UIDesignRequiresCompatibility to NO (enables Liquid Glass design) Define segments statically in Storyboard instead of dynamically Sample Project Minimal reproduction project is available here: https://github.com/CH3COOH/Samples/tree/master/SampleSelectSegmentedControl Feedback Assistant This issue has been reported via Feedback Assistant: FB21712773 Has anyone else encountered this issue or found alternative workarounds?
0
0
106
1w
Is it possible for Xcode to display warnings from package dependencies?
I have quite a few in-door local packages that I do not really develop outside of the context of Xcode projects - meaning that I add local references to these libraries (and other content) to my Xcode project - and I update the libraries directly in Xcode within the project. I very rarely open up the library package on its own and work on it just like that. The unfortunate thing is that Xcode seems to be silencing warnings from all the packages during the build phase, resulting in me not seeing warnings from those libraries. I then need to open them separately in Xcode and review whether they contain any warnings and fix them. Using treat warnings as errors is, of course, one solution, but it doesn't help in cases where it's impossible to avoid them (e.g. https://github.com/swiftlang/swift/issues/86650) as there's no #pragma push; or in case of user-defined #warning which I often use to mark parts of code that need revisiting. I've gone through various settings, but I don't see anything relevant. Most of Google search is filled with attempts to silence the warnings instead of enabling them or wanting errors instead of warnings. Does anyone here know if it's possible for Xcode to display warnings from included packages and how to adjust such an option? Thanks!
0
0
73
1w
Xcode 26.2 fails building Flutter iOS app – xcode_backend.dart null exception
Hello, after updating macOS to 26.2 and Xcode to 26.2 (Build 17C52), I am unable to build a Flutter iOS application for the simulator. Environment: macOS 26.2 (darwin-arm64) Xcode 26.2 (17C52) Flutter 3.38.7 (stable) Dart 3.10.7 CocoaPods 1.16.2 Target device: iPhone 16e Simulator (iOS 26.x) Issue: The build fails during the Flutter Xcode build phase with this error: Unhandled exception: Null check operator used on a null value #0 Context._embedNativeAssets (file:///opt/homebrew/share/flutter/packages/flutter_tools/bin/xcode_backend.dart:341) Command PhaseScriptExecution failed with a nonzero exit code. Additional info: Runner target uses Pods-Runner.debug/profile/release.xcconfig correctly SUPPORTED_PLATFORMS = iphoneos iphonesimulator SDKROOT resolves to iPhoneOS26.2.sdk even when building for simulator Build Settings and Run Script phases are default Flutter-generated Issue occurs both via flutter run and directly from Xcode Project worked before macOS/Xcode update It appears Xcode 26.2 may be resolving SDKROOT or build environment incorrectly for Flutter projects, causing Flutter’s xcode_backend.dart to crash. Could you please advise whether this is a known issue or requires a workaround? Thank you. Best regards David
1
0
53
1w
Inconsistent Symbol Linking Behavior for UTType from UniformTypeIdentifiers Framework
In our app, we implement a document picker using FilePickerManager+available.m, selecting different APIs based on the iOS version: if (@available(iOS 14.0, *)) { NSMutableArray<UTType *> *contentTypes = [NSMutableArray array]; for (NSString *uti in documentTypes) { UTType *type = [UTType typeWithIdentifier:uti]; if (type) { [contentTypes addObject:type]; NSLog(@"iOS 14+ Adding type: %@", uti); } else { NSLog(@"Warning: Unable to create UTI: %@", uti); } } UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initForOpeningContentTypes:contentTypes]; documentPicker.delegate = self; documentPicker.allowsMultipleSelection = NO; [self.presentingViewController presentViewController:documentPicker animated:YES completion:nil]; } However, we've observed inconsistent symbol reference types to UTType in the final linked binaries: One build results in a strong reference to UTType. Another demo project (with seemingly identical code and build settings) results in a weak reference. Both object files (.o) show undefined references to UTType symbols (e.g., UTTypeCreatePreferredIdentifierForTag), yet the final linked binaries differ in how these symbols are resolved. Impact of the Issue This inconsistency causes problems on iOS 14.0+ devices: Strong reference version: Fails to launch on devices where the UniformTypeIdentifiers framework is not present (e.g., certain older iOS 14.x devices), due to link-time failure. Weak reference version: Launches successfully but crashes at runtime when attempting to call UTType methods, because the implementation cannot be found. Our Analysis Using nm -u, both versions show an undefined symbol: U _UTTypeCreatePreferredIdentifierForTag However, in the final binaries: One shows: T _UTTypeCreatePreferredIdentifierForTag (strong) The other shows: W _UTTypeCreatePreferredIdentifierForTag (weak) Both projects link against the framework identically in their build logs: -framework UniformTypeIdentifiers (no -weak_framework flag is used in either case). Questions Why do identical source code and linker flags result in different symbol reference strengths (T vs W) for the same framework? Are there specific compiler or linker behaviors (e.g., deployment target, SDK version, module imports, or bitcode settings) that influence whether symbols from UniformTypeIdentifiers are treated as strong or weak? What is the recommended best practice to ensure consistent symbol referencing when using newer APIs like UTType, especially when supporting older OS versions? We aim to understand this behavior to guarantee stable operation across all supported iOS versions—avoiding both launch failures and runtime crashes caused by inconsistent symbol linking. Any insights or guidance from the community or Apple engineers would be greatly appreciated! Let me know if you'd like a shorter version or want to include additional build environment details (Xcode version, deployment target, etc.)!
1
0
95
1w
Inconsistent Symbol Linking Behavior for UTType from UniformTypeIdentifiers Framework
In our app, we implement a document picker using FilePickerManager+available.m, selecting different APIs based on the iOS version: if (@available(iOS 14.0, *)) { NSMutableArray<UTType *> *contentTypes = [NSMutableArray array]; for (NSString *uti in documentTypes) { UTType *type = [UTType typeWithIdentifier:uti]; if (type) { [contentTypes addObject:type]; NSLog(@"iOS 14+ Adding type: %@", uti); } else { NSLog(@"Warning: Unable to create UTI: %@", uti); } } UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initForOpeningContentTypes:contentTypes]; documentPicker.delegate = self; documentPicker.allowsMultipleSelection = NO; [self.presentingViewController presentViewController:documentPicker animated:YES completion:nil]; } However, we've observed inconsistent symbol reference types to UTType in the final linked binaries: One build results in a strong reference to UTType. Another demo project (with seemingly identical code and build settings) results in a weak reference. Both object files (.o) show undefined references to UTType symbols (e.g., UTTypeCreatePreferredIdentifierForTag), yet the final linked binaries differ in how these symbols are resolved. Impact of the Issue This inconsistency causes problems on iOS 14.0+ devices: Strong reference version: Fails to launch on devices where the UniformTypeIdentifiers framework is not present (e.g., certain older iOS 14.x devices), due to link-time failure. Weak reference version: Launches successfully but crashes at runtime when attempting to call UTType methods, because the implementation cannot be found. Our Analysis Using nm -u, both versions show an undefined symbol: U _UTTypeCreatePreferredIdentifierForTag However, in the final binaries: One shows: T _UTTypeCreatePreferredIdentifierForTag (strong) The other shows: W _UTTypeCreatePreferredIdentifierForTag (weak) Both projects link against the framework identically in their build logs: -framework UniformTypeIdentifiers (no -weak_framework flag is used in either case). Questions Why do identical source code and linker flags result in different symbol reference strengths (T vs W) for the same framework? Are there specific compiler or linker behaviors (e.g., deployment target, SDK version, module imports, or bitcode settings) that influence whether symbols from UniformTypeIdentifiers are treated as strong or weak? What is the recommended best practice to ensure consistent symbol referencing when using newer APIs like UTType, especially when supporting older OS versions? We aim to understand this behavior to guarantee stable operation across all supported iOS versions—avoiding both launch failures and runtime crashes caused by inconsistent symbol linking. Any insights or guidance from the community or Apple engineers would be greatly appreciated! Let me know if you'd like a shorter version or want to include additional build environment details (Xcode version, deployment target, etc.)!
1
0
78
1w
Git Integration needs serious work.
After committing and pushing code changes, the Repository Up Arrow remains. Not matter how many times you Refresh or Fetch..it only goes away when you shutdown Xcode and restart. .gitignore processing is a nightmare to correct. There should be a clearer way to remove/delete files from the repository and also synch with new .gitignore settings. But even the .gitignore file name is misleading. Please clean this up in the settings and/or IDE. It costs huge time to correct. Not seeing a difference between, Fetch Changes, Refresh, or Pull. The only indications of a code changes seems to occur with a Pull. Just not clear what is supposed to happen at the code level.
3
0
165
1w
Apple watch Xcode pairing & connection issues
I’m blocked debugging a watchOS app on a physical Apple Watch. The iPhone connects to Xcode normally (wired), but the Watch either fails to connect with a tunnel timeout or disappears entirely from Xcode after I unpaired it inside Devices & Simulators. Environment Mac: macOS 26.x (Apple Silicon Mac) Xcode: 26.2 iPhone: iOS 26.1 Apple Watch Ultra: watchOS 26.2 (build 23S303) Connection: iPhone connected to Mac via USB (trusted). Watch paired to iPhone and working normally in the Watch app. Issue A (when Watch is visible in Xcode) In Xcode → Window → Devices and Simulators, the Watch shows up but is not usable and fails to connect. Error: “Previous preparation error: A connection to this device could not be established.” “Timed out while attempting to establish tunnel using negotiated network parameters.” In some attempts the Watch shows “Capacity: Unknown” / limited details, and then fails during preparation. Issue B (after unpairing Watch in Xcode only) I unpaired/removed the Watch in Xcode (Devices & Simulators). I did not unpair the Watch from the iPhone. Now: iPhone appears in Xcode and works normally for builds. Watch is still paired to the iPhone and works normally. Watch no longer appears anywhere in Xcode Devices & Simulators (no paired watch section, no watch run destination). What I’ve tried Reboots of Mac, iPhone, Watch (multiple times) Watch unlocked, awake; iPhone unlocked and close to Watch Verified Watch is paired and connected in iPhone Watch app Developer Mode enabled on iPhone and Watch Wi-Fi and Bluetooth ON (Mac/iPhone/Watch), tried toggling both Tried on home Wi-Fi and also with iPhone hotspot (same result) Resetting trust prompts / reconnecting iPhone via USB, re-trusting Mac Apple Watch: “Clear Trusted Computers” Xcode: removing/re-adding devices; clearing derived data; restarting Xcode Watch Developer networking test: Responsiveness = Medium (430 RPM) Questions 1. Is this a known issue/regression with Xcode 26.2 + watchOS 26.2 tunneling (CoreDevice / devicectl)? 2. Is there an Apple-supported way to force Xcode to re-discover a paired Watch after it was removed from Xcode Devices & Simulators (without unpairing the Watch from the iPhone)? 3. Any recommended logs or diagnostic steps I should collect (Console logs, sysdiagnose, specific Xcode/CoreDevice logs) to include in a Feedback report? If helpful, I can provide the full error text from Xcode’s Devices window and any logs you recommend. Thank you in advance,
6
3
421
1w