Interface Builder - Failed to load designables from path (null)
Asked Answered
V

17

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

Vonnievonny answered 8/2, 2015 at 6:4 Comment(5)
@N1ghtshade3 I'm having the same problem, and the control I'm having issue with is not from a CocoaPods dependency.Nystatin
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!Vonnievonny
are you loading any images using imageNamed(:)Adown
take a look at github.com/CocoaPods/CocoaPods/issues/2792 and #28204608Bucharest
another solution: https://mcmap.net/q/23827/-ib-designables-failed-to-update-auto-layout-status-failed-to-load-designables-from-path-nullChinchin
C
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.

Condom answered 30/7, 2015 at 9:2 Comment(6)
This is not relevant for ios 7+ since it breaks many libraries like Realm.Tasman
I was testing with iOS 8 and iOS 9 and it works for me.Condom
this worked in solving the problem but adding "use_frameworks!" broke some import statements for the pods I had downloaded.Tetartohedral
!use_frameworks will drastically increase your build size FYIVashtee
Recently tested with Xcode 13.0 and it works for me as well. It has removed IBDesignables.Fancied
@KehlinSwain, Do you meant Xcode 11.0? by the time you made your comment, Xcode 12 itself was not thereUnpriced
I
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

Instal answered 10/3, 2015 at 1:40 Comment(2)
I have tried all of that and still have the same error when I add IB_Designable and IBInspectable back to the classesVonnievonny
Doesn't work. Have tried multiple variants on it. This is not a derived data issue.Beane
B
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.

Bellay answered 11/4, 2016 at 22:4 Comment(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).Beatnik
D
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.

Discounter answered 4/12, 2019 at 10:59 Comment(0)
I
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.

Improbability answered 1/9, 2016 at 23:47 Comment(0)
D
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.

Darell answered 16/3, 2015 at 16:23 Comment(3)
Can the person who downvoted all answers on this question please provide a rationale?Darell
probably they gonna sink their rating. Can't thank you enough for this answer! Helped even in 2020 :)Wallywalnut
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 projectJulenejulep
E
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.
Entirely answered 1/4, 2016 at 13:3 Comment(0)
A
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

Artless answered 9/9, 2015 at 7:28 Comment(0)
K
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.

Kunkel answered 11/4, 2017 at 6:5 Comment(0)
D
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

Deakin answered 10/5, 2015 at 17:51 Comment(0)
T
0

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

Thomism answered 1/3, 2017 at 10:6 Comment(0)
E
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.

Endopeptidase answered 19/5, 2017 at 0:58 Comment(0)
J
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 :)

Johannessen answered 5/7, 2020 at 0:26 Comment(0)
A
0

Simply running pod update fixed the issue for me

Asoka answered 10/4, 2023 at 3:54 Comment(2)
This is the same solution as in this other answer.Maxia
Thanks @EricAya didn't see it earlierAsoka
T
-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.

Trussing answered 23/5, 2018 at 10:49 Comment(0)
A
-1

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

Acie answered 18/12, 2019 at 13:19 Comment(0)
A
-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

Alcove answered 30/4, 2020 at 15:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.