1 year ago
#83971

user3386180
iOS Framework Module Not Loading in App on Physical Target
My app has been growing quite a bit over the years, and I decided to give it a try to further modularize it by breaking it up into several frameworks and static libraries. After 4 days of work (and still some work to do) I am rather pleased with the result of the experiment. To my surprise, the app runs right away nicely in the simulator with very few straightforward issues still to fix. So, it did not go entirely wrong.
However, the app crashes right away when I run it on a physical target. Information I could find for the shown error did not help, or it was rather confusing probably due to the changes done to the configuration system over the years.
The error goes something like this:
dyld[1107]: Library not loaded: @rpath/aaa.framework/aaa
Referenced from: /private/var/containers/Bundle/Application/94EB623F-2FD9-4E73-B97E-D77A167997A3/MyApp.app/MyApp
Reason: tried: '/usr/lib/swift/aaa.framework/aaa' (no such file), '/usr/lib/swift/aaa.framework/aaa' (no such file), '/private/var/containers/Bundle/Application/94EB623F-2FD9-4E73-B97E-D77A167997A3/MyApp.app/Frameworks/aaa.framework/aaa' (no such file),
...
So apparently, it cannot load one (possibly more) framework defined in one of the modules, and the problem exists only on a physical device. The settings I have been playing with are the project files of the main app module and the aaa framework as well as the Podfile
.
In the including project, I have added the framework to target's build phases under "Link Binary with Libraries", and I defined the target as in the Podfile shown below.
I have tried adding another "Copy Files" build phase to add the missing frameworks as suggested for a similar problem, but that led to additional problems: signing issues for device and "Target Integrity" issues for the Simulator.
There are quite a fews settings, difficult to be entirely shared here, but I will gladly add specific information if needed for solving the issue. The question is: what do I need to do to be able to run my modularized app on both simulator and real target?
platform :ios, '12.0'
use_frameworks!
workspace 'MyApp'
target 'MyApp' do
project 'MyApp/MyApp.xcodeproj'
use_frameworks!
pod A
pod B
target 'MyAppTests' do
project 'MyApp/MyApp.xcodeproj'
inherit! :search_paths
end
target 'MyAppUITests' do
project 'MyApp/MyApp.xcodeproj'
inherit! :search_paths
end
target 'aaa' do
project 'aaa/aaa.xcodeproj'
end
target 'bbb' do
project 'bbb/bbb.xcodeproj'
pod A
end
target 'ccc' do
project 'ccc/ccc.xcodeproj'
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
config.build_settings['LD_NO_PIE'] = 'NO'
end
end
end
ios
swift
xcode
cocoapods
modularization
0 Answers
Your Answer