yourkarma / JWT

A JSON Web Token implementation in Objective-C.
MIT License
351 stars 105 forks source link

Cannot find JWT module when using Carthage #106

Closed nathanclemente closed 8 years ago

nathanclemente commented 8 years ago

Hi there,

I'm new to iOS development in general so please forgive any mistakes...

I'm working on a custom framework for JWT validation. I saw Carthage support was added so I went ahead and added github "yourkarma/JWT" "master" to my Cartfile and ran carthage update --platform iOS in my Cocoa framework directory. However, I get a No Such Module JWT error on the line import JWT when I try and build my framework after adding the JWT_iOS_Framework.framework file into my Linked Frameworks and Libraries.

I noticed that there is both a "JWT_iOS_Framework" and "JWT_iOS_Swift" framework in my Carthage builds folder, and wasn't sure why it wasn't just JWT.framework like what is pulled in using CocoaPods. I've added both libraries to my Linked Frameworks to no avail and wasn't sure if I was importing this library incorrectly (I tried import JWT_iOS_Framework as well) or if I needed to do something else different for Carthage.

Any help would be great! Thanks.

lolgear commented 8 years ago

@nathanclemente unfortunately, it is a legacy. You could use import JWT_Module.

nathanclemente commented 8 years ago

Thanks for the quick reply! Unfortunately JWT_Module isn't working either...

I'm on 0.18.1 of Carthage and my Cartfile in my framework solely contains github "yourkarma/JWT" "master". My Carthage/Build/iOS folder just contains the two JWT_iOS frameworks I mentioned above and the Base64.framework (which I can import just fine).

nathanclemente commented 8 years ago

Whoops, sorry, accidentally closed it.

lolgear commented 8 years ago

@nathanclemente try carthage update without arguments.

nathanclemente commented 8 years ago

@lolgear running carthage update gave me the JWT_macOS_Framework and JWT_macOS_Swift frameworks in the Build/Mac folder. Added them both and saw that the Xcode autocomplete could import "JWT_macOS_Framework".

However, on build, JWT_macOS_Framework.h can't find the "Cocoa/Cocoa.h" file and my Swift file that wants to use the library's functionality can't build JWT_macOS_Framework because it's an Objective-C module. I've tried deleting my DerivedData but it didn't help. Any thoughts?

lolgear commented 8 years ago

@nathanclemente do you have JWT_Module.framework in any directory?

nathanclemente commented 8 years ago

@lolgear I do not, unfortunately

lolgear commented 8 years ago

@nathanclemente ok, I will have a look at the end of the week.

nathanclemente commented 8 years ago

@lolgear thanks!

lolgear commented 8 years ago

@nathanclemente check latest, please.

nathanclemente commented 8 years ago

Thanks @lolgear! Able to import and run it now. One thing you may want to add to your readme for new devs is that I had to add the framework in Linked Frameworks and Libraries as well as add it to my run script, just like any other Carthage library. Works great though, thanks again for helping out