IB_DESIGNABLE and dylib problem

My app has 2 dylibs linked, in build settings run path is set to "@executable_path/../Frameworks" and a copy file rule is also there. The app runs fine for years now (in App Store).

But once I turn on IB_DESIGNABLE for a custom view, IB reports errors like below:

It seems IB tries to load the dylibs from somewhere in Xcode.app.

What should I do in order to get IB_DESIGNABLE to work in IB?

  • I believe this is a bug. IB is looking at the wrong place. It is looking at MYAPP/Contents/MacOS/Frameworks instead of configured MYAPP/Contents/MacOS/../Frameworks.

Add a Comment

Replies

Ah, it's agony!

I struggled with this for many hours and finally get it to work, in a mysterious way.

At first, setting @rpath to "@loader_path/../Frameworks" or "@executable_path/../Frameworks" did not work. After many tries, I set it to both of the 2 paths and IB_DESIGNABLE started working. But I may be wrong because I tried many many times and ways. It might be that I once set a hardcoded path to the directory where libCocoaSQLite.dylib resides in ("/Users/USERNAME/some/long/path/to/the/dylib"). Then maybe Xcode caches the location somewhere and voila it works!

Now the weird thing is that even now I set @rpath to "@loader_path/../Frameworks" alone, IB_DESIGNABLE still works. I cleaned build folder and even rebooted macOS.

Is it mysterious?!