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

Image assets for buttons aren't loaded #7

Closed
srstanic opened this issue Nov 20, 2016 · 40 comments
Closed

Image assets for buttons aren't loaded #7

srstanic opened this issue Nov 20, 2016 · 40 comments
Assignees

Comments

@srstanic
Copy link

Hi, I've tried adding SwiftWebVC to an empty project via CocoaPods but there is an issue with image assets in the bundle. It looks like once the pod is installed, image assets are not a part of the bundle anymore (although if you look on the filesystem, they are). The result is that the images aren't loaded when the browser view is displayed. Attached screenshot shows the issue.

If you need more information, please let me know.

swiftwebvc-issue

@ed-mejia
Copy link

Same problem here

@meismyles
Copy link
Owner

meismyles commented Nov 22, 2016

Will try and get this sorted tomorrow evening when I'm back home.

@meismyles meismyles added the bug label Nov 22, 2016
@meismyles meismyles self-assigned this Nov 22, 2016
@yeisonvargasf
Copy link

@meismyles There is the same problem in SVWebViewController Repository, look this: TransitApp/SVWebViewController#156

@srstanic
Copy link
Author

srstanic commented Dec 2, 2016

@meismyles just wanted to check if you are going to be able to review the pull request by @bchrobot sometime soon? It seems to contain a fix for this issue.

@meismyles
Copy link
Owner

@bchrobot @srstanic Sorry about the delay in reviewing this. Thanks for the PR @bchrobot 👍

@bchrobot
Copy link
Contributor

bchrobot commented Dec 2, 2016

Thanks for the Swift port!

@srstanic
Copy link
Author

srstanic commented Dec 5, 2016

@meismyles sorry to bug you about it, but wanted to ask if you could release the fix and I guess the tag needs to be pushed to the cocoapods repo so that everyone can get the update?

I'm aware we can use this form to link master directly:

pod 'SwiftWebVC', :git => 'https://github.com/meismyles/SwiftWebVC.git'

Thanks!

@bchrobot
Copy link
Contributor

bchrobot commented Dec 5, 2016

My PR did not actually fix this. I tested it in my own project using :path as well as :git referencing the feature branch on my fork of this. Apparently some cache was not cleared completely and images are still not being referenced correctly.

@meismyles meismyles reopened this Dec 5, 2016
@meismyles
Copy link
Owner

That's weird, I pulled your feature branch as well and it seemed to be working using it :/

@srstanic
Copy link
Author

srstanic commented Dec 5, 2016

@bchrobot, @meismyles I've changed my Podfile to include the SwiftWebVC module like this:

pod 'SwiftWebVC', :git => 'https://github.com/meismyles/SwiftWebVC.git'

which should pull the master branch from Github, and after running

pod install

it works as expected on my machine. I can see the missing buttons now.

Here is a screenshot:

swiftwebvc

@bchrobot
Copy link
Contributor

bchrobot commented Dec 5, 2016

Herm, maybe the caching problem was actually the other direction. Glad that it is working for @srstanic - I will try again

@bchrobot
Copy link
Contributor

bchrobot commented Dec 5, 2016

EDIT: This was the resource bundle - I just didn't realize it at first...

I'm still having problems with it and cannot figure out why. I'm seeing this Pods target, which is unexpected:

screen shot 2016-12-05 at 3 31 42 pm



It is listed as a dependency for the SwiftWebVC pod:
screen shot 2016-12-05 at 3 30 36 pm

@bchrobot
Copy link
Contributor

bchrobot commented Dec 7, 2016

My problem appears to have been due to confusion about which bundle the resources were accessible from. This SO post details how the resource bundle must sourced from within the pod bundle.

My PR was looking for the resources in the pod bundle rather than the resource bundle (within the pod bundle). Not very well documented by Cocoapods

@meismyles
Copy link
Owner

Thanks for this @bchrobot. Will review and pull it asap.

@bchrobot
Copy link
Contributor

bchrobot commented Dec 8, 2016

Sweet 👍

Images still don't work in the example app and I'm not sure why. There are a few stale SO posts about Cocoapods not compiling assets outside of the Podfile's directory correctly, but again they were a year or so old supposedly fixed in Cocoapods 1.x

@meismyles
Copy link
Owner

meismyles commented Dec 20, 2016

This PR seems to be working for me. I can't find a way to make it break (but then again, the last one seemed to work for me as well), except for the images not showing in the example project currently which I will try and look at next chance I get. Not got much time to play with this at the moment unfortunately. Let me know if there are issues arising with this build. Thanks 👍

@meismyles
Copy link
Owner

Infact, I'm not going to make a new release for CocoaPods just yet. I'm going to review the WKWebView PR in the morning and bring that in, then will make a new release.

@bchrobot
Copy link
Contributor

You're able to run the example app without problems? I wish I knew what was so special about my setup... 😢

@meismyles
Copy link
Owner

No I'm not 😭 I'm gunna try and straighten this whole thing out first thing tomorrow morning. Had a major lack of time to look at it recently and I need to figure out why they aren't working in the example app, swap everything over to WKWebView and then make a new release. I'm going to try and get this all boxed off tomorrow morning as it's frustrating me it not working correctly.

Any ideas as to why the example project isn't loading images? Especially now loading them from the bundle

@meismyles
Copy link
Owner

@bchrobot @srstanic Hey guys, I have made a new release that hopefully resolves the image issue. I've also refactored the example project to remove the unused Pods framework and replaced UIWebView with WKWebView to bring this more up to date. I've also pushed a new build to CocoaPods so that should all be working correctly again now. Apologies for not sorting this sooner, just not had the time.

As far as I can tell it seems to be working correctly now, but I wondered if you could take a quick look and see if the issues are resolved you. Thanks very much for all your help and contributions. It is much appreciated.

Cheers 👍 ❤️

@bchrobot
Copy link
Contributor

pod 'SwiftWebVC', '~> 0.2.0'

Gets me the following:

screen shot 2016-12-20 at 7 18 09 pm

@meismyles
Copy link
Owner

What in the? Did you run definitely run pod update after updating your Podfile? I've just re-tried pod 'SwiftWebVC', '~> 0.2.0' and it's working fine:

simulator screen shot 21 dec 2016 00 22 16

@bchrobot
Copy link
Contributor

I just tried creating a completely new iOS project, adding SwiftWebVC, and both presenting a SwiftModalWebVC modally as well as pushing a SwiftWebVC to the navigation stack. Both were missing the icons.

I thought that maybe it was a setting in the original I was working on. I haven't tried on another computer but might be able to over the holidays. Really hoping it isn't a system config problem on my dev machine...

@meismyles
Copy link
Owner

meismyles commented Dec 21, 2016

@bchrobot This is bizarre. I've tested it on 2 different machines and it's working successfully on both. Will have to give this a test on a few other machines in work tomorrow and see if they work.

Out of interest, if you try pod try 'SwiftWebVC' and open the example project that way does it work?

@bchrobot
Copy link
Contributor

bchrobot commented Dec 21, 2016

wtf - That does work...

I will compare project settings more thoroughly

@bchrobot
Copy link
Contributor

At least we know this is a problem between the keyboard and the chair and not a problem with the pod. Probably okay to close the issue.

@meismyles
Copy link
Owner

Weird, ok I'll close this for now and will test myself again tomorrow. Let me know if you figure out why.

@srstanic
Copy link
Author

srstanic commented Jan 9, 2017

Hey guys, sorry for not responding earlier. This still doesn't work for me either.

When I try pod try SwiftWebVC, the issue is not present. But when I update the pod in the test project I've created, the issue is still present. I've also noticed that the structure of the pod is different in those two contexts, although I've double checked that the version 0.3.0 is installed in my test project.

swiftwebvc-issue-still-present-in-030

Even looking at the code of SwiftWebVC.swift itself, I can see the changes from the latest commit where the SwiftWebVCDelegate protocol was added. So it looks like the code is up to date, but the pod structure is not.

cc @meismyles

@srstanic
Copy link
Author

srstanic commented Jan 9, 2017

I just wanted to add that version 0.1.2 is working for me. I'm referencing it like this:

pod 'SwiftWebVC', :git => 'https://github.com/meismyles/SwiftWebVC.git', :commit => 'b8c1a51f7915f8d8fe9e0cc6137dcb737f10dd37'

I think that's pretty much the same code that I've referenced before directly from the master branch. It worked for me before and it still works.

@meismyles
Copy link
Owner

Hey @srstanic. Thanks for getting back. This is really confusing haha. The pod is definitely up to date and this shows on the CocoaPods website.

I can't seem to make this not display the images with the current version. I'm not sure how else to try and reproduce this - got any ideas?

@meismyles meismyles reopened this Jan 9, 2017
@srstanic
Copy link
Author

srstanic commented Jan 10, 2017

@meismyles here is what I did:

  1. Created a new XCode project
  2. Opened the project dir in terminal, executed pod init
  3. Opened the Podfile and added pod 'SwiftWebVC' to it
  4. Went back to the terminal and executed pod install

Result:

  1. SwiftWebVC version 0.3.0 was installed
  2. When I opened the xcworkspace file with XCode an examined the installed SwiftWebVC pod structure, it looked different (older) than the pod that is used in the workspace opened by pod try SwiftWebVC. The difference is visible in the screenshot I've attached to the previous comment

If you follow the same steps, what are your results? How does your pod structure look like? Is it up to date with the latest commit?

@meismyles
Copy link
Owner

Ok now I'm getting the issue again. This is so confusing. 😭

@meismyles
Copy link
Owner

Must be to do with the structure as you suggest. The resources location is specified as SwiftWebVC/Assets/Media.xcassets in the Podspec. Doing pod try seems to retain this structure, but installing it normally as just a plain old pod moves the files around and puts the Media.xcassets group in a folder called Resources. 😕

@meismyles
Copy link
Owner

Just pushed a new release but this didn't fix it. Difficult to test solutions without actually pushing new releases to CocoaPods.

@meismyles
Copy link
Owner

Hey @srstanic and @bchrobot, the latest fix in version 0.3.3 seems to have fixed this for me (again haha 😂 ). If you guys could check with this version and let me know I would be eternally grateful. Thanks very much.

@bchrobot
Copy link
Contributor

It is indeed very strange, not to mention frustrating. It would be nice if CocoaPods provided documentation about best practices around asset management as I'm sure this is not an uncommon feature.

Thank you for working on the new version! I will try it out tonight or tomorrow and let you know

@srstanic
Copy link
Author

@meismyles I've tested 0.3.3 by referencing the master branch from the Podfile and it is working for me! 👏 🎉 Thanks for fixing this!

@meismyles
Copy link
Owner

@srstanic Wooo 😄 0.3.3 should be the live version in CocoaPods, was there a specific reason why you needed to reference the master branch?

@bchrobot
Copy link
Contributor

Confirmed that 0.3.3 works when referencing CocoaPods!

@srstanic
Copy link
Author

@meismyles I forgot to run pod repo update so referencing 0.3.3 didn't work. My bad. :)

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

No branches or pull requests

5 participants