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

Xcode Documentation

Post

Replies

Boosts

Views

Activity

How to localize permission description string?
What's the problem? My app requests location access and for that I need to provide a description for the user to read so that it is clear why we need this permission. I'm using the latest solution suggested by XCode for my app localization which is using Localizable.xcstrings file. But for the permission description, I'm adding the text to Targets -> Info -> Custom iOS Target Properties -> "Privacy - Location Always and When In Use Usage Description". I understand that the default language is English in this list so I provided it, but now I want this description to be translated to other languages so that my users can read it in their preferred language. What I have tried so far? I tried adding translation to the keys "INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription" and "NSLocationAlwaysAndWhenInUseUsageDescription" in my "Localizable.xcstrings" but it is always showing the description in English
2
0
119
1w
Debug Memory Graph does not show memory leaks.
Here is a modified code from the documentation example https://www.swift.org/documentation/server/guides/memory-leaks-and-usage.html#troubleshooting : class ViewController: UIViewController { var closure: () -> Void = { () } public func doNothing() {} public func doSomethingThatLeaks() { self.closure = { // This will leak as it'll create a permanent reference cycle: // // self -> self.closure -> self self.doNothing() } } override func viewDidLoad() { super.viewDidLoad() // Memory leak example: doSomethingThatLeaks() // Abandoned memory example: // NotificationCenter.default.addObserver(forName: .init("Abandoned"), object: nil, queue: nil) { _ in // print("\(self)") // } } deinit { print(#function, Self.self) } } If you place it, for example, in a navigation controller, do a push-pop several times, deinit will not be printed. But if you look in the Debug Memory Graph, it will not even show that there is a strong reference to this controller: Only if you manually select: You can see that it is held by the closure context, which it holds: This is definitely not abandoned memory (like the commented piece of the code example), but it is not shown either in the Debug Memory Graph or in Instruments Leaks. Why?
0
0
100
1w
Hi, I have an issue with app preview
I can't seem to access preview for any of my views in any of my swift projects at all (using Mac to code and using iPhone 16 pro as preview and simulation, simulation can work), even after restarting Mac and Xcode itself. The preview section has a popup saying "Cannot preview in this file, unexpected error occured" (for every file), please tell me what is wrong and help me solve it to see the preview, thank you! details
1
0
146
1w
Un-Wanted Edit Menu Items
Xcode is adding un-wanted menu items to the Edit menu in a Mac Application. There is an automatically generated separator bar and an AutoFill menu item with two sub-menu items. Looking at the source code I see that two other items were suppressed in the initialize method of the AppController like this: NSMutableDictionary *defaultValues = [NSMutableDictionary dictionary]; //Get rid of Special characters menu item in edit menu: [defaultValues setObject: [NSNumber numberWithBool: YES] forKey: @"NSDisabledCharacterPaletteMenuItem"]; //Get rid of Start Dictation... menu item in edit menu: [defaultValues setObject: [NSNumber numberWithBool: YES] forKey: @"NSDisabledDictationMenuItem"]; [[NSUserDefaults standardUserDefaults] registerDefaults: defaultValues]; I guessed that there would also be a key like this: @"NSDisabledAutoFillMenuItem" but adding this to the code does nothing so apparently not. I searched programming forums and posters say that you can fix this by changing the name of the Edit menu to something like (space)Edit but this doesn't work. I searcher the Developer documentation and the Archives extensively for info about these keys but of course found nothing. Control-clicking on these pops up a menu of ways to search for these but none of them find anything. Control, option and command clicking on these keys results in ”?”. I can probably get a pointer to the menu and use NSMenu’s methods to delete these but something like the above would be better. Is there any documentation about this anywhere?
1
0
113
1w
XCUITest Screen Recording
In WWDC23: Fix failures faster with Xcode test reports, the presenter showed off an Xcode feature called Automation Explorer, that allows playback of a screen recording corresponding to an XCUITest. For the life of me, I have not been able to find out how to enable/use this feature in Xcode 16. I am using Test Plans and have set the UI Testing configuration settings for Automatic Screen Capture to On, and keep all and Preferred Capture Format to Video, but am not seeing any screen recordings being produced after running the tests. Am I doing something wrong?
1
0
156
1w
App alternative icon not working when archieve.
I add the following info in the build settings of my app. Then I also add the icon to my asset. I build the app, it works normally, but I notice that when I changed the icon to 'AppIcon-Defaults', The icon change alert didn't appear. but it succeeds . I uploaded the archive to App Store I got: ITMS-90895: Missing Icon - The Info.plist key CFBundleIcons.CFBundleAlternateIcons contains an entry “AppIcon-Defaults” that references asset “AppIcon-Defaults.” No such asset is present in the asset catalog. Then I use xcrun --sdk iphoneos assetutil --info Assets.car to check the assets inside the archieved app, It have the asset.
1
0
119
1w
Persistent Xcode validation errors
We recently updated the codebase of our existing iOS application to improve compatibility with the latest versions of iOS. For several months, our attempts to deploy the updated application to TestFlight for testing and validation have consistently failed due to four recurring Xcode validation errors. Please see the attached document "X-Code Validation Errors.txt" for details on these errors. <see: XCode Validation Errors (forum).txt> Our application is developed using Visual Studio 2022 for PC with the .NET MAUI framework, as Microsoft no longer supports Visual Studio for Mac. After a successful build and testing using a virtual iPhone interface, Visual Studio connects remotely to the MacBook (Mac OS 15.1) sending the necessary project files that automatically triggers the Xcode (16.1) validation to begin. We have made numerous edits to both the plist.info and the project file in an attempt to resolve the validation errors with little to no success. We are confident that is a configuration mismatch between what the plist says and the structure of the project itself. We are hoping that someone here in the developer group has some answers for us. Our team is relatively new iOS development and have spent hours trying to resolve this issue. What are we doing wrong and what specifically do we need to change to correct these errors so that we can finally get this project into TestFlight? I have attached copies of our plist.info, project structure, and error messages. Please help XCode Validation Errors (forum).txt Info.plist
2
0
128
1w
ERROR: "Failed to build the scheme (APP NAME)"
Hello, I'm kinda new to Xcode and I was trying to get back to programming while I follow a course. There seemed to be a problem with the preview and it looks like there was nothing wrong with the code, at least from what I know. I can say this because the code is the default one that Xcode gives you when you start a new project. here is the error log. == PREVIEW UPDATE ERROR: SchemeBuildError: Failed to build the scheme “App” linker command failed with exit code 1 (use -v to see invocation) Link App.debug.dylib (arm64): Undefined symbols for architecture arm64: "_main", referenced from: ___debug_main_executable_dylib_entry_point in command-line-aliases-file ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) == PREVIEW UPDATE ERROR: SchemeBuildError: Failed to build the scheme “App” linker command failed with exit code 1 (use -v to see invocation) Link App.debug.dylib (arm64): Undefined symbols for architecture arm64: "_main", referenced from: ___debug_main_executable_dylib_entry_point in command-line-aliases-file ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
1
0
146
1w
Seeking advice on building a multiplatform PDF viewer app
Hi everyone, I’m planning to develop a cross-platform PDF viewer app for iOS and macOS that will read PDFs from local storage and cloud services (Google Drive, iCloud, WorkDrive, etc.). The app should be read-only and display both the PDF content and its metadata (author, title, creation date, etc.). Key Features: View PDFs: Local and remote (cloud storage integration). Display metadata: Title, author, page count, etc. Cloud integration: Google Drive, iCloud, Zoho WorkDrive, etc. Read-only mode: No editing features, just viewing. Questions: Xcode Template: Should I use the Document App or Generic App template for this? PDF Metadata: Any built-in libraries for extracting PDF metadata in a read-only app? Performance: Any advice or documentation on handling large PDFs or cloud fetching efficiently? Thanks in advance for any advice or resources!
0
0
104
1w
Application failed to be exported as an app
Hi! We use to have several workspaces for our SDKs, one of them containing a test application. Everything worked fine. We decided to "merge" all SDKs in one workspace. I create a new workspace, added all SDKs and application inside and made all the required changes. Everything's good, we can generate our XCFramework and run the test application on the simulator. But when I archive the application, it is now exported in an "Other" section of the organizer instead of the original app (bundles identifiers are the same, already checked). I compared with FileMerge the xcproject files from before and after the merge, there is no significant difference between the 2. I compared also the xcarchive folders, and it seems that the archive is now missing the ApplicationProperties key inside. If I add it manually, I can now generate an ipa or send it to testflight. I checked with ChatGPT (just in case), but everything it asked me to check was fine (bundle ids, bundle versions and build number, Bundle os type in info.plist, custom xcconfig (same issue without them)). I'm pretty stuck here :-/ Thanks for your help
5
0
129
1w
NSMuatableAttributedString's appendString method only exist in iPhone-device build in iOS18, and not exist in Simulator-build
I have defined a method appendString method in a NSMuatableAttributedString category like this: @implementation NSMutableAttributedString (HTML) // appends a plain string extending the attributes at this position - (void)appendString:(NSString *)string { NSParameterAssert(string); NSUInteger length = [self length]; ... And this method is worked well in iOS17 and before . But when it cames iOS18 . this appendString will not be called. So I doubt maybe there is a system-defined appendString already. So I write a demo in empty project to print all the NSMuatableAttributedString method in iOS18 like these: @interface ViewController () @end @implementation ViewController void printNSStringCategories() { unsigned int count; Class nsStringClass = [NSMutableAttributedString class]; // 获取所有的方法 Method *methods = class_copyMethodList(nsStringClass, &count); for (unsigned int i = 0; i < count; i++) { SEL selector = method_getName(methods[i]); NSString *methodName = NSStringFromSelector(selector); NSLog(@"NSMutableAttributedString method: %@", methodName); } free(methods); } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. printNSStringCategories(); } And test it in my iPhone (iOS18.2) , the log will printed NSMutableAttributedString method: appendString:withAttributes: NSMutableAttributedString method: cr_appendStorage:fromRange: NSMutableAttributedString method: cr_appendString: NSMutableAttributedString method: appendString:withAttributes: NSMutableAttributedString method: appendString: So it seems a appendString: is aleady defined in system SDK . But the weird thing is when I run this code in the Xcode simulator (iOS18.1) this appendString: will not print . 1 Is it a bug of SDK ? because the appendString: only exist in device-build , and not exist in simulator-build? two more furthur question: 2.1 if the SDK contains appendString: already , why the appendString: defined in my category not cause the duplicate symbol error when compile 2.2 As the question 2.1 said , there maybe same symbols in runtime . Is there any way to find the framework/library which defined those same-name symbols ? (e.g: there are two appendString:withAttributes: in the log , I want to find the two places define each appendString:withAttributes: exactly)
1
0
138
1w
Xcode Install: Predictive Code Completion Model Failed
Does anyone know a workaround for this issue during downloads? Predictive Code Completion Model Failed -- There was an error processing the asset. I have tried installing the latest Xcode 16.1 and 16.2beta2, and both fail the same way. It has not been resolved for 2 days, so I don't think it is temporary server issue. I also tried 2 different network providers and a hotspot as related posts with different details mentioned. Details: The operation couldn’t be completed. (IDELanguageModelKit.IDEModelDownloadAdapter.(unknown context at $13003dd20).DownloadError error 3.) The operation couldn’t be completed. (IDELanguageModelKit.IDEModelDownloadAdapter.(unknown context at $1101b5d90).DownloadError error 3.) FB15799470 FB15801257
3
0
201
1w
Xcode16 missing dSYM in Firebase
The problem is that when building the application with Debug mode on Xcode 16.1, the dSYM files fail to upload to Crashlytics. It worked in latest Xcode 15 version. The workaround is to disable Debug Dylib Support in the target's Build Settings. However, this causes SwiftUI previews to stop working. Reproducing the issue Set ENABLE_DEBUG_DYLIB=YES for build options Build the application in Xcode 16.1 Firebase SDK Version 11.4.0 Xcode Version 16.1 Installation Method Swift Package Manager Firebase Version 11.5.0 Relevant Log Output warning: (arm64) /Users/dustin/Library/Developer/Xcode/DerivedData/MyAppName-cicejndcecececfe/Build/Products/Debug-iphonesimulator/MyAppName.app/ MyAppName empty dSYM file detected, dSYM was created with an executable with no debug info. The warning seems like is from XCode/lldb compiler rather than Crashlytics (https://lldb.llvm.org/cpp_reference/SymbolFileDWARF_8cpp_source.html line655). This is probably something on Apple side, Crashlytics only consumes dSYM which is generated from Xcode. (ref:https://github.com/firebase/firebase-ios-sdk/issues/14054#issuecomment-2477235548) This is related to: Firebase Issue
0
2
342
1w
compilation error in CoreFoundation - visionos
when trying to build wireshark I'm getting the following, any idea how to solve it? [ 13%] Building C object wsutil/CMakeFiles/wsutil.dir/os_version_info.c.o In file included from wireshark/wsutil/os_version_info.c:23: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:54: /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:676:195: error: expected ',' 676 | void *CFAllocatorAllocateTyped(CFAllocatorRef allocator, CFIndex size, CFAllocatorTypeID descriptor, CFOptionFlags hint) API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0), visionos(2.0)); | ^ /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:679:211: error: expected ',' 679 | void *CFAllocatorReallocateTyped(CFAllocatorRef allocator, void *ptr, CFIndex newsize, CFAllocatorTypeID descriptor, CFOptionFlags hint) API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0), visionos(2.0)); | ^ /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:682:165: error: expected ',' 682 | void *CFAllocatorAllocateBytes(CFAllocatorRef allocator, CFIndex size, CFOptionFlags hint) API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0), visionos(2.0)); | ^ /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:685:181: error: expected ',' 685 | void *CFAllocatorReallocateBytes(CFAllocatorRef allocator, void *ptr, CFIndex newsize, CFOptionFlags hint) API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0), visionos(2.0)); | ^ In file included from wireshark/wsutil/os_version_info.c:23: In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:73: /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNumberFormatter.h:144:147: error: expected ',' 144 | CF_EXPORT const CFNumberFormatterKey kCFNumberFormatterMinGroupingDigits API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0), visionos(2.0)); // CFNumber | ^ 5 errors generated. make[2]: *** [wsutil/CMakeFiles/wsutil.dir/os_version_info.c.o] Error 1 make[1]: *** [wsutil/CMakeFiles/wsutil.dir/all] Error 2 make: *** [all] Error 2
1
0
113
1w
General compatibility between Xcode and macOS
I'm confused by documentation and information I found regarding compatibility between versions of Xcode and macOS. The site https://developer.apple.com/support/xcode/ is listing "Minimum OS required". To my understanding it means "this particular version of macOS and all later/newer versions". Also release notes for Xcode are consistently stating "Xcode xx.x. requires a Mac running macOS yy.yy.y or later." But I also found statements like " In general, new versions of macOS will not run old versions of Xcode." in this forum, see https://forums.developer.apple.com/forums/thread/760737, which is the opposite to "requires macOS version X or later". I'm also experiencing issues when trying to run Xcode 12.4 on macOS 14.5 (Sonoma), means XCode is not running. It would be great if some of Apple Engineers here would shed some light on it :-) Many thanks in advance! Cheers, Elena
5
0
192
1w
dyld[1472]: Symbol not found:
dyld[1472]: Symbol not found: __ZN5swift34swift50override_conformsToProtocolEPKNS_14TargetMetadataINS_9InProcessEEEPKNS_24TargetProtocolDescriptorIS1_EEPFPKNS_18TargetWitnessTableIS1_EES4_S8_E Referenced from: <821B1759-9915-33D1-B140-D718775DFA97> /private/var/containers/Bundle/Application/EE9AE8CE-9635-4A97-AFC2-F577B888FA5A/FoxyApp.app/Frameworks/PayUUPICoreKit.framework/PayUUPICoreKit Expected in: <7D840427-6CBD-37E8-8C87-3445FFF34AE7> /private/var/containers/Bundle/Application/EE9AE8CE-9635-4A97-AFC2-F577B888FA5A/FoxyApp.app/Frameworks/Starscream.framework/Starscream app is installed on mobile but it crashes when i try to open it
0
0
71
1w
Can someone help me fix my xcode.
This is for a profile page for the app I am building. let updatedUser = User( coder: <#NSCoder#>, id: userId, name: name, email: email, phoneNumber: phoneNumber, profilePictureURL: nil, bio: bio ) Error code by line 1: Extra arguments at positions #2, #3, #4, #5, #6, #7 in call Error code by profile picture: 'nil' requires a contextual type This error at the bottom of the code: Expected '}' in struct Can someone please help me?
6
0
147
1w