Up until now, it was possible to check in build scripts via the ENABLE_PREVIEWS environment variable whether a build for a SwiftUI preview is being executed.
In addition, it was also possible to conditionally compile code for SwiftUI or exclude it from compilation using this variable.
This no longer works with Xcode 16 and the new SwiftUI Preview compilation!
There is still the option to switch to the old system with the "Use Legacy Previews Execution" setting, but as stated in the release notes, this option will be removed at some point.
Which brings us back to the old problem of not being able to exclude build scripts from preview builds and not being able to prevent certain code from being compiled / add special code for SwiftUI previews.
This is a terrible situation, especially for more complex projects in which precisely the points mentioned are important for the build process.
I seriously hope Apple provides us with another environment variable for SwiftUI preview builds that we can use.
Xcode
RSS for tagBuild, test, and submit your app using Xcode, Apple's integrated development environment.
Post
Replies
Boosts
Views
Activity
I'm trying to close the UIFontPickerViewController in a UI test by tapping the close button in the navigation bar. In a default iOS app, I embed the default storyboard view controller in a navigation view controller, then in code I open the font picker like this:
class ViewController: UIViewController, UIFontPickerViewControllerDelegate {
override func viewDidAppear(_ animated: Bool) {
let picker = UIFontPickerViewController(configuration: .init())
picker.delegate = self
self.present(picker, animated: true)
}
func fontPickerViewControllerDidPickFont(_ viewController: UIFontPickerViewController) {
}
}
And the UI test looks like this:
final class problemUITests: XCTestCase {
@MainActor
func testExample() throws {
let app = XCUIApplication()
app.launch()
sleep(2)
let button = app.navigationBars.element(boundBy: 1).buttons.element(boundBy: 0)
print(button.debugDescription)
XCTAssert(button.waitForExistence(timeout: 2))
button.tap()
}
}
When running the UI test, the XCTAssert always fails and the button.tap() also fails with an error message
Failed to tap "chiudi" Button: No matches found for Element at index 1 from input {(
NavigationBar
)}
"chiudi" means "close" in Italian, my macOS system language. It sounds to me like I correctly get the close button, but the messages Xcode prints make no sense to me.
It's particularly confusing given that the output of the print statement shows that the button is there, but somehow fails to be tapped:
Attributes: Button, 0x104f44660, {{701.0, 320.0}, {43.0, 44.0}}, label: 'chiudi'
Element subtree:
→Button, 0x104f44660, {{701.0, 320.0}, {43.0, 44.0}}, label: 'chiudi'
Image, 0x104f44780, {{709.0, 327.5}, {30.0, 30.0}}, identifier: 'UICloseButtonBackground'
Path to element:
→Application, 0x104f35940, pid: 29803, label: 'problem'
↳Window (Main), 0x104f376a0, {{0.0, 0.0}, {1032.0, 1376.0}}
↳Other, 0x104f42e10, {{0.0, 0.0}, {1032.0, 1376.0}}
↳Other, 0x104f43100, {{0.0, 0.0}, {1032.0, 1376.0}}
↳Other, 0x104f43220, {{0.0, 0.0}, {1032.0, 1376.0}}
↳Other, 0x104f43340, {{0.0, 0.0}, {1032.0, 1376.0}}
↳Other, 0x104f43460, {{0.0, 0.0}, {1032.0, 1376.0}}
↳Other, 0x104f43580, {{0.0, 0.0}, {1032.0, 1376.0}}
↳Other, 0x104f436a0, {{0.0, 0.0}, {1032.0, 1376.0}}
↳Other, 0x104f437c0, {{0.0, 0.0}, {1032.0, 1376.0}}
↳Other, 0x104f438e0, {{0.0, 0.0}, {1032.0, 1376.0}}
↳Other, 0x104f43a00, {{0.0, 0.0}, {1032.0, 1376.0}}
↳Other, 0x104f43b20, {{0.0, 0.0}, {1032.0, 1376.0}}
↳Other, 0x104f43c40, {{276.0, 314.0}, {480.0, 748.0}}
↳Other, 0x104f43e80, {{276.0, 314.0}, {480.0, 748.0}}
↳Other, 0x104f43fa0, {{276.0, 314.0}, {480.0, 748.0}}
↳Other, 0x104f440c0, {{276.0, 314.0}, {480.0, 748.0}}
↳Other, 0x104f441e0, {{276.0, 314.0}, {480.0, 748.0}}
↳Other, 0x104f44300, {{276.0, 314.0}, {480.0, 748.0}}
↳NavigationBar, 0x104f44420, {{276.0, 314.0}, {480.0, 108.0}}, identifier: 'Scegli font'
↳Button, 0x104f44660, {{701.0, 320.0}, {43.0, 44.0}}, label: 'chiudi'
Query chain:
→Find: Target Application 'org.desairem.problem'
Output: {
Application, 0x104f781b0, pid: 29803, label: 'problem'
}
↪︎Find: Descendants matching type NavigationBar
Output: {
NavigationBar, 0x10607c0d0, {{0.0, 24.0}, {1032.0, 50.0}}, identifier: 'UIFontPickerView'
NavigationBar, 0x10607dab0, {{276.0, 314.0}, {480.0, 108.0}}, identifier: 'Scegli font'
}
↪︎Find: Element at index 1
Output: {
NavigationBar, 0x1064693a0, {{276.0, 314.0}, {480.0, 108.0}}, identifier: 'Scegli font'
}
↪︎Find: Descendants matching type Button
Output: {
Button, 0x104f714a0, {{701.0, 320.0}, {43.0, 44.0}}, label: 'chiudi'
Button, 0x104f71800, {{711.0, 378.0}, {17.0, 22.0}}, identifier: 'Dictate', label: 'Avvia dettatura'
}
↪︎Find: Element at index 0
Output: {
Button, 0x104f5d5e0, {{701.0, 320.0}, {43.0, 44.0}}, label: 'chiudi'
}
Here's the error I'm getting:
Communication with Apple failed
Your team has no devices from which to generate a provisioning profile. Connect a device to use or manually add device IDs in Certificates, Identifiers & Profiles. https://developer.apple.com/account/
I've requested a certificate from certificate authority, added it to my developer account, downloaded the added certificate and added it to my machine yet I'm still getting the error above. How can I resolve this?
I understand that there are no delegate methods for this. But to determine a positive consent from user to Record Screen needs to be evaluated via block parameter.
When user denies the permission by mistake, and, if user tries again, the alert is not showing up. How do I reset the permission and throw the below alert again?
When converting some of our frameworks to universal frameworks (multiple target platforms), error messages appear in Xcode that we believe are incorrect:
Something like this: Umbrella header for module ‘TestFramework’ does not include header ‘iOS.h’
This post links to an example project which shows the behaviour (UmbrellaHeadersTest.zip).
See the included README.txt
Any suggestions on how to reliably eliminate these warnings would be greatly appreciated!
UmbrellaHeadersTest.zip
I have been unable to view individual reports for some time now. I can view crash reports and I can view the list of all the other report types (Disk Writes, Energy, Hangs, and Launches), but all individual reports (which would contain the backtrace etc.) show an error:
Failed to Download Energy Logs
An error occurred while downloading energy reports. Please provide a valid value.
This happens on macOS 14.7, macOS 15.0.1, Xcode 15.1, Xcode 15.3, Xcode 16.0, Xcode 16.1, and Xcode 16.2 beta 1, across 2 different Macs. Other people on my team can view the same reports.
I'm starting to think this is something to do with how my account is setup. I'm an admin on the App Store Connect account so I don't think it's a permissions issue.
I got sent a crash log from a user of my app. I followed the procedure that Apple specifies to symbolicate the crashlog, but that does not succeed (see https://developer.apple.com/documentation/xcode/adding-identifiable-symbol-names-to-a-crash-report#Symbolicate-the-crash-report-in-Xcode)
XCode complains that
"error: unable to locate main executable (arm64)"
The location of the main executable is given in the crashlog at a path that starts with /private/var/containers/Bundle/Application/ But the /private/var/containers directory on my system is empty.
I have tried to search my filesystem for the specific image that is mentioned in the crashlog, but it is nowhere to be found.
Because the image is not available, I cannot symbolicate the crashlog from the commandline using atos either.
The crashlog is from an iPhone running iOS 18.0.1, if that makes a difference.
Anybody knows how to resolve this?
I'm trying to debug a couple of crash reports for a Mac Catalyst app and seem to be unable to symbolicate my crash reports. In the Xcode Organizer, I see unsymbolicated lines for my app, despite having the original archive for the build in question. A search for the relevant dSYM (using the process from https://developer.apple.com/documentation/xcode/adding-identifiable-symbol-names-to-a-crash-report#Locate-a-dSYM-Using-Spotlight) yields no results.
Unlike iOS builds, the "Download dSYMs" button isn't present in the organizer, nor is the option to download dSYMs from App Store Connect. I assume this is because macOS apps don't use bitcode.
The app's Debug Information Format is set to DWARF with dSYM File.
Has anyone else run into this issue? Any ideas about how I can symbolicate the crash logs?
On Xcode when I try to build/run, I get 'React/RCTEventEmitter.h' file not found. The same works when I use yarn ios --simulator <>. I tried installing the latest version of Xcode, still same problem. I have Xcode 16.1 now.
Showing Recent Messages
ScanDependencies /Users/sunnalla/Library/Developer/Xcode/DerivedData/oceanmobileapp-fqewvpyrkyjkudecrdfhqvtadmcl/Build/Intermediates.noindex/PushNotificationIOS.build/Debug-iphonesimulator/RNCPushNotificationIOS.build/Objects-normal/arm64/RNCPushNotificationIOS.o /Users/sunnalla/Documents/Ocean/oma_obs_sub/src/node_modules/@react-native-community/push-notification-ios/ios/RNCPushNotificationIOS.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'RNCPushNotificationIOS' from project 'PushNotificationIOS')
cd /Users/sunnalla/Documents/Ocean/oma_obs_sub/src/node_modules/@react-native-community/push-notification-ios/ios
Using response file: /Users/sunnalla/Library/Developer/Xcode/DerivedData/oceanmobileapp-fqewvpyrkyjkudecrdfhqvtadmcl/Build/Intermediates.noindex/PushNotificationIOS.build/Debug-iphonesimulator/RNCPushNotificationIOS.build/Objects-normal/arm64/e6072d4f65d7061329687fe24e3d63a7-common-args.resp
builtin-ScanDependencies -o /Users/sunnalla/Library/Developer/Xcode/DerivedData/oceanmobileapp-fqewvpyrkyjkudecrdfhqvtadmcl/Build/Intermediates.noindex/PushNotificationIOS.build/Debug-iphonesimulator/RNCPushNotificationIOS.build/Objects-normal/arm64/RNCPushNotificationIOS.o.scan -- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -ivfsstatcache /Users/sunnalla/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphonesimulator18.1-22B74-3d93aac3a03ebac1dd8474c5def773dc.sdkstatcache -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -fno-color-diagnostics -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/Users/sunnalla/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wdocumentation -Wunreachable-code -Wno-implicit-atomic-properties -Werror\=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror\=objc-root-class -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -Wno-implicit-fallthrough -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -Wunguarded-availability -index-store-path /Users/sunnalla/Library/Developer/Xcode/DerivedData/oceanmobileapp-fqewvpyrkyjkudecrdfhqvtadmcl/Index.noindex/DataStore @/Users/sunnalla/Library/Developer/Xcode/DerivedData/oceanmobileapp-fqewvpyrkyjkudecrdfhqvtadmcl/Build/Intermediates.noindex/PushNotificationIOS.build/Debug-iphonesimulator/RNCPushNotificationIOS.build/Objects-normal/arm64/e6072d4f65d7061329687fe24e3d63a7-common-args.resp -MMD -MT dependencies -MF /Users/sunnalla/Library/Developer/Xcode/DerivedData/oceanmobileapp-fqewvpyrkyjkudecrdfhqvtadmcl/Build/Intermediates.noindex/PushNotificationIOS.build/Debug-iphonesimulator/RNCPushNotificationIOS.build/Objects-normal/arm64/RNCPushNotificationIOS.d --serialize-diagnostics /Users/sunnalla/Library/Developer/Xcode/DerivedData/oceanmobileapp-fqewvpyrkyjkudecrdfhqvtadmcl/Build/Intermediates.noindex/PushNotificationIOS.build/Debug-iphonesimulator/RNCPushNotificationIOS.build/Objects-normal/arm64/RNCPushNotificationIOS.dia -c /Users/sunnalla/Documents/Ocean/oma_obs_sub/src/node_modules/@react-native-community/push-notification-ios/ios/RNCPushNotificationIOS.m -o /Users/sunnalla/Library/Developer/Xcode/DerivedData/oceanmobileapp-fqewvpyrkyjkudecrdfhqvtadmcl/Build/Intermediates.noindex/PushNotificationIOS.build/Debug-iphonesimulator/RNCPushNotificationIOS.build/Objects-normal/arm64/RNCPushNotificationIOS.o -index-unit-output-path /PushNotificationIOS.build/Debug-iphonesimulator/RNCPushNotificationIOS.build/Objects-normal/arm64/RNCPushNotificationIOS.o
/Users/sunnalla/Documents/Ocean/oma_obs_sub/src/node_modules/@react-native-community/push-notification-ios/ios/RNCPushNotificationIOS.h:8:9: error: 'React/RCTEventEmitter.h' file not found (in target 'RNCPushNotificationIOS' from project 'PushNotificationIOS')
/Users/sunnalla/Documents/Ocean/oma_obs_sub/src/node_modules/@react-native-community/push-notification-ios/ios/RNCPushNotificationIOS.m:8:9: note: in file included from /Users/sunnalla/Documents/Ocean/oma_obs_sub/src/node_modules/@react-native-community/push-notification-ios/ios/RNCPushNotificationIOS.m:8:
/Users/sunnalla/Documents/Ocean/oma_obs_sub/src/node_modules/@react-native-community/push-notification-ios/ios/RNCPushNotificationIOS.h:8:9: 'React/RCTEventEmitter.h' file not found
Hi,
I have been building a MacCatalyst versions of an iOS app for years using a separate build that included a specific .entitlements file that excludes the com.apple.security.device.camera. Yet when I now build with Xcode 16.1 that entitlement is included.
I have double checked my signing entitlement for my MacCatalyst build it is configured properly. I have check my .entitlement file to ensusre com.apple.security.device.camera is not there. All is as it should be.
I have changed nothing, my build flow is the same.
App Store Review has prevented the Mac build to be release becuse the com.apple.security.device.camera is set.
What can I do to correct this?
We have a Mac mini running our CI with Xcode 16, and empty accounts seem to appear in it as time goes by. I haven't yet isolated which job(s) are triggering this, it slows builds down considerably, especially because any code-signing related task yields a ton of error messages like
IDEDistribution: Failed to log in with account "(null)" while checking for an App Store Connect account (Error Domain=DVTServicesAccountBasedSessionErrorDomain Code=0 "Unable to log in with account 'mobile-devs@sightcall.com'." UserInfo={NSLocalizedFailureReason=Unable to log in with account 'mobile-devs@sightcall.com'., NSLocalizedRecoverySuggestion=The login details for account 'mobile-devs@sightcall.com' were rejected., DVTDeveloperAccountErrorAccount=<DVTAppleIDBasedDeveloperAccount: 0x60000169c900; username='mobile-devs@sightcall.com'>, NSUnderlyingError=0x600001e71f50
This is obviously an Xcode bug, but has anyone found a work-around somehow ?
I am using the latest version of Xcode 16, and I have created a GPX file in my project. However, I am unable to see or select the file to simulate the GPS location. I have attempted to uninstall and reinstall Xcode completely, but the issue persists. Has anyone encountered a similar problem? How can I resolve this? Thank you.
Hello!
My app is crashing on iOS 12. On other versions (i.e. 15, 17), we could not reproduce it. The problem occurs every once in a while. It simply crashes after a few seconds using the App.
I got a crash report and will include in the post.
Looks like Language exception crash , but i could not narrow it down to the cause of the problem.
The crash happens under the "suggestd" name. Appreciate if someone can help.
suggestd-2024-10-24-134830.txt
Environment
Xcode: 16.1
Swift 6 and SwiftUI for macOS development
macOS Sequoia
I have an app for macOS, and that uses an interactive widget feature.
On macOS Sequoia, the widget does not display anything and widget intent doesn't work either. I tested it on macOS Sonoma and it totally works. I assume it's a macOS bug. The app has been working fine before Sequoia.
Even on Xcode, when I tried to run the widget preview, Failed to load widget. The operation couldn't be completed. (WidgetKit_Simulator.WidgetDocument.Error error 4.).
I could avoid the error by changing version and build numbers, but I still got The operation couldn't be completed. (CHSErrorDomain error 1103.)
How am I able to fix the issue? I wanna at least know if its a bug from the app or macOS Sequoia.
I am building an MPI C project in Xcode. In order to do run it, I had to:
Specify /path/to/mpiexec in Edit Scheme -> Run -> Info -> Executable, instead of the "default" one, say myprogram if my target is called myprogram.
Specify the following arguments in Edit Scheme -> Run -> Arguments -> Arguments Passed On Launch: -np 4, ${BUILT_PRODUCTS_DIR}/${EXECUTABLE_NAME}
This is clearly analogous to a mpiexec -np 4 a.out command launched on terminal.
The problem is, when I want to debug my application, the execution doesn't "stop" on the breakpoints.
I instantly thought that it is because of the check box Debug Executable in Edit Scheme -> Run -> Info -> Executable. Indeed (as I have just said), the Executable specified in there is mpiexec and not myprogram.
Thus, is there an option or some command I could set in Xcode to attach the lldb to myprogram?
When I airdrop my archived app to my device it runs perfectly. But when I try to share with colleagues using the manifest.plist in a website link, the app will not install (Even on the same device where the airdropped app did). I get "Unable to Install [app name]"
Any help with this will be appreciated.
Here is my manifest.plist:
`<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>https://www.scorcent.com</string>
</dict>
<dict>
<key>kind</key>
<string>display-image</string>
<key>url</key>
<string>https://www.scorcent.com/image_57x56.png</string>
</dict>
<dict>
<key>kind</key>
<string>full-size-image</string>
<key>url</key>
<string>https://www.scorcent.com/image_512x512.png</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>ScorCent</string>
<key>bundle-version</key>
<string>6.0</string>
<key>kind</key>
<string>software</string>
<key>platform-identifier</key>
<string>com.apple.platform.iphoneos</string>
<key>title</key>
<string>NO REGRETS</string>
</dict>
</dict>
</array>
</dict>
</plist>
`And here is my web url;
<a href=itms-services://?action=download-manifest&url=https://www.scorcent.com/manifest.plist" Install App
I successfully archived an app with Xcode 14.3.1. I air dropped it onto my iPhone 13. But when I tried to run the app by tapping the app icon the opening screen just flashes but does not allow to run the app. The same thing happens on my I pad. Any suggestions how to locate the reason for this behavior will be appreciated.
I am encountering multiple problems deploying an app using Xcode.
First, I could not install Xcode from the App Store. I tried multiple times, rebooting etc. Finally I found a link to download an xip file from the developer site and unzip it. That worked. It took 2 hours.
Now I'm trying to build my app. I get a message saying IOS 18.1 not installed. I try clicking on it an select Manage Run Destinations. It brings me to the Devices popup screen but I am unable to select anything. I tried setting up a Simulator as well. Still unable to select a desitiation.
So then I tried updating my IPAd to IOS 18.1 thinking that might help. Big mistake. First I got a message saying some library were incompatible. Now I have a message saying Unknown Error. Disconnect and reconnect cables which I have done multiple times. This of course includes multiple times of clicking trust this device, then entering device password, then entering the auth code. They don't make it easy.
I tried clicking the Get for IOS 18.1. I really don't want to update my machine to this. I'm actually using a friend's MAC. When I did this it tells me it requires 8gb and I don't have enough disk space. But I do have 20gb available.
So about 4 hours of trying and nothing works. Two hours to install Xcode, can't select a different destination, can't connect my IPAd anymore, can't download the update. Not even sure why the device or destination is necessary. It's not necessary to build the same app for Android.
I had similar issues with XCode in my initial attempts just to get the app signed until I figured out that I needed to have a device attached for the provisioning to work. That took days including trying to find a UDID from ITunes(???) and other wild goose chases. That makes no sense whatsoever. Now I can't even do that.
So I guess my question is/are:
Do I have a new buggy version of XCode and if so, how do I get a previous one?
How do I select a different destination?
How do I get past the IOS 18.1 requirement?
How do I download IOS 18.1 if that's what I decide to do?
How do I connect my IPad?
Can I go back to previous OS on IPad if 18.1 doesn't work with XCode?
How do I do certificate provisioning if I can't connect my IPad?
Other than that everything works great.
Hi everyone. I am trying to build an app that's capable of displaying a RTSP stream of my IP camera. I am building it with GStreamer and using a C Bridge Header so it's Swift compatible. I keep getting this error, and I can't figure out how to solve it. I've tried everything I can think of, and everything ChatGPT can think of (lol). Anyone any idea's? Sorry if this post falls in the wrong category. I didn't see any categories that my problem fits in, so I chose this one.
The LLDB RPC server has crashed. You may need to manually terminate your process. The crash log is located in ~/Library/Logs/DiagnosticReports and has a prefix 'lldb-rpc-server'. Please file a bug and attach the most recent crash log.