react-native: Not able to generate archive when using a Pod file

I managed to update to 0.46 rc2 from 0.43 today and everything was looking ok. Building a debug or production release was working. However when I tried to create an archive I ran in the following error:

Undefined symbols for architecture armv7:
  "_JSNoBytecodeFileFormatVersion", referenced from:
      +[RCTJavaScriptLoader loadBundleAtURL:onProgress:onComplete:] in libReact.a(RCTJavaScriptLoader.o)
      +[RCTJavaScriptLoader attemptSynchronousLoadOfBundleAtURL:runtimeBCVersion:sourceLength:error:] in libReact.a(RCTJavaScriptLoader.o)
  "facebook::react::parseTypeFromHeader(facebook::react::BundleHeader const&)", referenced from:
      +[RCTJavaScriptLoader attemptSynchronousLoadOfBundleAtURL:runtimeBCVersion:sourceLength:error:] in libReact.a(RCTJavaScriptLoader.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

In my project I’m using react-native-maps and since I’m running google maps on iOS I have a podfile similar to this one: https://github.com/airbnb/react-native-maps/blob/master/example/ios/Podfile

It turns out that when I remove the following lines

  pod 'React', path: '../../node_modules/react-native', :subspecs => [
    'Core',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket'
  ]

the archive is being built correctly.

I’ve reproduced the error here: https://github.com/compojoom/rn46crash/tree/7c34cf696cf940e21566d73b7e76365fb6aab677

As you can see the podfile just has the pod Yoga and pod React lines.

To run the app, clone the repository and do yarn. Afterwards open the rn46crash.xcworkspace with XCode, assign a team to the project and build it. You should run in the specified error above.

I’m pasting this issue here and not in the react-native-maps repository as with RN 0.43 - I was able to create an archive with that pod configuration, that’s why I think that there is something wrong in the RN package.

  • React Native version: 0.46 rc2
  • Platform: ios
  • Development Operating System: macOS
  • Build tools: Xcode 8.3.3

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 10
  • Comments: 29 (7 by maintainers)

Most upvoted comments

It seems that adding BatchedBridge subspec resolves the issue. I found it out based on React.podspec file analysis. JSNoBytecodeFileFormatVersion is defined in JSCWrapper.cpp

@tuckg as mentioned above by adding BatchedBridge React subspec in Podfile

pod 'React', path: '../../node_modules/react-native', :subspecs => [
   ...,
   'BatchedBridge',
   ...
  ]

I managed to make it work by linking in the xcode project the next 2 libs screen shot 2017-12-05 at 14 24 08

the pod file stays “simple”

platform :ios, '9.1'
target 'App' do
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga/Yoga.podspec'
  pod 'GoogleMaps'
  pod 'React', :path => '../node_modules/react-native'
  pod 'RNI18n', :path => '../node_modules/react-native-i18n'
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
end

Now I can send the app to Testflight using fastlane 🎉

@ArtyomCommander remove the libReact.a and RTCWebSocket from your XCode project because if you added it in the Podfile, you don’t need to include it in your project. Please try andsee it the error count is lower now.

@litmanenPL solution fixed that error but now I’m getting duplicate symbols for architecture armv7. I suppose that happens because now I have 2 copies of React in the project, one from cocoapods and one in the Libraries themselves.

What can be done to fix this? Removing React from the Libraries (like it’s suggested in https://github.com/auth0/react-native-lock/issues/3) ends up giving a lot of runtime errors.

So I’ve now added BatchedBridge to the React subspec in my Pod file. I can now build, upload and then download from TestFlight, and the resulting app no longer hangs on the blank screen.

Here’s how I changed my Pod file:

  pod 'React', path: '../node_modules/react-native', :subspecs => [
   'BatchedBridge'
  ]

So pretty much as @litmanenPL first said. That was the only change that I made.

@Andreyco,

Yes, I am having that very problem.

When I build and archive, submit that archive to Test Flight, and then download the app from there then the app hangs on a blank, white screen. When I built the app from Xcode and installed directly on my iPhone via a cable then it works fine. There should be no difference between the two processes, but there obviously is.

I haven’t, until now, had any clue what the cause might be because I was quite late introducing Test Flight into my process. (Lesson learned there!)

Guys, are you having luck building “release” archive after importing libcxxxreact.a, libjschelpers.a and removing libReact.a? App builds, opens, but screen stays blank.

Running app in “release” mode (via xCode + cable) is causing no problems. The issue comes when app is archived.

@rborn 's solution did it for me. I just added the libs libcxxreact.a and libjschelpers.a to XCode as he said. I also removed the libReact.a as @dotansimha said, because I was also loading React in my Pod file.

@tehong I don’t have the same luck as you, I have to keep adding libs when running debug and removing when I’m about to run fastlane to build, archive and upload.

@dotansimha Thanks you. I upgraded to 0.48.4, I also encountered duplicated symbols between libReact.a and libRCTWebSocket.a. With your advice, I removed the libRCTWebSocket.a from my xcode target’s “Link Library with libraries” after putting the ‘RCTWebSocket’ in the pod ‘React’ subspecs. Now I can both run debug and archive.