Xcode 10.0 error: Couldn't IRGen expression, no additional error [duplicate] - ios

Using Xcode 10, when I stop my app using a breakpoint and try to print the content of an object in the Console, I obtain:
"Couldn't IRGen expression, no additional error"
However, I can see the value of the object in the Variables View panel.
How can I make it evaluate my expression instead?

In lldb as a workaround you can use:
fr v productVersion
fr v productBuild
since Xcode 10.2
v productVersion
v productBuild
which prints local variable type and address from current call stack frame.
Apple documentation for these kind of lldb capabilities: https://developer.apple.com/library/archive/documentation/General/Conceptual/lldb-guide/chapters/C5-Examining-The-Call-Stack.html
UPDATE:
Another trick that seems to help is to set

Thanks.
I solved with rebuild carthage framework like imtx.me/archives/2719.html
carthage update --platform iOS --no-use-binaries

I had defined as build system: "Legacy Build System", I changed it to "New Build System", then I build the project, and then I put it back as "Legacy Build System" and it worked again.
For to change the build mode: File->Workspace settings...->Build System

For my colleague, carthage update --platform iOS --no-use-binaries was working but it was not for me. When I removed the Carthage folder and reran the command, the po command started working 🎉. I'm not sure if it's related but I'm on macOS Catalina 10.15.3 and he is on Mojave. We both have Carthage version 0.34.0.

My env: Xcode 11.6 and Xcode 12 Beta 6, carthage 0.34.0
In my case, my company wants me to make build of our app out of Xcode 12 beta and see what's broken. I did it and encounter another bug that crippled the carthage. I fixed it by following this answer in the same thread.
Then I switched back to Xcode 11.6, the error started to appear
error: Couldn't IRGen expression, no additional error
The variable inspector works normally but debug console is useless without print or po. It took me some time to search in SO before I realized this might be related to carthage. Then I updated all my dependencies using the following command
carthage bootstrap --platform iOS --no-use-binaries --cache-builds
Then the debug resume normal and I can use print/po again

Related

Flutter build iOS got error: Requested but did not find extension point with identifier

