drante
drante

Reputation: 139

Xcode - IB Designable: Failed to render and update auto layout (no suitable image found)

I am trying to implement a custom UIView from a .xib file which I want to be able to inspect in one of my storyboards. However, I receive a build time error:

IB Designables: Failed to render and update auto layout status for LoginViewController (BYZ-38-t0r): dlopen(App.app, 1): no suitable image found. Did find: App.app: can't map unslidable segment __TEXT to 0x100000000 with size 0x268000

I am using CocoaPods and read that this was due to a bug in version 1.5. I tried some workarounds and a downgrade to 1.4 without any results. I have also tried removing the DerivedData folder and cleaning/rebuilding the project.

My .xib file contains a simple temporary UIView, and this is the corresponding code:

import UIKit

@IBDesignable class ButtonPrimary: UIView {

    @IBOutlet var button: UIView!

    override init(frame: CGRect) {
        super.init(frame: frame)
        initNib()
        setup()
    }

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        initNib()
        setup()
    }

    func initNib() {
        let bundle = Bundle(for: ButtonPrimary.self)
        bundle.loadNibNamed("ButtonPrimary", owner: self, options: nil)
        addSubview(button)
        button.frame = bounds
        button.autoresizingMask = [.flexibleHeight, .flexibleWidth]
    }

    func setup() {
        self.backgroundColor = UIColor.clear
    }
}

Any ideas?

Upvotes: 2

Views: 1288

Answers (1)

Roel Koops
Roel Koops

Reputation: 880

Which workarounds have you tried?

I had the same issue and adding this workaround to my Podfile, fixed it for me. I found this workaround here.

# Workaround for Cocoapods issue #7606
post_install do |installer|
    installer.pods_project.build_configurations.each do |config|
        config.build_settings.delete('CODE_SIGNING_ALLOWED')
        config.build_settings.delete('CODE_SIGNING_REQUIRED')
    end
end

It removes the CODE_SIGNING_ALLOWED and CODE_SIGNING_REQUIRED build-settings from your Pods.

Upvotes: 2

Related Questions