Friday, September 8, 2023
HomeiOS Developmentswift - Dynamic library in predominant ios app goal builds with no...

swift – Dynamic library in predominant ios app goal builds with no symbols, when debugging the widget extension


I’ve a SwiftUI iOS app with widget extension. I’ve extracted a standard code right into a framework, and have set it to construct as a dynamic library. The framework is embedded (embed & signal) in the principle app goal, and linked from the widget extension.

I came upon that after I create a scheme to run the widget extension in simulator, the widget runs high quality, however opening the principle app in the identical simulator fails instantly with a crash, because the app can’t discover any image from the widespread code framework.

I’ve navigated to the construct folder, ran nm ./Frameworks/CommonKit.framework/CommonKit, and it reveals zero symbols (and in addition the framework binary is tiny, about 34 kB – it undoubtedly does not have all of the code it ought to have).

It appears that evidently:

  1. If I debug the widget extension, the principle app crashes because it can’t discover any symbols from the shared library
  2. And after I debug the principle app, the widget extension crashes because it can’t discover any symbols from the shared library

Right here is the entire crash:

Exception Sort:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Cause: DYLD 4 Image lacking
Image not discovered: _$s10Foundation4DateV15CommonKitE11AddTomorrowOMa
Referenced from: <3D5A4B08-B980-3098-9BB5-1469DC662631> /Customers/USER/Library/Developer/CoreSimulator/Gadgets/635C1833-95B7-421A-8720-C367E6D564D1/knowledge/Containers/Bundle/Utility/0D9AB3ED-BBCE-4E7B-98D6-9515081770C9/MyApp.app/MyApp
Anticipated in:     <E0A56B44-D392-3EC8-9336-750BD5303843> /Customers/USER/Library/Developer/CoreSimulator/Gadgets/635C1833-95B7-421A-8720-C367E6D564D1/knowledge/Containers/Bundle/Utility/0D9AB3ED-BBCE-4E7B-98D6-9515081770C9/MyApp.app/Frameworks/CommonKit.framework/CommonKit
(terminated at launch; ignore backtrace)

Runpath search path appears to be set okay (@executable_path/Frameworks and @executable_path/../../Frameworks for extensions), so it appears that evidently the extension finds the framework properly, solely it finds it empty.

After I construct the entire app (= predominant app + extension) for machine, it really works, and after I set the library to static library, the crashes cease (however then it’s compiled into each app targets, rising the app dimension, so I might favor the dynamic library).

What will be the trigger?



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments