Skip to content
This repository has been archived by the owner on Apr 20, 2022. It is now read-only.

Latest commit

 

History

History
114 lines (70 loc) · 4.47 KB

RUNNING_FIRST_TIME_IOS.md

File metadata and controls

114 lines (70 loc) · 4.47 KB

Running WeVoteReactNative on iOS for the First Time

Go back to Installation for iOS Development

Go back to Readme Home

Please make sure you have read:

iOS

Method 1 - Quick

(WebAppEnv) $ cd /Users/<YOUR NAME HERE>/MyProjects/WeVoteReactNative
(WebAppEnv) $ react-native run-ios

This opens the iOS simulator.

Method 2 - Preferred

I recommend this method because then you have easier access to the XCode console log.

  1. Open XCode.

  2. From within XCode, open this project. Be sure to open the xcworkspace! (not the xcodeproj!):

    /Users/\<YOUR NAME HERE\>/MyProjects/WeVoteReactNative/ios/WeVoteReactNative.xcworkspace

Don't pick a project from the reverse blue history list on the top right of the dialog, those are xcodeproj's not the xcodeproj files that you need to use.

alt text

Click the "Open another project..." link at the bottom right, then select the WeVoteReactNative.xcworkspace entry.

alt text

  1. Click the "Play" (sideways triangle button), and this opens the iOS Simulator.

Method 3 - For Webstorm users

See "Developing mobile apps with React Native in WebStorm" - https://blog.jetbrains.com/webstorm/2016/12/developing-mobile-apps-with-react-native-in-webstorm/

Be sure to open the xcworkspace! (not the xcodeproj!):

    /Users/<YOUR NAME HERE>/MyProjects/WeVoteReactNative/ios/WeVoteReactNative.xcworkspace

Additional Notes (iOS)

If your build is failing due to an issue with RCTWebSocket, you may have to follow the following steps:

  1. Cmd+space to bring up spotlight search, type in and double click "RCTWebSocket.xcodeproj".

  2. In the project navigator on the left side, click the RCTWebSocket file and click "Build Settings" on the top navbar.

  3. Select "All" and "Combined" on the second level of the top navbar below "Build Settings".

  4. Look for "Apple LLVM 8.0 - Custom Compiler Flags" and remove all the flags under "Other warning flags". Y ou can do this by double clicking the existing flags and pressing the minus button to remove them individually.

If your build fails due to an error with the message Ignoring return value of function declared with warn_unused_result attribute, proceed as instructed below:

  1. Cmd+space to bring up spotlight search, type in and double click "RCTWebSocket.M".

  2. In "RCTWebSocket.M", find the lines:

   int result = SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key);
   assert(result == 0);

      Comment them out and add the following line:

   //int result = SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key);
   //assert(result == 0);
   (void)SecRandomCopyBytes(kSecRandomDefault, sizeof(uint32_t), (uint8_t *)mask_key);
  1. Also in "RCTWebSocket.M", find the lines:
  int result = SecRandomCopyBytes(kSecRandomDefault, keyBytes.length, keyBytes.mutableBytes);
  assert(result == 0);

      Comment them out and add the following line:

  //int result = SecRandomCopyBytes(kSecRandomDefault, keyBytes.length, keyBytes.mutableBytes);
  //assert(result == 0);
  (void)SecRandomCopyBytes(kSecRandomDefault, keyBytes.length, keyBytes.mutableBytes);

General note about node_modules and manual fixes that we had to make to them

If you are 'stack-overflowing' around trying to resolve npm issues, be careful about deleting all the node modules and re-installing them. You will see recommendations to "rm -rf node_modules" and then "npm i", ie: physically remove all the downloaded node modules and rebuild from fresh copies, based on the latest versions specified in package.json.

The problem with starting from scratch is (unfortunately) other work arounds will have you editing the source in these downloaded modules, and removing all, will end up with all those edits being lost. Eventually we will get to stability with react-native and other modules that include ObjectiveC and Java, but we are not there yet.


Next: Working with WeVoteReactNative Day-to-Day

Go back to Readme Home