Skip to content
This repository has been archived by the owner on Jul 18, 2020. It is now read-only.

Build fails with vanilla project #60

Closed
sbefort opened this issue Jun 7, 2016 · 12 comments
Closed

Build fails with vanilla project #60

sbefort opened this issue Jun 7, 2016 · 12 comments

Comments

@sbefort
Copy link

sbefort commented Jun 7, 2016

Steps to recreate problem:

  1. react-native init upool
  2. cd upool
  3. In Xcode, change Bundle Identifier to com.upool
  4. npm install --save react-native-lock
  5. rnpm link react-native-lock
  6. Get typical warnings mentioned in the documentation.
  7. Change Other Linker Flags to $(inherited).
  8. rnpm link react-native-lock again. This time with no warnings.
  9. react-native run-ios

react-native-cli: 0.2.0
react-native: 0.27.1
CocoaPods 1.0.1
npm 3.9.2
Xcode 7.3.1

The build error mentions my Info.plist file. Under Bundle identifier in that file, I have $(PRODUCT_BUNDLE_IDENTIFIER)

** BUILD FAILED **

The following commands produced analyzer issues:
Analyze Modules/RCTUIManager.m
(1 command with analyzer issues)

The following build commands failed:
Ld build/Build/Products/Debug-iphonesimulator/upool.app/upool normal x86_64
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/upool.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
Failed to install the requested application
The bundle identifier of the application could not be determined.
Ensure that the application's Info.plist contains a value for CFBundleIdentifier.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
/Users/nomad/Mobile/upool/node_modules/promise/lib/done.js:10
throw err;
^

Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/upool.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

at checkExecSyncError (child_process.js:475:13)
at Object.execFileSync (child_process.js:495:13)
at _runIOS (runIOS.js:91:34)
at runIOS.js:24:5
at tryCallTwo (/Users/nomad/Mobile/upool/node_modules/promise/lib/core.js:45:5)
at doResolve (/Users/nomad/Mobile/upool/node_modules/promise/lib/core.js:200:13)
at new Promise (/Users/nomad/Mobile/upool/node_modules/promise/lib/core.js:66:3)
at Array.runIOS (runIOS.js:23:10)
at Object.run (/Users/nomad/Mobile/upool/node_modules/react-native/local-cli/cli.js:87:13)
at Object.<anonymous> (/Users/nomad/.npm-packages/lib/node_modules/react-native-cli/index.js:88:7)
@hzalaz
Copy link
Member

hzalaz commented Jun 7, 2016

Seems to be a react-native issue facebook/react-native#7308

@sbefort
Copy link
Author

sbefort commented Jun 7, 2016

What's interesting is that my vanilla React Native app works until I follow the process to install react-native-lock.

@hzalaz
Copy link
Member

hzalaz commented Jun 7, 2016

It has hardly anything to do with the library since the failure is from react-native cli and how it handles the build. In that issue they say that it fails because something is running in the port the packager should run, but it raises a different error.

@sbefort
Copy link
Author

sbefort commented Jun 7, 2016

What is the last known working version of React Native with react-native-lock? I can try that.

@hzalaz
Copy link
Member

hzalaz commented Jun 7, 2016

@sbefort it should work with the latest version, did you try the suggested fix from facebook/react-native#7308 ?

@sbefort
Copy link
Author

sbefort commented Jun 7, 2016

Last night I saw that issue. I killed anything running on port 8081 and still had the same build error. So then I ran react-native upgrade overwriting all conflicts. Then my build succeeded, but your sample app failed when calling lock.show on line 91. The error was, "cannot read property init of undefined." So I assumed that react-native upgrade screwed up my react-native-lock installation, so I started over this morning. I do not know if that is a correct assumption or not. If I run react-native upgrade, is it safe to overwrite all conflicts? Thanks.

@sbefort
Copy link
Author

sbefort commented Jun 7, 2016

I have determined that the suggested solution of running react-native upgrade in that issue is definitely problematic. It wants to overwrite "$(SRCROOT)/../node_modules/react-native-lock/ios/A0RNLock/**" among other things related to the react-native-lock install.

@hzalaz
Copy link
Member

hzalaz commented Jun 7, 2016

Checking it, It is since the latest react-native version has a lot of breaking changes. The safe way should be reinstalling react-native-lock after an upgrade like this.

@sbefort
Copy link
Author

sbefort commented Jun 7, 2016

I got it working now. The issue is with how to deal with the CocoaPods warning mentioned in the Docs:

Click .xcodeproj in the project navigator and go the Build Settings tab. Make sure 'All' is toggled on (instead of 'Basic'). Look for Other Linker Flags and change the current value for $(inherited) for your Application's Target.

Before changing this value to $(inherited) in a vanilla React Native project, there may be two values here:
-lc++
-ObjC

If both of those values are removed and replaced with $(inherited), the build will fail. The solution is to leave -lc++ and add $(inherited) as a second option:
-lc++
$(inherited)

After that, my build was successful and Lock works fine.

@hzalaz
Copy link
Member

hzalaz commented Jun 7, 2016

@sbefort thanks, I forgot to update the README when RN 0.26 came out. I'll probably rework that section

@robmoorman
Copy link
Contributor

after updating react-native (react-native upgrade), rnpm ulink react-native-lock and rnpm link react-native-lock it worked for me

@hzalaz
Copy link
Member

hzalaz commented Jun 14, 2016

The correct handling for upgrading react-native is to run react-native upgrade (after changing the react-native version in your package.json) and overwriting all local changes with the ones from the upgrader. Then is just a matter of running rnpm link react-native-lock again to link the library again following the same steps you do the first time you install the library.

If you have other changes like extras dependencies in the Podfile, I'd recommend not overwriting your Podfile

I'll close this and add a Upgrading section in the README

@hzalaz hzalaz closed this as completed Jun 14, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants