macCatalyst app builds but won't launch on Mac - swiftui

I am designing a swiftUi app which runs seamlessly on iOS 14 simulators and devices, but fails to launch on the Mac (10.15.7).
The app builds without issues, then I have this in the console:
dyld: Symbol not found: _$s7SwiftUI20_ValueActionModifierVMn
Referenced from: /Users/me/Library/Developer/Xcode/DerivedData/myapp-gzynpflipftikkauzulvrrrxaniv/Build/Products/Debug-maccatalyst/myapp.app/Contents/MacOS/myapp (which was built for Mac OS X 14.0)
Expected in: /System/iOSSupport/System/Library/Frameworks/SwiftUI.framework/Versions/A/SwiftUI
in /Users/me/Library/Developer/Xcode/DerivedData/myapp-gzynpflipftikkauzulvrrrxaniv/Build/Products/Debug-maccatalyst/myapp.app/Contents/MacOS/myapp
(lldb)
Any idea of what this refers to?
Thanx!

Related

Electron.js C++ Addon: DYLD, [0x4] Symbol missing on older macOS devices

I am writing C++ addons for an Electron.JS application which calls macOS native APIs. Some of the API calls are introduced in the newer versions of macOS: (say an API call that is introduced in macOS 12).
But I want my application to work for the older versions of macOS so I wrapped the code that uses the API in an if block such if (#available(macOS 12, *)) { ...}.
In the electron app, when node js loads the addon, it crashes on the older versions of macOS telling that the API symbol is missing:
Termination Reason: DYLD, [0x4] Symbol missing
Dyld Error Message:
Symbol not found: ---API method---
Referenced from: /var/folders/*/.com.mobeus.mobeglass.LMWnli
Expected in: flat namespace
Although I do not call the method but it crashes on dlopen when in Javascript I call const addon = require('addon')
I know that there are lazy and immediate ways of resolving symbols for the shared library but I am not sure how to set it from the Electron (or NodeJS) application and whether it will solve my problem.

Xcode iOS target. Simulator crashes with message 'dyld: Library not loaded (...) required code signature missing'

I've got a SDL2 project, which runs fine for MacOS. But when I try to export to iOS the build is succesfull and then the simulator crashes with the following message:
dyld: Library not loaded: #rpath/libSDL2.dylib
Referenced from: /Users/martinjoselizondocolomes/Library/Developer/CoreSimulator/Devices/F0FC3BBB-4809-4E45-B6BA-3709A2E82987/data/Containers/Bundle/Application/DCAE530F-9AB5-4E23-AD51-0CBC8B58297D/my_sdl_ios_project.app/my_sdl_ios_project
Reason: no suitable image found. Did find:
/Users/martinjoselizondocolomes/Library/Developer/Xcode/DerivedData/my_sdl_ios_project-gupmbcbolzvwmdfiuqsguhjlxnxo/Build/Products/Debug-iphonesimulator/libSDL2.dylib: required code signature missing for '/Users/martinjoselizondocolomes/Library/Developer/Xcode/DerivedData/my_sdl_ios_project-gupmbcbolzvwmdfiuqsguhjlxnxo/Build/Products/Debug-iphonesimulator/libSDL2.dylib'
I've tried to use the SDL template and example projects that come up in the SDL XCode IOS folder with no luck. Always the same issue.

After upgrade to iOS13 beta 6/Xcode 11 beta 5: issue "dyld: Symbol not found: _$s7SwiftUI7BindingVyxGAA0C11ConvertibleAAMc"

After upgrading to iOS13 beta 6 using Xcode 11 beta 5 I receive this message when running on an iPhone SE device.
dyld: Symbol not found: _$s7SwiftUI7BindingVyxGAA0C11ConvertibleAAMc
Referenced from: /var/containers/Bundle/Application/3B128240-B05E-4C1C-A0E1-55D22683B49E/BleAdvApp.app/BleAdvApp
Expected in: /System/Library/Frameworks/SwiftUI.framework/SwiftUI
in /var/containers/Bundle/Application/3B128240-B05E-4C1C-A0E1-55D22683B49E/BleAdvApp.app/BleAdvApp
Using the simulator there's no such message, and it has been ok with iOS13 beta 5 on the device, tool
Compiling is fine, the message is shown at startup of the application on the iPhone with an
Thread 1: signal SIGABRT
Since there is no Xcode 11 beta 6, the Xcode is still running on beta 5 on MacOS Mojave 10.14.5 (18F132).
I created a simple SwiftUI example from scratch, that's working without any issue on the actual phone and the simulator.
What me also wonders is that there's no path /var/containers on my Mac at all?
Any idea on how to proceed?
With the update to Xcode 11 beta 6 and using iOS 13 beta 7 the issue does not appear anymore. I used the code posted in the links above.
SwiftUI APIs deprecated in previous betas are now removed. (52587863)
Several extensions to the Binding structure are removed. (51624798)
The Binding structure’s conditional conformance to the Collection protocol is removed. (51624798)
I believe the answer is this section of release notes. Binding’s removal from conforming to collection.
In a new project utilizing CoreData, crash does not occur. Any other project with dynamic data that is not CoreData, like a set or array crashes with this error.
I followed the migration guide from the notes to account for this removal, but crash still occurs on device. Simulator, previews, etc are all fine.

Xcode 11 beta Symbol not found [duplicate]

I've got a simple SwiftUI-based app I'm working on. I just have a dozen or so UI elements. When I try to launch on device, the app aborts with the following:
dyld: Symbol not found: _$s7SwiftUI9TextFieldVAA4ViewAAMc
Build/run environment:
Xcode 11.0 beta 2 (11M337n)
macOS Catalina 10.15 Beta (19A501i)
Device is iPhone XS Max running iOS 13.0 (17A5522f), which is beta 3.
I thought this was something specific to my project, so I created a new one from the template -- so here's how you can reproduce:
1. Open Xcode
2. File -> New -> Project
3. From the iOS tab, choose Single View App
4. Enter a Product Name, and make sure "Use SwiftUI" is checked.
5. Next, save the project
6. Build and run
Same issue. There's no additional error output other than the line above.
You cannot run an app compiled with Xcode beta 2, on a device with iOS13 beta 3. Upgrade your Xcode to beta 3 and all should be good.

How can I get past a "Library not loaded:" issue?

I started playing with the Kinect and I would like to use skeleton tracking using OpenNI.
Since my knowledge of c++ is limited, the easiest option is to use the ofxOpenNI addon for OpenFrameworks.
I've downloaded the addon, and successfully compiled the example, but the application can't load a dylib:
[Session started at 2011-02-24 11:46:27 +0000.]
dyld: Library not loaded: #executable_path/./../../../data/openni/lib/libnimCodecs.dylib
Referenced from: /Users/george/Downloads/FirefoxDownloads/of_preRelease_v0062_osx_FAT/apps/examples/NI_userIsolation_4/bin/emptyExampleDebug.app/Contents/MacOS/emptyExampleDebug
Reason: no suitable image found. Did find:
/Users/george/Downloads/FirefoxDownloads/of_preRelease_v0062_osx_FAT/apps/examples/NI_userIsolation_4/bin/emptyExampleDebug.app/Contents/MacOS/./../../../data/openni/lib/libnimCodecs.dylib: unknown required load command 0x80000022
/Users/george/Downloads/FirefoxDownloads/of_preRelease_v0062_osx_FAT/apps/examples/NI_userIsolation_4/bin/emptyExampleDebug.app/Contents/MacOS/./../../../data/openni/lib/libnimCodecs.dylib: unknown required load command 0x80000022
/usr/lib/libnimCodecs.dylib: unknown required load command 0x80000022
The Debugger has exited due to signal 5 (SIGTRAP).The Debugger has exited due to signal 5 (SIGTRAP).
I am using XCode on osx 10.5.8 with OpenFrameworks 062.
This was a bit of background, but I imagine the dylib problem is something general.
I have the requested dylib files in my project, and the path seems ok.
Any clues ?
Sounds like the libs, though present, aren't compatible with your system -- it finds them but can't load them.
And indeed, checking the README on the OpenNI github page, in the section "Release Notes", we find the following:
* MacOSX: Only OSX 10.6 (Snow Leopard) with an Intel based CPU is currently supported.
You have the source, obviously, but fixing this yourself would probably be quite a chore. Otherwise, you could wait and see if future releases add Leopard compatibility, or you could upgrade your OS.