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...

Jake
  • 13,097
  • 9
  • 44
  • 73
  • 1
    @N1ghtshade3 I'm having the same problem, and the control I'm having issue with is not from a CocoaPods dependency. – Josh Brown Mar 09 '15 at 17:38
  • I am not using CocoaPods either, but I have seen the CocoaPods related post. I think CocoaPods has found a solution to this issue, but unfortunately I can't find it anywhere! – Jake Mar 10 '15 at 00:23
  • are you loading any images using imageNamed(:) – Daniel Galasko Mar 11 '15 at 13:37
  • take a look at https://github.com/CocoaPods/CocoaPods/issues/2792 and http://stackoverflow.com/questions/28204108/ib-designables-failed-to-update-auto-layout-status-failed-to-load-designables – Mehul Thakkar Mar 15 '15 at 16:32
  • another solution: http://stackoverflow.com/a/38368740/2245240 – Yaro Jul 14 '16 at 08:07

17 Answers17

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.

i89
  • 1,092
  • 8
  • 11
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

Anthony Taylor
  • 3,073
  • 3
  • 21
  • 30
  • 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 Mar 11 '15 at 14:03
  • 2
    Doesn't work. Have tried multiple variants on it. This is not a derived data issue. – drekka May 13 '15 at 07: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.

John Jacecko
  • 1,870
  • 1
  • 16
  • 12
  • 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). – Fateh Khalsa May 17 '16 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.

JBarros35
  • 976
  • 1
  • 12
  • 18
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.

Community
  • 1
  • 1
Dennis
  • 2,119
  • 20
  • 29
  • Can the person who downvoted all answers on this question please provide a rationale? – Dennis May 15 '20 at 13:18
  • 1
    probably they gonna sink their rating. Can't thank you enough for this answer! Helped even in 2020 :) – Cemen Aug 18 '20 at 06: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 – Chris Pointon Sep 22 '20 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.
Community
  • 1
  • 1
pjuzeliunas
  • 1,596
  • 1
  • 15
  • 19
3

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.

William Key
  • 173
  • 12
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

Community
  • 1
  • 1
PeiweiChen
  • 413
  • 5
  • 16
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.

Antzi
  • 12,831
  • 7
  • 48
  • 74
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

Rafael Machado
  • 655
  • 6
  • 12
0

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

Yuvraj Kale
  • 49
  • 1
  • 9
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.

KawaiKx
  • 9,558
  • 19
  • 72
  • 111
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 :)

SPS
  • 359
  • 3
  • 12
0

Simply running pod update fixed the issue for me

-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.

mariosm
  • 402
  • 4
  • 9
-1

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

highrankin
  • 87
  • 9
-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

PSchuette
  • 4,463
  • 3
  • 19
  • 21