Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift Project not loading success/failure images, cocoapods integrated #31

Closed
LightD opened this issue Apr 30, 2015 · 9 comments
Closed

Comments

@LightD
Copy link

LightD commented Apr 30, 2015

Hi, So I've integrated the library through cocoapods, and I'm having a pure swift project, XCode 6.3.. really didn't change anything.. any thoughts?
P.S: I'm importing in my swift file using the swift import JGProgressHUD, not through bridging header.. (which btw, I can't import it through bridging header alone)..
I don't know if that's enough information.. the library is working fine really, just the images are not loading apparently from the resources bundle, everything else is fine...

@JonasGessner
Copy link
Owner

Is the JGProgressHUD Resources.bundle folder inside your .app?

@JonasGessner
Copy link
Owner

CocoaPods should add the resources bundle the resources that are copied into the app's bundle.

@emadd
Copy link

emadd commented May 6, 2015

+1

@dawiddr
Copy link

dawiddr commented May 13, 2015

I've looked into the problem taking JGProgressHUDSuccessIndicatorView as an example. The image is not shown because imgPath is nil. That happens only when JGProgressHUD is used as a framework.

To fix it, replace the following:

NSString *imgPath = [(fwBundle ? : [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"JGProgressHUD Resources" ofType:@"bundle"]]) pathForResource:@"jg_hud_success" ofType:@"png"];

With:

NSString *imgPath = [[NSBundle bundleWithPath:[fwBundle ? : [NSBundle mainBundle] pathForResource:@"JGProgressHUD Resources" ofType:@"bundle"]] pathForResource:@"jg_hud_success" ofType:@"png"];

I don't have time to test this solution properly, hence there will be no pull request for now.

@gooooer
Copy link

gooooer commented May 14, 2015

Having trouble integrating JGProgressHUD version 1.2.5 and lower to my project as well. @JonasGessner can you please fix it? Not sure what happened - either recent update of CocoaPods itself or your release removed nice success/failure images.
I don't quite understand where is the problem exactly but maybe following items may come up with help -

  1. http://blog.flaviocaetano.com/post/cocoapods-and-resource_bundles/ -- try to switch to resource_bundles and change source code accordingly?
  2. http://guides.cocoapods.org/syntax/podspec.html#resources -- just noted that you use resources in your podspec but there is a resource option when you have only one bundle to copy.

Anyway recent release doesn't load proper image at all. I tried to downgrade to 1.2.3 and manually copy resources bundle to main project - then in it worked. But it's completely wrong way to go.

Thanks in advance for any help!

@JonasGessner
Copy link
Owner

@LightD You can only import Objective C headers in the Bridging header, how are you able to import JGProgressHUD in your Swift file? Edit: Unless you include it as framework, which CocoaPods doesn't do.

@dawiddr There are no issues with the images when using not CocoaPods and installing JGProgressHUD as framework. See the JGProgressHUD Tests project, it works fine. This ticket is about CocoaPods.

I've tried setting up JGProgressHUD (1.2.5) through CocoaPods (Latest version) and the images are all available and show up in the error and success indicators.

@dawiddr
Copy link

dawiddr commented May 14, 2015

@JonasGessner An important piece of information is missing here: CocoaPods actually uses frameworks when you specify use_frameworks! in Podfile and/or use some Swift pods. That's the setup I'm referring to.

@gooooer
Copy link

gooooer commented May 14, 2015

@dawiddr I also have such setup, +1.

@JonasGessner
Copy link
Owner

Right, thank you! I don't use CocoaPods myself so I'm very unfamiliar with it ;) I'll push version 1.2.6 soon with a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants