THLabel icon indicating copy to clipboard operation
THLabel copied to clipboard

IBDesignable issue and CocoaPods

Open pronebird opened this issue 11 years ago • 27 comments

Did you manage to make it work on IB and CocoaPods?

While properties show up in IB, they are not rendered, I get this error:

Storyboard.storyboard: error: IB Designables: Failed to update auto layout status: Failed to load designables from path (null)

pronebird avatar Dec 01 '14 01:12 pronebird

I haven't heard of this issue yet. Are you sure this is a CocoaPods issue? Are you using Xcode 6? I'm not sure where to go from here, have you tried the example project?

tobihagemann avatar Dec 01 '14 09:12 tobihagemann

I use Xcode 6.1.1 GM. I assume it's a problem with pods but I may be wrong. I'll re-check again. Haven't tried example project.

On Monday, December 1, 2014, Tobias Hagemann [email protected] wrote:

I haven't heard of this issue yet. Are you sure this is a CocoaPods issue? Are you using Xcode 6? I'm not sure where to go from here, have you tried the example project?

— Reply to this email directly or view it on GitHub https://github.com/MuscleRumble/THLabel/issues/28#issuecomment-65040522.

pronebird avatar Dec 01 '14 12:12 pronebird

If you still find this issue, it would be great if you could send me a minimal project example to [email protected] so that I can look into it!

tobihagemann avatar Dec 01 '14 21:12 tobihagemann

I integrated THLabel in one of my apps but later dropped it as the idea of labels customizations has been cancelled. I'll let you know if this pops up in further when I use it next time.

pronebird avatar Dec 01 '14 22:12 pronebird

@pronebird seems the issue is related to Cocoapods: https://github.com/CocoaPods/CocoaPods/issues/2792

@MuscleRumble trying the example project cannot simulate the issue. It's not using Cocoapods to use THLabel.

chakming avatar Dec 04 '14 06:12 chakming

Thanks for the info @chakming! :) So... I have to wait for Frameworks support?

tobihagemann avatar Dec 04 '14 09:12 tobihagemann

I guess so. At this moment, the only way to render them correctly in Interface Builder, is to import THLabel manually, instead through Cocoapods...but I still prefer Cocoapods installation haha

chakming avatar Dec 04 '14 09:12 chakming

Yeah, CocoaPods should be the way to go. Too bad. :grin:

tobihagemann avatar Dec 04 '14 09:12 tobihagemann

I'll check if this bug fixed in 6.1.1.

pronebird avatar Dec 07 '14 17:12 pronebird

I attempted to use THLabel through cocoapods and IBDesignable didn't work. Interface Builder complained and then stopped updating the label. After that it wouldn't let me update any properties either.

Eventually I worked around the problem by moving THLabel.* into my project and commenting out IBDesignable/IBInspectable.

IBDesignable in general seems to be quite buggy, especially with Swift. Sigh. You might want to consider removing support for IBDesignable until Xcode gets its act together.

gurgeous avatar Dec 14 '14 01:12 gurgeous

Thanks for your suggestion @gurgeous! I've released 1.4.6 and I'll just wait with IBDesignable until it all works out. :)

tobihagemann avatar Dec 14 '14 14:12 tobihagemann

NOOOOOOOooooooooooo! God damn it Apple, why you so broken.

pronebird avatar Dec 16 '14 11:12 pronebird

oh, I have the same problem, I just drag the source code to my Xcode project and remove it from CocoaPods, it works well. I think this is a Xcode bug, Xcode can`t parse @IBDesignable class from a static lib

troyzhao avatar Jan 22 '15 02:01 troyzhao

This is now working with Cocoapods (0.36.1.beta.1) and by adding use_frameworks! in your Podfile. More information here.

Eddpt avatar Jan 23 '15 11:01 Eddpt

Thanks for the info @Eddpt! To everyone who's interested in using THLabel with Interface Builder, should follow @Eddpt's instructions and use the ibdesignable branch:

pod 'THLabel', :git => 'https://github.com/MuscleRumble/THLabel.git', :branch => 'ibdesignable'

I'll keep this issue open until the new version of CocoaPods is out of beta. And when that happens, I'll merge the ibdesignable branch into master.

tobihagemann avatar Jan 23 '15 16:01 tobihagemann

CocoaPods 0.36 is now out of beta, but I'm not sure if I should merge ibdesignable branch into master. By adding use_frameworks! to your Podfile, you have to set your deployment target to at least iOS 8. Is this correct?

tobihagemann avatar Mar 12 '15 00:03 tobihagemann

Yep

— Cheers, Andrej

On Thu, Mar 12, 2015 at 1:10 AM, Tobias Hagemann [email protected] wrote:

CocoaPods 0.36 is now out of beta, but I'm not sure if I should merge ibdesignable branch into master. By adding use_frameworks! to your Podfile, you have to set your deployment target to at least iOS 8. Is this correct?

Reply to this email directly or view it on GitHub: https://github.com/MuscleRumble/THLabel/issues/28#issuecomment-78400446

pronebird avatar Mar 12 '15 00:03 pronebird

Hmmm... now I'm not 100% sure how to deal with this. I can think of several scenarios:

  1. Just keep the two branches and explain it in README. => Pro: Clean separation. => Con: Maintaining two branches. ;)
  2. Use __IPHONE_OS_VERSION_MIN_REQUIRED macro to check for deployment target. If it's >= __IPHONE_8_0, then activate IBDesignable features, otherwise not. ;) But this wouldn't check if Podfile is including use_frameworks! at all. Hmmm... :/ => Pro: One branch. => Con: Possible confusion for deployment targets >= iOS 8.0, when use_frameworks! is not specified in Podfile.

tobihagemann avatar Mar 12 '15 17:03 tobihagemann

What if pod built as framework you activate ibdesignable? I am sure there is some magic define for that ...

pronebird avatar Mar 14 '15 08:03 pronebird

That would be great! I've opened an issue at CocoaPods: https://github.com/CocoaPods/CocoaPods/issues/3265

Maybe there is some magic. :D If not, you just gave me another idea, which I like most now: Define my own macro (which defaults to NO) to flag if the user wants to use IBDesignable or not.

tobihagemann avatar Mar 15 '15 00:03 tobihagemann

custom define is PITA, CocoaPods should help to resolve that as it clearly impacts all of pods out there.

pronebird avatar Mar 15 '15 13:03 pronebird

Any news on that?

x2on avatar Apr 09 '15 08:04 x2on

Unfortunately not, I'm still waiting for feedback from CocoaPods. If you want to use IBDesignable with THLabel, you can use the ibdesignable branch as mentioned here.

tobihagemann avatar Apr 09 '15 11:04 tobihagemann

I confirm this issue with another view with and without the use_frameworks! flag: https://github.com/Kentzo/ShortcutRecorder/tree/cocoapods

Kentzo avatar May 08 '15 06:05 Kentzo

Cocoa pods 3.7.1 does NOT fix the issue if your target < iOS 8 and you cannot use use_frameworks! in any such project. So this is not a fix.

drekka avatar May 13 '15 08:05 drekka

What is the fix now for projects supporting iOS versions lower than 7?!

Blackjacx avatar Sep 21 '15 11:09 Blackjacx

Just use the master branch and you should be good to go. I must admit, I haven't tested THLabel on iOS versions lower than 7 for a while now (and am unable to), but I believe it should still work with iOS 4 and higher.

tobihagemann avatar Sep 21 '15 15:09 tobihagemann