vovkasm / react-native-web-image

An image component for react-native with persistent disk and memory caching.
MIT License
146 stars 25 forks source link

ios build failing with missing files #8

Closed maurovisintin closed 7 years ago

maurovisintin commented 7 years ago

Hi there, i tried out this lib and it's working fantastic on Android. I'm having a problem building the ios solution though. It looks like i'm missing something in the installation.

Installation and linking is looking fine

Build fails --> SDWebImage/UIImageView+WebCache.h file not found

actually the folder /node_modules/react-native-web-image/WebImage/Vendor/SDWebImage is empty.

I'm not really expert with xcode dependencies so it could be really a silly thing.

Thanks in advance

"react-native": "^0.43.4" "react-native-web-image": "0.0.4",

vovkasm commented 7 years ago

Seems like using submodules to connect SDWebImage project was bad idea. I will embed it on next release. But currently should make ios project on pair with android with borders, so it will take some time.

However, npm tarball has this files, did you install the module by clone git repo manually? If so, do:

cd $PROJECT/node_modules/react-native-web-image
git submodule update --init --recursive
maurovisintin commented 7 years ago

Hi, thanks for the quick response! I tried the commands but didn't work.
WebImage/Vendor/SDWebImage folder is still empty. (should it be?)

vovkasm commented 7 years ago

Hmm, it should not be empty. See, npm tarball contains those files.

I need to known you environment to help. So what output of these commands executed in $PROJECT/node_modules/react-native-web-image?

  1. npm version
  2. git version
  3. git status
  4. git branch -av
  5. git submodule status --recursive
maurovisintin commented 7 years ago

Hi, thanks for the quick response! I manually cloned the SDWebImage repo and now the solution builds.

But i get this fatal error *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[WebImageView sd_setImageWithURL:completed:]: unrecognized selector sent to instance 0x111e6bf00'

seems like source is always nil.

vovkasm commented 7 years ago

Bad, will try to done ios task faster :-/

I can't say without additional info what can be incorrect. But you can try to checkout exactly same commit of SDWebImage as in the submodule 1777032d03de73a87f10e17ed7939a06af05a48b (it is their tag 4.0.0)

mleung commented 7 years ago

Hi there. Any word on this issue? I'm running into this as well. Thanks!

vovkasm commented 7 years ago

Hi, do you install module with npm install?

mleung commented 7 years ago

Yes, that's correct. I installed the master branch with NPM. Then I checked out the commit you mentioned above into the vendor directory and updated all the submodules for SDWebImage. I still unfortunately get the file not found error. https://cl.ly/0C2k3e1t2j23

Thanks for getting back to me.

el-lsan commented 7 years ago

Any update on this issue ?

vovkasm commented 7 years ago

I just embeded SDWebImage to repo without submodules. Please check, any commit to master after 2154e5edbd0f7f57047d872703d67a2dcd2b1b93 should work.

vovkasm commented 7 years ago

Close as this should be fixed now. Feel free to reopen if problem isn't solved.

brettdonald commented 7 years ago

It isn't fixed. Still can't build an archive in XCode using (npm) module version 0.0.5. The problem doesn't exist in 0.0.4 -- I can archive just fine with that.

I tried to reopen this issue, but I don't seem to have an option to do that.

vovkasm commented 7 years ago

@brettdonald sorry, I thought rights regarding issues on github less restrictive...

Although the issue title is "ios build failing" (I will rename it), it's all about missing files in build. Does you problem about the same? If so I will reopen this, else it would be very helpful if you open another bug with additional info, such as versions of Xcode, RN, build settings, etc... Thank you!

brettdonald commented 7 years ago

The error I am getting is:

"/Users/brettdonald/Documents/AdventistMedia/React/adventisthub-mobile/node_modules/react-native-web-image/WebImage/WebImage/WebImageView.h:3:9: 'SDWebImage/UIImageView+WebCache.h' file not found".

Looks pretty much the same as the original issue, so I think reopening this bug is the right thing to do.

