ivpusic/react-native-image-crop-picker

Incomplete bit code when uploading to app store

superandrew213 opened this issue ยท 61 comments

Version

Tell us which versions you are using:

  • react-native-image-crop-picker v0.8.0
  • react-native v0.32.0

Steps to reproduce

  1. Archive and upload to app store

Attachments

screen shot 2016-09-05 at 6 51 09 pm

Getting this now after cleaning, restarting, reinstalling, etc

screen shot 2016-09-05 at 7 05 05 pm

you are getting this error because pre-built frameworks are built for simulator and device ARCHs. This is good for development because you don't have to worry about supported arch when building and running on different platforms.

Before uploading to appstore, you have to strip away simulator platforms, and then use stripped versions of frameworks instead of current ones.

You can also remove current pre-built libraries for embedded binaries, and add the ones from Libraries/imageCropPicker/Libraries/XXX/Product/XXX.framework which will be there after you build project for specific platform.

@ivpusic could you give a step by step for this process as I'm having real trouble getting rid of this error. It's definitely due to a misunderstanding of mine of how xcode works?

then probably latter will be easier for you.

go to project General tab, scroll down to Embedded binaries. You will see that there are two pre-built frameworks. You can remove them, build project for Device => this will produce Frameworks built for Device platform. Click + under Embedded binaries, and now you can add these two frameworks.

screen shot 2016-09-05 at 6 15 54 pm

Later probably you will want to switch back to pre-built frameworks because it is easier during development.

@ivpusic I'm still getting the same error if I do that.

This is what I did:

  1. Completely remove react-native-image-crop-picker
  2. Install and link react-native-image-crop-picker
  3. Build for "Generic iOS Device"
  4. Add the two frameworks from the libraries folder to "Embedded Binaries"
  5. Archive and upload

Before upload starts I get the same error in the first screenshot

can you go to Project -> Build Settings -> Enable Bitcode. Is it yes or no?

Yes, it's enabled.

hm, then would be cool if you can investigate what is happening. Maybe try flags/options from this link http://stackoverflow.com/questions/34959767/whats-the-difference-between-fembed-bitcode-and-bitcode-generation-mode. Probably for some reason bitcode is not included in built frameworks, and as you said your app has it, which is causing this incompatibility.

You can experiment by editing build options of each framework, build it and then link it with your app. Please keep me posted about progress here.

Have you been able to upload to itunesconnect yet?

nope, my personal project is still in development, so I didnt try upload yet.

Adding -fembed-bitcode flag to frameworks fixes it.

great. will release new version with this fix.

Great! thanks

@superandrew213, Have you released anything with this package? This package works great on the simulator, but I put something on TestFlight and memory usage explodes when selecting photos with this...

@parkerdan what "memory usage explodes" means in your context? How much memory usage is increased? In my testings when running on device memory usage is ok. "Exploding" comes if I send base64 image data over the RN bridge, which is something you should generally avoid with react-native.

I love your work on being able to select multiple photos, and everything is great until the app is on the phone via TestFlight.

My app is 80mb according to iOS Settings->General->Storage->Manage Storage. My app got to 160mb after selecting a few photos with your package. When I changed to react-native-image-picker, and added the same photos to the app, the memory was at 85mb.

Yes, i"m including base64.

@ivpusic, but I also get base64 from the other package without the memory increase....

sorry, I thought you were talking about RAM usage, but you are talking about disk usage? in that case reason why memory increases is because files are written to tmp location which is cleaned up automatically at some point. Maybe would be a good idea to export some cleanup function, so users can call it once they don't need file(s) anymore.

I would love a clean-up function. Any idea how to go about that?

@parkerdan I delete images in temp folder as soon as I am done with them. You can use react-native-fs for that RNFS.unlink(path).

@ivpusic it would be better to let react-native-fs handle that

@superandrew213, Thanks for the tip

@superandrew213 let't keep this option as well, because many people doesn't use fs package

