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)
Xcode
RSS for tagBuild, test, and submit your app using Xcode, Apple's integrated development environment.
Post
Replies
Boosts
Views
Activity
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
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
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
I regularly talk to developers debugging hard-to-reproduce problems. I have some general advice on that topic. I’ve posted this to DevForums before, and also sent similar info to folks who’ve opened a DTS incident, but I figured I should write it down properly.
If you have questions or comments, put them in a new thread here on DevForums. Put it in the Developer Tools & Services > General topic area and tag it with Debugging.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Using a Sysdiagnose Log to Debug a Hard-to-Reproduce Problem
Some problems are hard to reproduce in your office. These usually fall into one of two categories:
Environment specific — This is where some of your users can easily reproduce the problem, but you can’t reproduce it in your environment.
Intermittent — In this case the problem could affect any user, but it’s hard to predict when a given user will see the problem.
A key tool in debugging such problems is the sysdiagnose log. This post explains how to make this technology work for you.
IMPORTANT A sysdiagnose log might contain private information. If you ask a user to send you a log, make sure they understand the privacy impact of that. If you want to see how Apple handles this, run the sysdiagnose command on a fresh Mac and read through it’s initial prompt.
Sysdiagnose Logs
All Apple platforms can generate sysdiagnose logs. For instructions on how to do this, see our Bug Reporting > Profiles and Logs page.
The resulting log is a .tar.gz file. Unpacking that reveals a bunch of files. The most critical of these is system_logs.logarchive, which is a snapshot of the system log. For more information about the system log, including links to the documentation, see Your Friend the System Log.
This log snapshot includes many thousands of log entries (I just took a log snapshot on my Mac and it had 22.8 million log entries!). That can be rather daunting. To avoid chasing your tail, it pays to do some preparation.
Preparation
The goal here is to create a set of instructions that you can give to your user to capture an actionable sysdiagnose log. That takes some preparation.
To help orient yourself in the log, add log points to your code to highlight the problem. For example, if you’re trying to track down a keychain problem where SecItemCopyMatching intermittently fails with errSecMissingEntitlement ( -34018 ), add a log point like this:
import os.log
let log = Logger(subsystem: "com.example.waffle-varnish", category: "keychain")
func … {
let err = SecItemCopyMatching(…)
log.log("SecItemCopyMatching failed, err: \(err)")
}
When you look through a log, find this specific failure by searching for SecItemCopyMatching failed, err: -34018.
You might also add log points at the start and end of an operation, which helps establish a time range of interest.
Log points like this have a very low overhead and it’s fine to leave them enabled in your released product. However, in some cases you might want to make more extensive changes, creating a debug build specifically to help investigate your problem. Think about how you’re going to get that debug build to the affected users. You might, for example, set up a special TestFlight group for folks who’ve encountered this issue.
Go to Bug Reporting > Profiles and Logs and look for debug profiles that might help your investigation. For example, if you’re investigating a Network Extension issue, the VPN (Network Extension) debug profile will enable useful debug logging.
Now craft your instructions for your user. Include things like:
Your take on the privacy impact on this
Instructions on how to get the necessary build of your product
If there’s a debug profile, instructions on how to install that
Instructions on how to trigger the sysdiagnose log
And on how to send it to you
IMPORTANT Make sure to stress how important it is that the user triggers the sysdiagnose immediately after seeing the problem.
Finally, test your steps. Do an initial test in your office, to make sure that the log captures the info you need. Then do an end-to-end test with someone who’s about as technically savvy as your users, to make sure that your instructions make sense to Real People™.
Prompting for a Sysdiagnose Log
In some cases it might not be obvious to the user when to trigger a sysdiagnose log. Imagine you’re hunting the above-mentioned errSecMissingEntitlement error and it only crops up when your product is performing some task in the background. The user doesn’t see that failure, they’re not even running your app!, so they don’t know that action is required.
A good option here is to add code to actively monitor for the failure and post a local notification requesting that the user trigger a sysdiagnose log. Continuing the above example, you might write code like this:
func … {
let err = SecItemCopyMatching(…)
log.log("SecItemCopyMatching failed, err: \(err)")
if err == errSecMissingEntitlement {
… post a local notification …
}
}
Obviously this is quite intrusive so, depending on the market for your product, you might not want to deploy this to all users. Perhaps you can restrict it to your internal testers, or your external beta testers, or a particularly savvy set of customers.
You can use the applefeedback URL scheme to make it easy for users to run Feedback Assistant. For more info about that, see Developer > Bug Reporting.
Looking at the System Log
Once you have your sysdiagnose log, unpack it and open the system log snapshot (system_logs.logarchive) in Console. The hardest part is knowing where to start. That’s why adding your own log entries, as discussed in Preparation, is so important. A good general process is:
Search for log entries from your subsystem. An easy way to initiate that search is to paste the text subsystem:SSS, where SSS is your subsystem, into the Search field. Continuing the above example, find that log entry by pasting in subsystem:com.example.waffle-varnish.
Identify the log entry that indicates the problem and select it.
Then remove your search and work backwards through the log looking for system log entries related to your issue.
The relevant log entries might not be within the time range shown by Console. Customise that by selecting values from the Showing popup in the pane divider. Once you have a rough idea of the timeframe involved, select Custom from that popup to focus on that range.
If the log is showing stuff that’s not relevant to your problem, Console has some great facilities for filtering those out. For the details, choose Help > Console Help.
Talk to Apple
A key benefit of this approach is that, if your investigation suggests that this is a system bug, you can file a bug report and attach this sysdiagnose log to it. The setup described above is exactly the sort of info needed to analyse the bug.
Likewise, if you start a thread here on DevForums about your issue, your friendly neighbourhood DTS engineer will find that sysdiagnose log very handy.
Revision History
2024-11-14 Added a reference to the applefeedback URL scheme. Made other minor editorial changes.
2023-10-13 First posted.
Hello, I recently decided to start learning how to code for iOS. I don't have much coding experience but I still wanted to explore it for fun at least.
I downloaded Xcode on my Macbook, and opened a new iOS file after downloading iOS 18.1 so I could run the simulator/get a preview of my code.
Even though I only had the basic "Hello World!" that is auto-generated in my code, the preview would never show and sat at a loading screen for multiple hours, saying "Preparing (Automatic) iPhone Simulator" at the top.
There is probably a simple solution that I'm missing. I would appreciate any tips! Thanks.
I used to download and replace the app container when I was testing, essentially downloading the container from the live app, and restoring it into the test app in order to not affect the live app, but to test major changes on "live" data.
it seems the option for downloading and replacing in Xcode no longer works, I will sometimes get a container downloaded, other times it only part downloads. I can never seem to get it to replace. No errors, but it doesn't work on the new device.
It used to be that devices & simulators showed when it was downloading and replacing but it no longer does that.
Is there another way of doing this? Currently I'm having to take a backup of the live phone, restore on the test device, then delete all the unneeded apps, otherwise the restore takes ages, then backup the test device and restore every time I need to restart.
I have one project, it has one Swift (AppKit) App and one C++ dylib project, I don't have problem in build the dylib, but when build the UI App, there will be an error:
"ld: multiple errors: file cannot be open()ed, errno=2 path=/Users/steventang/Library/Developer/Xcode/DerivedData/doodle-girdwlxpmnbetjdldjvdgddoetub/Build/Intermediates.noindex/doodle.build/Debug/doodle.build/Objects-normal/arm64/AppDelegate.o in '/Users/steventang/Library/Developer/Xcode/DerivedData/doodle-girdwlxpmnbetjdldjvdgddoetub/Build/Intermediates.noindex/doodle.build/Debug/doodle.build/Objects-normal/arm64/AppDelegate.o'; file cannot be open()ed, errno=2 path=/Users/steventang/Library/Developer/Xcode/DerivedData/doodle-girdwlxpmnbetjdldjvdgddoetub/Build/Intermediates.noindex/doodle.build/Debug/doodle.build/Objects-normal/arm64/ViewController.o in '/Users/steventang/Library/Developer/Xcode/DerivedData/doodle-girdwlxpmnbetjdldjvdgddoetub/Build/Intermediates.noindex/doodle.build/Debug/doodle.build/Objects-normal/arm64/ViewController.o'; file cannot be open()ed, errno=2 path=/Users/steventang/Library/Developer/Xcode/DerivedData/doodle-girdwlxpmnbetjdldjvdgddoetub/Build/Intermediates.noindex/doodle.build/Debug/doodle.build/Objects-normal/arm64/GeneratedAssetSymbols.o in '/Users/steventang/Library/Developer/Xcode/DerivedData/doodle-girdwlxpmnbetjdldjvdgddoetub/Build/Intermediates.noindex/doodle.build/Debug/doodle.build/Objects-normal/arm64/GeneratedAssetSymbols.o'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)"
Clean project folder and rebuild - it won't fix
I tried remove the two Swift files and added it again- it won't fix
Delete DerivedData folder - it won't fix
I upgraded to Xcode 16.1 - also tried above, it won't fix
BUT: the project doesn't have any problem when build with Xcode 15
Hello! Recently, I noticed that my build isn’t including additional assets (icons). I tried using two different versions of Xcode (16.1 and 15.4) on separate Macs, but I’m getting the same result. Not all icons are being included in the build. However, I found that if I set my minimum deployment version to 14, all of the icons appear as expected.
Starting from target version 15 in Xcode, no additional icons are included. Is there any way to resolve this?
Hi everyone,
Since updating to Xcode 16.1 on macOS Sequoia 15.0.1, I’m having issues with my app not launching on my iOS device. The app finishes compiling in Xcode without any errors, but it never appears to launch on the device—it either gets stuck indefinitely or doesn’t show any progress on the device screen.
Details of the Issue:
Xcode shows that the app is launching, but there’s no progress on the device. Tried on multiple devices with the same result.
Troubleshooting Steps I’ve Tried:
Cleaned the build folder and deleted derived data.
Verified the deployment target matches the device’s iOS version.
Checked provisioning profiles and code signing settings.
Restarted both Xcode and my device.
Tried connecting over both USB and Wi-Fi.
Workaround Found:
Unpairing the device from Xcode, pairing it again, then turning off Wi-Fi on the device before building allows the app to launch successfully.
Has anyone else experienced this with Xcode 16.1? Any tips on a more permanent solution or other troubleshooting steps would be greatly appreciated. Thank you!
let videoURL = URL(fileURLWithPath: path ?? "")
let asset = AVURLAsset(url: videoURL, options: nil)
let imageGenerator = AVAssetImageGenerator(asset: asset)
imageGenerator.appliesPreferredTrackTransform = true
let time = CMTimeMultiplyByRatio(asset.duration, multiplier: 1, divisor: 2) // THIS LINE GIVES ISSUE: "'duration' was deprecated in iOS 16.0: Use load(.duration) instead". I CANNOT FIGURE OUT THE CORRECT SYNTAX FOR CHANGING asset.duration TO REPLACE WITH load(.duration). HELP WITH THE CORRECT SYNTAX WOULD BE HELPFUL.
Inquiry about Open Source Release of Xcode 15's ld Source Code
Dear Apple Developer Support Team,
I hope this email finds you well.
I am a developer with a keen interest in Apple's development toolchain. I noticed that Xcode 15 uses a new version of the linker (ld), and I'm particularly interested in its source code.
I would like to inquire about:
When will the source code for the ld linker used in Xcode 15 be made available as open source?
Your response would be greatly appreciated.
Thank you for your time and attention to this matter.
Best regards, Panghu
I recently compiled my macOS App with Swift 6 in Xcode 16 (was using Swift 5 previously) and noticed that AppKit Integration doesn't appear to be working as before. All my instances of NSHostingView which allow me to add a SwiftUI View to an AppKit NSWindow view controller no longer respond to mouse input anymore. All my NSHostingView instances display but refuse to accept any user interaction. Has anyone else noticed this and is there a workaround to get NSHostingView to once again be able to accept user/mouse events with Swift 6?
In Xcode 16, even if Objective-C is selected, the Navigator in the documentation viewer displays Swift information.
I don't know when this bug was introduced, but it's there in the last Xcode 16 betas at least.
I hope as many developers as possible submit this bug to Apple to get their attention.
P.S. Yes, I know there's Dash. For many years, Dash was a much better option than Xcode's built-in viewer. However, in version 5, the Dash developer introduced some unfortunate UI changes that made Xcode a better option to view the documentation in certain cases. Unfortunately, the Dash developer doesn't seem to be interested in user feedback anymore. He's been ignoring suggestions and user requests for years by now.
Hi,
Is it possible to manually create collapsable areas in Xcode when it doesn't show automatically , for example variables definition area in views ?
Kind Regards
Really stumped on this issue my team is seeing with the Xcode 16 Beta (both Xcode 16 version 6 and Xcode 16.1). Wondering if anyone was having a similar issue and if this is a bug or something configured incorrectly.
Basically, when I go to build settings and search for anything related to "Swift Compiler" nothing shows up. The only thing that appears with "Swift" in the title is under the User Defined keys (see attached)
As such, I'm unable to change the Swift version for the project and I'm stuck in Swift 6 language mode which we're not quite ready for yet.
This is only occurring on one of our targets. Our other app projects are behaving as expected. The project in question has the main target we build the project with and 2 support frameworks. The supporting frameworks are also working correctly. Its just the primary build target giving us fits.
Curious if anyone is seeing something similar or has suggestions. Thanks!
In "Create asset catalogs and sets" - https://help.apple.com/xcode/mac/current/#/dev10510b1f7 - I read this:
" Create an iOS or tvOS launch screen image set: Choose App Icons & Launch Images > New [OS] Launch Image from the Add button (+) or from the Editor > Add Assets menu. For an iOS app, you can also change the default launch screen source to an image set. "
But neither the Editor -> Add New Asset menu nor the Add button (+) menu contains an "App Icons & Launch Images" item. I can add that I use Xcode 16.1.
So again, the Xcode documentation is quite misleading and confusing!
My (real) question is if it is possible to give Xcode ONE launch image from which Xcode creates all necessary image sizes automatically? Or do we still need the apps and services that creates a bunch of launch images from ONE image?
Launchd won't run a daemon that calls setuid in Sonoma, but it will allow it in Sequoia and Monterey
We have a daemon (/Library/LaunchDaemons) that has been calling setuid (usr/include/unistd.h) for some time. Launchd allowed that until we started compiling using Xcode 16 (maybe even Xcode 15). But now we have to remove that call for launchd to allow the daemon to run. That's not really an issue to remove that call but it is very mysterious that it only fails in Sonoma. Works in Sequoia and Monterey. Why is that?
We found this after adding some logging to our daemon plist:
The application with bundle ID <redacted> is running setugid(), which is not allowed. Exiting.
We're actually calling setuid.
When attempting to fix an issue that is only happening on a specific iOS build I noticed that I am not able to install that specific build on my simulator. Is there any way to get specific iOS builds that are not available through Xcode?
Example: The bug I am trying to fix is only happening on 17.6.1 and 17.7.1. These specific builds are not available through Xcode.
Attempted Resolution: I found a iPhone14,5_17.6.1_21G101_Restore.ipsw file but was not able to import it into Xcode for use nor was I able to use it on a physical device.
In several places on https://developer.apple.com/documentation/xcode/configuring-your-app-icon I read:
"In the Project navigator, select an asset catalog."
But my Project Navigator does NOT contain any "asset catalog". So it's impossible to follow the instructions of the documentation, and thus specify a new app icon (set).
I can add that I use Xcode 16.1 on MacOS 15.0.1 Sequoia.
I have added a screen shot to document what I am saying.
I have also reported this error in https://feedbackassistant.apple.com/feedback/15738182