My version of Xcode is 8.3.3 (8E3004b) My version of React Native is 0.48.2 Happy to provide build settings, etc, if you let me know exactly what you need and how to obtain it ... I'm not enough of an expert to know what's relevant

vovkasm commented 7 years ago

Thanks! I will try to reproduce!

vovkasm commented 7 years ago

@brettdonald Can you do these steps to try clean install? I can't reproduce the bug. In console:

react-native init MySample
cd MySample
npm i -P react-native-web-image
react-native link

Replace index.ios.js and index.android.js with:

import { AppRegistry } from 'react-native'

import App from './common'

AppRegistry.registerComponent('MySample', () => App)

Copy sample from README.md to common.js file.

Then run packager & start app:

npm start
react-native run-ios

Are you sure, that you update react-native-web-image to version 0.0.5? My environment (by react-native info):

Environment:
  OS:  macOS Sierra 10.12.6
  Node:  8.5.0
  Yarn:  Not Found
  npm:  5.4.2
  Watchman:  4.9.0
  Xcode:  Xcode 8.3.3 Build version 8E3004b
  Android Studio:  2.3 AI-162.4069837

Packages: (wanted => installed)
  react: 16.0.0-alpha.12 => 16.0.0-alpha.12
  react-native: 0.48.4 => 0.48.4
bachphuc commented 7 years ago

@brettdonald I have same your issue today "'SDWebImage/UIImageView+WebCache.h' file not found" only when I archive, build run emulator well, after many searchings, but there's no way to make it works. finally I read on this https://github.com/rs/SDWebImage/wiki/Add-as-a-submodule-and-configure-for-Archive, last step "And without this final step you won't be able to Archive: YourXCodeProject > Targets > YourXCodeProject > Build Settings > Header Search Paths > + > "$(SRCROOT)/SDWebImage""

I tried but not working, but finally I made it works by: Step 1: click Libraries choose WebImage.xcodeproj then build Setting add "$(SRCROOT)/Vendor/SDWebImage" to Header Search Path Step 2: clean => archive => working well

Maybe you need reinstall node module by rm -rf node_module/ then npm install then react-native link then follow my steps. Hope this can help others with same my issues. Good luck.

brettdonald commented 7 years ago

Thanks @bachphuc. I've just tried the test suggested by @vovkasm last week, and although running in the simulator is fine (react-native run-ios), it's when trying to build an archive in Xcode that it falls over. I did mention this before, that the error only occurs when trying to archive, but perhaps @vovkasm didn't pick that up, or perhaps he's assuming that because it works fine in the simulator that everything must be cool.

So, @vovkasm, shouldn't react-native link do all the necessary Xcode configuration? Does your package tell react-native link what to do? Perhaps something is missing there. But what I don't understand is that the problem didn't exist in 0.0.4, it only exists in 0.0.5. When you try to reproduce the problem, make sure you go all the way to making an archive in Xcode.

vovkasm commented 7 years ago

@brettdonald Sorry, you are right, I did not understand that issue occurs only with archive mode. @bachphuc Thank you for finding it finally!

I will release fix shortly!

brettdonald commented 7 years ago

@bachphuc's fix didn't work for me, in the MySample project I created.

vovkasm commented 7 years ago

@brettdonald , can you share sample project on github, perhaps as I describe in https://github.com/vovkasm/react-native-web-image/issues/8#issuecomment-331721987?

And you can test fix on module itself, simple put

  "react-native-web-image": "https://github.com/vovkasm/react-native-web-image#master"

In your package.json

brettdonald commented 7 years ago

Tried your fix, and yes, I can now successfully build an archive. Thanks very much. Please let us know when you update the NPM package.

vovkasm commented 7 years ago

@brettdonald, @bachphuc Version 0.0.6 released!

Thank you!

gogumai commented 7 years ago

Hi,

I'm having some trouble when executing react-native run-ios. The build fails and throws this error: duplicate interface definition for class 'FLAnimatedImage'.

Runing from xCode works fine though.

I'm on 0.0.6 and RN0.48.4

vovkasm commented 7 years ago

@gogumai Most probably it is conflict with another library, that use FLAnimatedImage.