73

I have some custom controls I have created and I'm them using in a new project. However, I keep getting errors in interface builder:

Failed to update auto layout status: Failed to load designables from path (null)

or

Failed to render instance of <control>: Failed to load designables from path (null)

I've tested out the controls in another project and they seem to render correctly in interface builder, but I cannot get them to work in the current project. What causes this error and how might I fix it?

Thanks in advance...

5

17 Answers 17

79

I had the same issue. I use cocoapods and there is a pod which uses designables. So the trick was to add 'use_frameworks!' to the Podfile. do a 'pod update' reopen the xcode project and the error message shouldn't show up.

6
  • This is not relevant for ios 7+ since it breaks many libraries like Realm.
    – Dvole
    Commented Nov 19, 2015 at 18:20
  • I was testing with iOS 8 and iOS 9 and it works for me.
    – i89
    Commented Nov 20, 2015 at 8:32
  • 9
    this worked in solving the problem but adding "use_frameworks!" broke some import statements for the pods I had downloaded.
    – sosale151
    Commented Mar 26, 2016 at 17:15
  • 2
    !use_frameworks will drastically increase your build size FYI Commented Nov 29, 2016 at 15:57
  • Recently tested with Xcode 13.0 and it works for me as well. It has removed IBDesignables. Commented Nov 25, 2019 at 23:22
15

Edit**

Open Xcode (but do not open your project) and click on Window (second from the right)

Click Organizer and make sure you're on Projects, then delete all derived data. Close out Xcode and then reopen your project and let Xcode re-index your files and see if that clears up the issue

2
  • 2
    I have tried all of that and still have the same error when I add IB_Designable and IBInspectable back to the classes
    – Jake
    Commented Mar 11, 2015 at 14:03
  • 2
    Doesn't work. Have tried multiple variants on it. This is not a derived data issue.
    – drekka
    Commented May 13, 2015 at 7:42
7

I'm running Xcode 7.3, and got the error to magically disappear by following these steps that, in the end, left my project in the exact state that it was prior to following these steps (i.e. a net zero change to anything):

  1. Add 'use_frameworks!' (without the apostrophes, of course) to your podfile
  2. Open up a terminal window
  3. cd to your project's root dir
  4. Run 'pod install' from the command line
  5. Remove the 'use_frameworks!' from your podfile
  6. Run 'pod install' again
  7. Try building again and see if that fixes the error; it did for me

Looks like one of those occasional Xcode snags that we've all seen before, especially when you're in a hurry to get something else done.

1
  • 1
    Worked perfectly! Thanks for the super clear, detailed instructions (others mentioned use_frameworks!, but no one mentioned removing it afterwards, and leaving it in caused issues with my other pods). Commented May 17, 2016 at 19:08
5

If previous solutions didn't works for you, try adding to your target pod inherit! :search_paths

Sample

  target 'my-app-target' do
    use_frameworks!
    inherit! :search_paths
  end

After that do a pod update as suggested before.

0
4

I don't use CocoaPods, but I do use a in-house framework that contains IBDesignable items, and was also experiencing this problem. I cleaned, deleted the Derived Data from my main project, and restarted Xcode, but that didn't seem to fix it. To resolve it, I had to go to Window > Projects, select the framework project (not the project that used the framework, but rather the framework project itself), and delete the Derived Data. So, full steps:

  1. Product menu > Clean
  2. Hold down Option > Product menu > Clean Build Folder... > Clean
  3. Window menu > Projects > Choose my Framework project > Delete Derived Data
  4. Window menu > Projects > Choose my main project > Delete Derived Data
  5. Quit Xcode
  6. Restart Xcode

Repeat step 3 for any and all framework projects that have IBDesignables and may be causing the errors.

3

I am not sure if this solves your problem, as I cannot reproduce it. But I thought you might give it a try anyway.

First, as others mentioned, it seems that CocoaPods had the same problem. I went through the commits that made up their corrections, but with no result related to your setting.