I just upgraded to Xcode 13.3-beta, running a flutter project got this error:
Error output from Xcode build:
↳
2022-03-02 17:45:38.148 xcodebuild[62848:6695836] Requested but did not find extension point with identifier
Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in
com.apple.dt.IDEWatchSupportCore
2022-03-02 17:45:38.148 xcodebuild[62848:6695836] Requested but did not find extension point with identifier
Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of
plug-in com.apple.dt.IDEWatchSupportCore
** BUILD FAILED **
Now, I am confused, I am running a iOS app on simulator, why throughs out errors like watchOS?
And I totally don't know how to resolve this error.
Any one could help me?
OK, very weird but running xcrun multiple times seems to fix this. I had also updated to Xcode 13.3 recently.
xcrun -sdk iphoneos --show-sdk-path
The first time it shows the error. The second time it shows the right answer. I ran it with all three sdks, iphoneos, macosx, watchos and all showed the errors the first time. I also ran it with all five of the options for all three sdks:
xcrun -sdk iphoneos --show-sdk-path
xcrun -sdk iphoneos --show-sdk-version
xcrun -sdk iphoneos --show-sdk-build-version
xcrun -sdk iphoneos --show-sdk-platform-path
xcrun -sdk iphoneos --show-sdk-platform-version
The build error from xcodebuild went away after that, although I'm not certain which of the commands fixed it.
Fixed this by running.
xcrun -sdk macosx --show-sdk-path
This outputs your current skd path.
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk
Add this to your .zshrc file.
export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk
Source it
source ~/.zshrc
Now run
xcrun -sdk macosx --show-sdk-version
To avoid hard coding the version you can add this to your .profile:
export SDKROOT=$(xcrun -sdk macosx --show-sdk-path)
reload profile (source path to your profile) and run
xcrun -sdk macosx --show-sdk-version
to verify
Found solution:
Check for updates of Xcode in App Store (it should be updated
already, but just for confirmation)
Launch Xcode; it will ask you to install additional software. After installation finishes the errors will gone.
If it's a flutter project following step can be helpful:
Update MacOS
Update Xcode and command lines tools
Run flutter pub upgrade, flutter pub get in the project folder
Delete podfile.lock in ios folder of the project
Run cd ios, pod repo update, pod install in the project folder
This is problem from xcode when xcode select doesn't link with CommandLineTools
run below command for link it
// reset to the default command line tools path
xcode-select -r
// Link xcode-select with CommandLineTools
sudo xcode-select -s /Library/Developer/CommandLineTools
If that not working. Maybe problem from the keychain is not unlock.
You need to unlock that by
security unlock-keychain
Or with password
security unlock-keychain -p <password>
Hope this way can help you, thanks.
This issue is sadly with XCode 13.3.
This is pointed out by this answer - Stackoverflow Answer- Flutter for iOS run, build but not archive
The three solutions given were
Modify the code
Downgrade to Xcode 13.2.1
Wait for Apple to modify Xcode
For myself I use CodeMagic, and didn't have the luxury of downgrading my Archive. XCode could take months to update. So modifying the code was the only option. I was able to find this issue opened on March 15th 2022. Which eventually has this solution..
Open your Podfile and paste pod 'DKImagePickerController/PhotoGallery', :git => 'https://github.com/miguelpruivo/DKImagePickerController.git' as shown below:
`target 'Runner' do
use_frameworks!
use_modular_headers!
#Workaround for segmentation fault:11 while archiving
#Add the below line
pod 'DKImagePickerController/PhotoGallery', :git => 'https://github.com/miguelpruivo/DKImagePickerController.git'
flutter_install_all_ios_pods File.dirname(File.realpath(FILE))
end`
Yes I know your error said your errors were through WatchOS. However as I understand, this is an issue that occurs in version 13.3 of Xcode. In Xcode 13.3, if you have a code that uses UI_USER_INTERFACE_IDIOM(), you will get an "Out of Memory" error when you run Archive. Changing "UI_USER_INTERFACE_IDIOM()" to "UIDevice.current.userInterfaceIdiom" resolves the error. Commonly this issue occures with flutter pods using - DKImagePickerController/PhotoGallery.
I was able to fix this without touching anything Watch related. On top of this I made sure my flutter project had a minimum support level of 12, however that might be completely unrelated.
Ultimately downgrading is probably the solution. As well many of my links lead to other solutions if anyone is curious of the diving into it.
There is an error in file /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/Library/Xcode/PrivatePlugIns/IDEWatchSupportCore.ideplugin/Contents/Resources/IDEWatchSupportCore.xcplugindata
You should make its backup, then open it in plist editor and fully remove the following items:
Root/plug-in/extensions/Xcode.DebuggerFoundation.AppExtensionHosts.watchOS
Root/plug-in/extensions/Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS
A workaround that worked for me was to install the previous stable Xcode version 13.2.1 and build it from the IDE.
You can have multiple versions installed, so you don't have to change anything in your current setup.
https://xcodereleases.com/
Check if there is some update for Xcode.
xcode-select --install
If you get the message below from the command above, try:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
Also, you should check if there is a macOS update available.
Click on the Apple icon no top left > About this mac > Software update (for example, macOS Monterey 12.3)
I faced the same problem when updating the project with Flutter 3. After several attempts, the below solution worked for me.
I have deleted the podfile.lock file inside the ios folder and then run the below commands.
flutter pub upgrade
flutter pub get
cd ios
pod repo update > Actually, this was an error for me but ignored it
pod install
Also please make sure you are using the latest MacOS and Xcode.
I hope this will help someone else.
In my case, its React Native app, the problem was with cocoa pods.
Reinstalling pods helped. Run below in your project folder
rm -rf ios/Pods && npx pod-install
Okay, just found a solution which might sound super dumb but updating my Mac OS to Moterey 12.3 solved the issue with no change in the code required.
Got this as well when trying to run the app from Android Studio. Solved this by...
starting XCode,
open the Runner,
run the app from xcode,
stop the app in xcode,
...and then it worked fine to run the app without this error from Android Studio.
I had the same issue , and i could solve it by removing the image picker newer package manually from the package folder and set the image picker package version to image_picker: 0.8.4 , and this solved the issue , hope it can help , maybe if you can share all the error message then i can help you .
you can try install the latest xcode13.3
then you can try xcode-select --install to install the command tools
Run command sudo xcode-select -s /Applications/Xcode.app
Finally, I found solution, hope this helpul for you.
Change flutter channel from stable to master
code#kazus-MacBook-Air ios %flutter channel master
code#kazus-MacBook-Air ios %flutter channel
Flutter channels:
* master
beta
stable
Also experiencing the same issue, I tried #user1503606 and #MCCCS suggestion, sadly didn't work.
Looking at this answer, the issue stems from XCode 13.3 and as #y2ducky suggests, downgrading should solve the issue.
Solutions:
Downgrade to Xcode 13.2.1 (you can find older versions here https://developer.apple.com/download/all/ then expand it and move Xcode (Xcode.app) to Applications folder, which will replace your current Xcode 13.)
Wait for Apple to modify Xcode
Using xcode version "13.2.1" works for me. Seems like "13.3" is doing something differently
Here is another one that helped me to solve this issue. Go to About this mac -> storage and remove support watchOS in Xcode developer settings.
Works with xcode 13.3.1, Monterey intel:
downgrade flutter sdk to Flutter ->2.10.0 Dart ->2.16.0
which can be downloaded here:
https://docs.flutter.dev/development/tools/sdk/releases?tab=macos
change your valid sdk path in terminal with flutter --version
this includes for new projects.
running May 1, 2022
Restart of iPhone solved the problem for me.
I brought another solution.
I tried multiple solutions which mentioned in this question, but all failed.
So, I just tried from flutter starting project. It did build perfectly. After adding some libraries, the library starts to require more higher ios version.
I usually upgrade ios version by Podfile like this,
# Uncomment this line to define a global platform for your project
platform :ios, '12.0'
but, instead of that, I upgraded ios version with Runner.xcworkspace and ios/Flutter/AppframeworkInfo.plist according to this link.
https://docs.flutter.dev/deployment/ios#review-xcode-project-settings
and after that, I finally succeeded to build project.
This also could be a problem with your pubspec.lock file. Some version of libraries probably trying to use Watch Support. That was the my case. So, I fixed some libraries's versions and then it worked fine.
This solution worked for me
Try xcode-select --install
If command line developer tools were already installed try fixing it by
sudo xcode-select -r
After a couple of days of trying all the solutions on the internet. I finally ended up deleting the ios folder inside the project and creating it again using flutter .
then Open Terminal and go to the project and do the follwing.
pub get
cd ios
pod install
And you can run the app now.
It could be this:
Try turning off your Apple Watch. I know... I know. I ignored it for a long time, then dug into the logs, the error messages, researched, etc.
The device name format changes when building when there's a watch involved and can sometimes hang up the Flutter tools because - well, because they're garbage and don't take that into consideration.
I basically just can't use my Apple Watch when I'm building on Flutter (some times), like at all. I have to power it down completely.
After you get a successful build, you may or not be able to turn it back on and have the builds succeed. It's hit and miss.
I get this problem every few weeks, and 100% of the time, it's my Apple Watch being on, changing the build targets that Flutter reads, presumably through Xcode.
** shrug **
In my case it was as simple as a new location added to assets within pubspec.yaml
assets:
- assets/images/
- assets/images/icons # this line broke the whole project because of a missing /
What helped in my case was to run update Xcode CLI to the newest (version: 13.4.0.0.1.1651278267
) which was only displayed with --all --install --force:
softwareupdate --all --install --force

Xcode 12 error in installing app -Failed to get FD to bundle executable

My project is running fine in Xcode 11.3 but recently when I upgraded to Xcode 12 app is not getting installed in simulator and showing the error - Could not install at this time.
Failed to get FD to bundle executable....
I suddenly had the same problem, after years of work on the same project across several versions of Xcode and MacOS.
On Xcode 12.4 and MacOS 10.15.5, although everything was working fine, suddenly I got this error popup "Failed to get FD to bundle executable" while trying to Run the project on a(ny) Simulator.
I tried all the proposals I could find online, including changing the Executable Type (which had never changed) or clear the empty env vars defined in the Build settings (there weren't any). Uninstalling/reinstalling Xcode didn't help. Upgrading to MacOS 10.15.7 didn't either. Of course the Apple Support has been of no use at all (they replied with a few general FAQ links about how to use Simulator).
The only thing that worked for me was to checkout the project in a different folder...
The weird thing is, if I rename again my new folder to the initial folder name, it does the error again! It sounds to me like a MacOS bug and/or an Xcode bug.
Error running `xcrun simctl install 95F3A7B0-67B3-490E-B798-D1CBBF813B83 /Users/yakjuly/.expo/ios-simulator-app-cache/Exponent-2.21.3.tar.app`: An error was encountered processing the command (domain=IXUserPresentableErrorDomain, code=1):
Unable To Install “Expo Go”
Please try again later.
Failed to get FD to bundle executable at /Users/yakjuly/Library/Developer/CoreSimulator/Devices/95F3A7B0-67B3-490E-B798-D1CBBF813B83/data/Library/Caches/com.apple.mobile.installd.staging/temp.Nf39ZM/extracted/Exponent-2.21.3.tar.app/Expo Go
Underlying error (domain=MIInstallerErrorDomain, code=4):
Failed to get FD to bundle executable at /Users/yakjuly/Library/Developer/CoreSimulator/Devices/95F3A7B0-67B3-490E-B798-D1CBBF813B83/data/Library/Caches/com.apple.mobile.installd.staging/temp.Nf39ZM/extracted/Exponent-2.21.3.tar.app/Expo Go
I have this problem when I get started with react native.
The issue for me is the file in /Users/yakjuly/.expo/ios-simulator-app-cache/Exponent-2.21.3.tar.app is broken. After I delete this file and re-run the command. it succeeds installing app in iOS simulator.
What solved this for me was the following:
close emulator
clean project and build folder
Shortcut: Command+Shift+K
GUI: Menu Bar -> Product -> Clean/Clean Build Folder
restart emulator
Xcode 13.2.1
The following steps helped me -
1. Select simulator
2. Goto Device
3. Select -> Erase All Content and Settings...
Hopefully, now you will be able to install and run the app on your simulator.

Module compiled with Swift 4.0 cannot be imported in Swift 4.0.1

However I have recompiled the framework using the same Xcode and it still gives me this error.
Base SDK iOS 11.1 for both
Swift Language Version Swift 4.0 for both
Not using Pods/Carthage
I hope someone might know
Update:
For release versions of Xcode:
This error (and similar errors involving Swift 4.1, 4.2, etc.) will occur when opening a project with Xcode 9.1, 9.2, 9.3, 9.4, 10, etc. that uses frameworks that were built with earlier Xcode tools.
To fix the issue, update and rebuild your frameworks using Carthage ( carthage update --platform iOS), Cocoapods (pod update or pod install), or manually, with the new updated Xcode tools. The tools should be updated automatically when you update Xcode, but if not, you can follow the steps outlined below in the original answer.
You may also need to clean your project cmd + shift + k and possibly your build folder cmd + option + shift + k to get Xcode to not use cached framework builds.
In some cases you may also need to delete your derived data folder (Easily found by going to Xcode Preferences -> Locations -> Derived Data Folder
(Thanks Stunner)
For beta versions of Xcode:
See original answer below and then follow steps above.
Original Answer:
You probably still have your xcodebuild tools set to Xcode 9.0 which builds with Swift 4.0 and is incompatible with Xcode 9.1 beta's Swift 4.0.1.
Check in the terminal using the command:
xcodebuild -version
Or just go into Xcode preferences -> Locations and check/change the command line tools to Xcode 9.1. You should be set then.
My issue was due to an external framework not being compiled for Swift 4.0.2. I had added this file via Carthage, so running:
carthage update --platform iOS
And then cleaning the project cmd + shift + k and build folder cmd + option + shift + k and deleting the derived data folder (merely moving it to trash works as well) worked for me.
In my case, I downloaded xCode 11 Beta version to test SwiftUI. When i run my project, i got "Module compiled with Swift 5.1 cannot be imported by the Swift 5.0.1 compiler:..." error.
To do fix this issue. i changed xCode command line tool to new xCode 11 comment line tool. After that, you can create new xcode project with SwiftUI.
Xcode -> Preferences -> Location -> XCode command Line Tool
i hope, this will help someone who want to test with new freamework :)
Install Xcode Toolchain of specific Xcode version which was working for you from here.
An Xcode toolchain includes a copy of the compiler, lldb, and other related tools needed to provide a cohesive development experience for working in a specific version of Swift.
Open Xcode's Preferences, navigate to Components > Toolchains , and select the installed Swift toolchain.
This will let you compile and run the app for now.
I hit this issue with Xcode 10 beta, which adds Swift 4.2. My issue was unrelated to Carthage or any external dependencies.
Go to YourTarget > Build Settings > Swift Language Version for all of your Xcode targets.
Mine were all set to Swift 4.
After adding a Copy Files Build Phase, I started getting the error
:0: error: module compiled with Swift 4.1.2 cannot be imported by the Swift 4.2 compiler: /Users/user/Library/Developer/Xcode/DerivedData/MyApp-faskfrihumfcdibjxisjvbfshppp/Build/Intermediates.noindex/MyApp.build/Debug/MyAppExtension.build/Objects-normal/x86_64/MyClass~partial.swiftmodule
Command MergeSwiftModule failed with a nonzero exit code
I then set each target's Swift Language Version to Swift 4.2, which eliminated the error.
I'm not sure why the error was occuring in the first place, though, as having all targets set to Swift 4 should be equally as valid.
In my case (Xcode 9.2):
I went to Xcode Preferences > Locations > Derived Data
I then deleted the data and did a clean build and was ok.
In my case, I used CocoaPods with plugin cocoapods-binary to prebuild libraries to binaries. After I upgrade Xcode from 10 to 11, Xcode gives me this error:
Module compiled with Swift 5.0.1 cannot be imported by the Swift 5.1 compiler
I fix it by removing the /Pods directory and running pod install.
In my case, I re-compiled the framework with whatever version it was complaining about.
To recompile, run pod update or update the carthage (which ever one you're using), and build the project.
Then search for the framework in finder. Copy-paste the theFramework.framework to your project and make sure to "Copy items if needed."Build the project again and it should work.

xcrun: error: unable to find utility "PackageApplication", not a developer tool or in PATH - Since updating Xcode

Updated Xcode this morning and now ionic project wont deploy to a device.
ionic run ios --device
Returns:
** BUILD SUCCEEDED **
xcrun: error: unable to find utility "PackageApplication", not a developer tool or in PATH
Error: Error code 72 for command: xcrun with args: -sdk,iphoneos,PackageApplication,-v
No idea what to do to fix, Googling returns lots of options but none correct.
Cordova is trying to use "PackageApplication" tool. But it was removed since Xcode 8.3. Either downgrade Xcode or wait for Cordova to have a fix for that.
Linked in the Jenkins issue that matson kepson mentioned here there was a guy who attempted a PR to fix the issue. There was some unfinished change requests in his PR and I also found a few null ptrs in his changes. I forked his pr and fixed these things here and there is now a snapshot linked here that you can download and become unblocked until such a change is merged into the full build.
Hi its official Bug from jenkins
here you have a fresh status
https://issues.jenkins-ci.org/browse/JENKINS-43163
Little bit clearer to look at this:
http://subathrathanabalan.com/2016/01/07/building-ipa-export-archive/
I've just come across this and my solution was to remove the iOS platform from the project:
ionic platform rm ios
Then add it back in again
ionic platform add ios
I needed to run an initial build for it to fail with no signing set, so opening up the project in Xcode to just fix that. After that, building via the ionic cli worked as expected. I am guessing that re-adding the platform pulled in a new version of cordova-ios.
Update: I had only started on this project and created the base project from the blank template. I have Xcode 8.3.1 installed and using Ionic 3 (still with the --v2 switch with ionic cli).
I used shenzhen this automatic procedure encountered a similar problem, and finally in accordance with the github Pull Request to solve my problem, hope for your reference!
https://github.com/nomad/shenzhen/pull/347
I found a workaround to solve this using command line, with device connected on your mac:
ionic build ios --device
ios-deploy --noninteractive --debug --bundle build/device/YOURAPP.app
After this, stop debug using Ctrl C, and your app will be working on your device.
Hope work for you guys.
The is caused by the deprecated PackageApplication. If you're using the remotebuild tool to run from Windows, it will be solved when the remotebuild bug has been fixed: https://github.com/Microsoft/remotebuild/issues/26
Another solution is to downgrade XCode.
Here if the explanation on how to uninstall current XCode.
And here you can download XCode 8.2.
An option is open a .xcodeproj file located at platforms/ios and run the project directly from Xcode.

Swift does not support the SDK 'iPhoneSimulator9.3.sdk'?

I have just installed the xcode 8.0 and upgrade my project to swift 3. I was using swift 2.2 and xcode 7.3.1.
But getting following error:
Swift does not support the SDK 'iPhoneSimulator9.3.sdk'
Command
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc
failed with exit code 1
This happened to me when I had simultaneously installed both Xcode 7 and 7.3 and after automatic update I was left with 8.0 only.
One indication that something got messed up was output of xcodebuild -sdk -version in terminal:
DVTSDK: Warning: SDK path collision for path '<DVTFilePath:0x7fd810db4c50:'/Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS3.0.sdk'>': SDK with name 'watchos3.0' being superceded by SDK with 'watchos3.0'.
Solution:
Quit Xcode
go to /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
remove the iPhoneOS9.3.sdk folder from that directory. Be sure to make an external copy if you still need it so you can put it back later.
restart Xcode, clean, and build
???
PROFIT
UPDATE:
According to #tsafrir comment, delete also 'iPhoneOS9.3.sdk' for simulator folder:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhon‌​eSimulator.platform/‌​Developer/SDKs
The iPhoneOS9.3.sdk for the simulator is at Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs.
quit xcode
delete
clean
build again.
Not the best solution, but selecting - "Use Legacy Compiler Version": Yes, removed that warning for me.
It happen due to old xcode still in system and you updated new one.
For fixing this use following step.
Quit Xcode
go to
Simulator and iPhoneOS. platform
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
3. remove the iPhoneOS9.x.sdk folder from that directory. Be sure to
make an external copy if you still need it so you can put it back
later.
Copy old xcode sdk (iPhoneOS9.x(Updated SDK))
Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/ iPhoneOS9.3(Updated SDK)
5> Paste this SDK in new XCODE 8 in this folder
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
6> Clean and Build.
Fixed
Open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs

Resources