@ivpusic when add framework into Embedded Binaries, you can use add other and add file in node_modules/react-native-crop-picker/ios/imageCropPickerSDK/xxx.framework, so you dont need to remove and add framework every time.

@ivpusic hi,I have a question.When I click + add RSKImageCropper.framework and QBImagePicker.framework under Embedded Binaries ,These were not add to Embedded Binaries.So,what should I do .Thanks

they should. Build your project first and then do steps you mentioned (if you are not adding pre-built frameworks).

Hi! I tried to do everything that I found in this issue) But it`s not helped me.

First of all I want to understand what means in README instruction

If you are using pre-built frameworks from ios/ImageCropPickerSDK, then before deploying app to production you should strip off simulator ARCHs from these

What I should do?

Variant 2

or you can add frameworks from Libraries/imageCropPicker/Libraries/framework_name.xcodeproj/Products/framework_name.framework

okay, I read it many times. What I did:

actxqvjuyc

How to upload archive
2017-08-14_17-48-27

monosnap 2017-08-14 17-50-55

my best advice is to use cocoapods to manage QBImagePicker and RSKImageCropper dependencies. I uploaded app many times without any problems by using cocoapods.

Unfortunately I couldn`t use cocoapods, because It conflict with libraries that I used, so after it I decided to install it manually. I feel the decision exist, but what wrong(

ok, I will try

Podfile

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'palmy_mobile' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for palmy_mobile
  pod 'react-native-image-crop-picker', :path => '../node_modules/react-native-image-crop-picker'

end

run pod install

get an error

โžœ  ~/sites/palmy_mobile/ios git:(dev) โœ— pod install
Analyzing dependencies
Fetching podspec for `react-native-image-crop-picker` from `../node_modules/react-native-image-crop-picker`
[!] No podspec found for `react-native-image-crop-picker` in `../node_modules/react-native-image-crop-picker`

[!] Automatically assigning platform ios with version 8.0 on target palmy_mobile because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

@tavriaforever You have to create podspec manually by using the command to create podsec file. You have to place this file in the root of this library. Then you can copy the code of this file from the git and paste it in this file, then run pod install again. It will work.

Can't support Chinese !๐Ÿ™ƒ

ๆˆ‘้‡ๅˆฐไบ†่ฟ™ไธช้—ฎ้ข˜ Failed to verify bitcode in QBImagePicker.framework/QBImagePicker
ๆˆ‘้€š่ฟ‡ ๅฐ†้กน็›ฎ็š„ build Settings -> Build Options -> Enable Bitcode ่ฎพ็ฝฎไธบno ่งฃๅ†ณไบ†้—ฎ้ข˜ , ๆ‰“ๅŒ…ๆˆๅŠŸ

I highly recommend to use the pods it will lessen your config upon building for production.

hello,
I used cocoapods, and did according to the instruction. Remove pre-built from embedded binaries, and then added them in from Libraries/imageCropPicker/Libraries//Products/
But still get the following error:
" UserInfo={NSLocalizedDescription=Failed to verify bitcode in QBImagePicker.framework/QBImagePicker: error: Cannot extract bundle from /var/folders/wf/wxwbrgls6fg49tyhp_dx35cc0000gn/T/XcodeDistPipeline.HKc/Root/Payload/timecapsule.app/ImageCropPickerSDK/QBImagePicker.framework/QBImagePicker (x86_64)
Any idea how to solve this?

@ShuBuShao

Also tried toggling the Enable Bitcode to Yes, and then to No.
Still getting this error:

Failed to verify bitcode in QBImagePicker.framework/QBImagePicker

Any other suggestions?

I also have this issue with the latest version. Have no idea how to resolve it until I manually delete all the binary files, clean, clean build folder and archive project again. Finally it worked.

In general, if some one can make it work but some one cannot make it work, then first thing should come up is try to clean the project as much as we can. This is a good experience

I already have everything working properly on my dev environment. Now I want to upload it to testflight. I have a circle ci that will be triggered on push to master that will build the ipa and push it to testflight.

In order to not have to change my project manually every time I want to push to master (and trigger circle ci), I need to be able to delete these files before I start to build the IPA.

If you are using pre-built frameworks from ios/ImageCropPickerSDK, then before deploying app to production you should strip off simulator ARCHs from these,

This is not very clear for me. Which are the files I need to delete?


EDIT:

@ivpusic Is it something like this: https://github.com/oney/react-native-webrtc/blob/master/Documentation/iOSInstallation.md#appendix-b---apple-store-submission ? Could we benefit to a script similar to the one in react-native-webrtc?

Based on that script I created this: https://gist.github.com/canastro/e8cf409f9a241cfb1d0763cdb66f3dc8 and now I run:

  • node scripts/ios_arch.js --extract && node scripts/ios_arch.js --device && node scripts/ios_arch.js --clear

And then:

  • bundle exec fastlane ios build match_type:appstore export_method:app-store ipa_name:xxxx.ipa

Now the error I have is:

ERROR ITMS-90685: "CFBundleIdentifier Collision. 
There is more than one bundle with the CFBundleIdentifier value 'com.ruslanskorb.RSKImageCropper' under the iOS application 'xxxx.app'."

ERROR ITMS-90685: "CFBundleIdentifier Collision. 
There is more than one bundle with the CFBundleIdentifier value 'jp.questbeat.QBImagePicker' under the iOS application 'xxxx.app'."

Any tips on what I might be missing?

My problem was solved after i deleted the folder installed by the Post-install steps 2

@canastro did you happen to solve "CFBundleIdentifier Collision"? I'm getting that too!

mdio commented

@mayankbaiswar-CSE I tried what @codetay suggested (removing the manually added reference to ImageCropPickerSDK in Xcode) and this solved the collision problem for me.

Also I took the script from https://github.com/oney/react-native-webrtc/blob/master/tools/ios_arch.js that @canastro mentioned and converted it into helper functions for fastlane.

DEPENDENCIES_TO_STRIP = ['RSKImageCropper', 'QBImagePicker']

def strip_simulator_archs()
  archs_to_keep = ['armv7', 'armv7s', 'arm64']

  DEPENDENCIES_TO_STRIP.each { |dependency|
    Dir.chdir("../node_modules/react-native-image-crop-picker/ios/ImageCropPickerSDK/#{dependency}.framework") do
      sh("cp #{dependency} /tmp/#{dependency}")

      archs_to_keep.each { |arch|
        sh("lipo -extract #{arch} #{dependency} -o #{dependency}-#{arch}")
      }
      createParameters = archs_to_keep.reduce('') { |total, arch| "#{total} #{dependency}-#{arch}" }
      sh("lipo -o #{dependency} -create#{createParameters}")
      sh("rm #{dependency}-*")
    end
  }
end

def restore_simulator_archs()
  DEPENDENCIES_TO_STRIP.each { |dependency|
    Dir.chdir("../node_modules/react-native-image-crop-picker/ios/ImageCropPickerSDK/#{dependency}.framework") do
      sh("mv /tmp/#{dependency} #{dependency}")
    end
  }
end

In our release lane, strip_simulator_archs is called before and restore_simulator_archs after gym.
That way you don't have to fiddle around to have both a working simulator build and one for TestFlight.

Adding -fembed-bitcode flag to frameworks fixes it.

excuse me, where exactly i do have to put this flag? Could provide a detailed instruction?

can you go to Project -> Build Settings -> Enable Bitcode. Is it yes or no?

YES

I am a bit confused about Production build step for non-pod installation.

I followed all steps for non-pod including post-install (adding RSKImageCropper.framework and QBImagePicker.framework manually) and I run it in simulator - all worked well.
Then I archived the apk and sent it to testflight, installed it from testflight - that also all worked well.

I am using xcode 10, RN 0.57, deployment target 9.0, iOS 12.1.2 and no pods.
I use react-native-crop-picker@0.21.3 to take a picture and to select from library then I send its base64 to my server.

Is striping away simulator platforms still a required step?

I also can't use cocoapods, so here is the setup process that worked for me in dev and prod.

  1. Install the react-native-image-crop-picker
  2. react-native link react-native-image-crop-picker
  3. Select Generic iOS Device as a target
  4. Menu Product -> Clean and then Product -> Build.
  5. Go to the folder /Users/<user>/Library/Developer/Xcode/DerivedData/<app-name>/Build/Products/Debug-iphoneos.
  6. Copy the QBImagePicker.framework and RSKImageCropper.framework to your <project>/ios folder, and then drag and drop both from <project>/ios to Embedded binaries.
  7. Archive and Upload ๐ŸŽ‰

@douglasjunior @mieszko4 @ivpusic
So, having followed the installation step without Cocapoads (manual installation), can I avoid the production step?

With QBImagePicker.framework and RSKImageCropper.framework in Embedded Binaries and with Debug scheme my app works well, but I'm uploading it on TestFlight and I would like to understand if I have to do production step or not.

Following my steps you are ready for development and production.

@douglasjunior I do not understand what you do exactly between point 5 and point 6

After step 4 the compiled frameworks are generated on step 5 folder. You need to copy them to your <project>/ios folder, and then link both as Embedded binaries. What you do not understand?

That's the point - I did not embed binaries from derived folder (i.e. I did not do steps 5 and 6).
I just followed the initial instructions on README.md and it worked for me both on simulator and testflight and I am just confused why. I will recheck this.

Please mind I am not an expert in iOS stuff.
I rechecked this and I did:

  • rm -fr /Users/mieszko4/Library/Developer/Xcode/DerivedData
  • rm -fr ./node_modules
  • npm ci
  • I opened the project (I have no cocoapod) in xcode, I set target as Generic iOS Device
  • I cleaned the project
  • I went to General tab and under Embeded Binaries I pressed + and I chose RSKImageCropper.framework and QBImagePicker.framework (they were automatically expanded and located under Libraries/imageCropPicker/Libraries/_framework_name_.xcodeproj/Products/_framework_name_.framework)

After adding them I've noticed that their paths are taken from DerivedData folder, i.e. /Users/mieszko4/Library/Developer/Xcode/DerivedData/NAMEOFPROJECT-gyhgygejsxewwjakamghtszkqurn/Build/Products/Debug-iphoneos/QBImagePicker.framework. This path points to no file though.

I archived the app and sent to the store - no problem.
I installed the app on Testflight and it is all good.

After that I changed target to iPhone XR, I built it and run on simulator - again it is all good.

This is why I am confused why there is additional step for production only as it seems that the post-install ios Step 2 automatically does what needs to be done for production.

@mieszko4 oh sure, I'm little bit confused.
I probably didn't do all your steps, but having installed everything manually (without Cocoapods), I fully followed all the steps explained in the section Post-install steps (https://github.com/ivpusic/react-native-image-crop-picker#post-install-steps) for iOS and it works fine, both debug and release. I also tried with TestFlight.

I also find RSKImageCropper.framework and QBImagePicker.framework under Libraries/imageCropPicker/Libraries/_framework_name_.xcodeproj/Products/_framework_name_.framework (automatically located here).

I have this situation in Xcode:
imagecroppicker-xcode

So, why does it work anyway?
Is Production build (https://github.com/ivpusic/react-native-image-crop-picker#production-build) still necessary? @ivpusic

@paolospag you need to copy and paste the compiled frameworks to your <project>/ios, and then link the frameworks from <project>/ios to Embbeded binaries.

@douglasjunior Why is mine still not working? Is there any missing steps?
image
image
image

Can i use react-native-image-crop-picker with expo ,

img is file
const { stream, filename } = await img;

stream is undefined but showing filename.
Anybody know how to get stream from image

FrontEnd :ReactNative
Backend :Nodejs Apollo Boost