Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IBDesignables failing to render in Xcode

Tags:

xcode

ios

Ok, I've been through all the Forums and Websites but have yet to find a solution or even a reason for a problem we are having in regards to using IBDesignables in a large project that uses lots of frameworks (about 30 via Cocoapods or internal). Xcode 8.0 though it started back in Xcode 7.x. The frameworks are a mix of Swift and Objective-C.

The actual error messages in Xcode are:

"Failed to render and update auto layout status for XXXX: dlopen(xxxx, 1): Library not loaded: @rpath/YYYY/YYYY.framework" and
"Failed to update auto layout status: dlopen(xxxx, 1): Library not loaded: @rpath/YYYY/YYYY.framework"

We don't seem to have the problem on smaller projects that utilize various combinations of the same frameworks.

I've been able to get the errors to complain about different libraries not loading by removing some from the project, so it does not appear to be directly related to the actual library being complained about. I've eliminated -ObjC and all_load as possible culprits by making sure they where no where the project or xxconfig files.

Many of the frameworks do share the same dependencies. Things like AFNetworking, ActionSheetPicker, ReactiveCocoa etc., but removing them only moves the errors around.

Has anyone else seen a problem with IBDesignables not working on larger projects?

like image 397
Joey Jarosz Avatar asked Oct 30 '22 18:10

Joey Jarosz


1 Answers

Its a workaround, but appears to be working (for now). We figured out that if we add $(FRAMEWORK_SEARCH_PATHS) and "/Applications/Xcode.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphonesimulator" to every pod's project level. LD_RUNPATH_SEARCH_PATHS we can avoid the errors, with no visible side effects.

Here is a snippet from our Podfile:

installer.pods_project.build_configurations.each do |config|  
config.build_settings['LD_RUNPATH_SEARCH_PATHS'] = [  
  '$(FRAMEWORK_SEARCH_PATHS)',  
     '"/Applications/Xcode.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphonesimulator"'  
]  
end  
like image 112
Joey Jarosz Avatar answered Nov 15 '22 06:11

Joey Jarosz