However, I found a different related error message in this StackOverflow question, which was also related to something not being found by IB on the path. I wondered if their solution could help you:

The solution was to add $(CONFIGURATION_BUILD_DIR) in the target's Build settings Runpath Search Paths field.

3
  • Can the person who downvoted all answers on this question please provide a rationale?
    – Dennis
    Commented May 15, 2020 at 13:18
  • 1
    probably they gonna sink their rating. Can't thank you enough for this answer! Helped even in 2020 :)
    – Cemen
    Commented Aug 18, 2020 at 6:52
  • Piling on. This worked for me (Xcode 12) and the highest-rated use_frameworks! answer was going to be a world of pain with the pods in my project Commented Sep 22, 2020 at 13:08
3

I had the same issue on non-CocoaPods project with custom IBDesignable views. Apparently, it's an Xcode bug. Steps in this answer helped me to resolve the problem. In short:

  1. Quit Xcode.
  2. Kill all processes named Interface Builder Cocoa Touch Tool on your machine.
  3. Start Xcode again.
2

This issue fixed in the latest version of Cocoapods

To install,simply run:

[sudo] gem install cocoapods --pre

In order to fix the Error: "failed to load designables from path (null)":

use_frameworks!

   pod '****'



end

Add use_frameworks! to you Podfile

Find more:Live Rendering a custom component using IB_DESIGNABLE from a pod dependency

2

The issues was that IB_DESIGNABLE from cocoapods are not linked correctly when interface builder render your views.

The use_frameworks! trick should do it but for me it was just a bit too much effort to migrate the code.

My trick was to subclass every IB_DESIGNABLE view I used in the storyboard that came straight from the pods. Solved the errors.

1

There's a very handy trick you can do to debug live rendering.

1) Add this extension to your project:

    extension UIView {
    public func liveDebugLog(message: String) {
        #if !(TARGET_OS_IPHONE)
            let logPath = "/tmp/XcodeLiveRendering.log"
            if !NSFileManager.defaultManager().fileExistsAtPath(logPath) {
                NSFileManager.defaultManager().createFileAtPath(logPath, contents: NSData(), attributes: nil)
            }

            var fileHandle = NSFileHandle(forWritingAtPath: logPath)
            fileHandle.seekToEndOfFile()

            let date = NSDate()
            let bundle = NSBundle(forClass: self.dynamicType)
            let application: AnyObject = bundle.objectForInfoDictionaryKey("CFBundleName")
            let data = "\(date) \(application) \(message)\n".dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: true)
            fileHandle.writeData(data)
        #endif
    }
  }

2) Add a liveDebugLog(message:) and put whatever you want to know. 3) Open Terminal.app and run the command open /tmp/XcodeLiveRendering.log

Done!

Credits for Morten Bøgh

0

i have solved that issue by updating the pod "pod update" hope it will work for you

0

This error appeared when I updated the pods while the xcode and my project was open.

I shut the xcode down. ran the pod update again. restarted xcode.

error didn't appear again.

0

If you're already fed up trying to figure out the solution or in case it is Friday afternoon just relax and delete the derived data folder, clean build Xcode, shut down your mac, take a 5 min break(if you're not fire-fighting through your deadline :P ). Turn on your mac launch Xcode try building again.

If this works just curse Xcode and move on like I did :)

0

Simply running pod update fixed the issue for me

2
-1

I wasn't using cocoa pods but getting this error on a view controller extending an imported classes. I was only getting this error when changing the StoryBoard to IphoneX view, it was working fine on iPhone 8 view.

I changed the project settings from New Build System (Preview) to Standard Build system, then clean the project and the error disappeared.

No idea why but that solved the problem for me.

-1

All Pods related fixes did not work for me but deleting the Derived Data folders worked. Xcode 11

-1

Clean + restart XCode did if for me. If the issue stems from you creating an IBDesignable view then deleting an inspectable or the designable tag, I would absolutely try this approach

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.