Cokile / CCActivityHUD

A simple replacement for UIActivityIndicatorView
Other
324 stars 38 forks source link

The Checkmark is not Shown #3

Closed Blackjacx closed 4 years ago

Blackjacx commented 8 years ago

I habe a iOS 9 and Swift only project. I initialise the activity view directly in the property and show it as reaction on a button press. Thus the view has been loaded. But after everything completes the checkmark is not visible :-(

The tick/cross images are nil on initialization of the UIImage instance.

I use cocapods version 1.0.1. Maybe something changed there using images.

Cokile commented 8 years ago

Hey Blackjacx,

Since CCActivityHUD is written in Objective-C, I have not tested it with Swift. I think it may be a bug of CCActivityHUD.

Anyway, I will find the solution and/or fix it as soon as I can.

Blackjacx commented 8 years ago

Hey, that will be awesome :-) Thank you!

Cokile commented 8 years ago

Hey Blackjacx,

The problem is that tick.png and cross.png are not copied to your target.

A temporary solution is to add the two images (you can find these resources within the same directory of code files of CCActivityHUD) to your target. But this will make the project directory a little dirty.

I am working on making Cocoapods automatically copy resources to the target.

Cokile commented 8 years ago

Hey Blackjacx,

Update CCActivityHUD to v2.1.6 and it will work.

I have tested it with a Swift project. Tell me if it works on your device.

Blackjacx commented 8 years ago

Hey Cokile,

it does not work yet. Do I have to set a special property? Even in a new Swift project it does not work for me with 2.1.6....

Cokile commented 8 years ago

Can you show me the related code and the Xcode navigator panel?

Blackjacx commented 8 years ago
private lazy var activity: CCActivityHUD = {
    let activity = CCActivityHUD()
    activity.cornerRadius = kDefaultCornerRadius
    activity.overlayType = .Shadow
    return activity
}()

private func showActivity() {
    activity.showWithType(.TriangleCircle)
}

private func dismissActivity() {
    activity.dismiss()
}
Cokile commented 8 years ago

Hey Blackjacx,

I have also created a new test Swift project, and installed the CCActivityHUD v2.1.6 by Cocoapods, it worked for me.

Can you show me your Xcode navigator panel? The correct one should like the capture below

screen shot 2016-07-29 at 06 53 51
Blackjacx commented 8 years ago

Ahh maybe the difference is that I build a framework from your library using cocoapods. My Navigator is different in the ressources folder (you have an additional subfolder):

screen shot 2016-07-29 at 08 53 45

Maybe you did not tag and push the latest version on Github?

Cokile commented 8 years ago

Try to re-install it and let me know if it will work

Blackjacx commented 8 years ago

Nope I think I'll add the images simply to my project

Cokile commented 8 years ago

Hey Blackjacx,

I am sorry that I made a mistake with my Swift test project's Podfile, your Navigator capture is right. But such mistake does not affect the image resources. I have also tested it with a new Objective-C project and everything worked well.

Do you have such thing in your target build phases:

screen shot 2016-07-30 at 19 32 38
Blackjacx commented 8 years ago

Yes I have this. Hm strange. I can attach the project here. Maybe you'll find the mistake there. HUDTest.zip

Cokile commented 8 years ago

Hey Blackjacx,

Since the pod is written in Objective-C while the HUDTest is a project of Swift, I add a bridging header and add only one line in the bridging header:

#import "CCActivityHUD.h"

There is no need to add import CCActivityHUD.h in ViewController.swift or modify any code in ViewController.swift.

Everything works as expected.

For more details about adding bridging header, you can visit this Stackoverflow question.

Blackjacx commented 8 years ago

I know about the bridging header. But in a purely Swift based project it is not necessary. Additionally I just import your POD as framework, that is build by Cocoapods. In such a case resources cannot be found as usual. We also have this problem in our app with the CoreData model file (and resources in general) that comes from the framework. We need to manually find that file using NSBundle methods. You need to do the same when you want that devs continue to install your lib via Cocopods.

Cokile commented 8 years ago

So I re-download the HUDTest project and run it without any modification, the checkmark is shown as expected.

Blackjacx commented 8 years ago

Even without pod install?! For me the checkmark is not shown...

Cokile commented 8 years ago

Yup. Just simply download, unzip and run, the checkmark is shown as expected. Also I tried pod install, but since HUDTest had installed the pod, the command would not change anything.

Blackjacx commented 8 years ago

Hmmm very strange. I have really no idea why that works for you :-(

Cokile commented 8 years ago

Have you ever tried not to use use_frameworks!, at least this also works for me.

Blackjacx commented 8 years ago

Nope, because I want to use frameworks 😇 But I advise you to fix the framework case. Take it as experience ;-)