Skip to content

Instantly share code, notes, and snippets.

@achuvm
Created April 20, 2018 19:36
Show Gist options
  • Save achuvm/a085121a46fe8d9f6e0c9a20c5ef5dd2 to your computer and use it in GitHub Desktop.
Save achuvm/a085121a46fe8d9f6e0c9a20c5ef5dd2 to your computer and use it in GitHub Desktop.
diff --git a/ios/Podfile b/ios/Podfile
new file mode 100644
index 0000000..44e11ea
--- /dev/null
+++ b/ios/Podfile
@@ -0,0 +1,6 @@
+platform :ios, '9.3'
+target 'ViroSample' do
+ use_frameworks!
+ pod 'ViroReact', :path => '../node_modules/react-viro/ios/'
+ pod 'ViroKit', :path => '../node_modules/react-viro/ios/dist/ViroRenderer/'
+end
diff --git a/ios/ViroSample/Info.plist b/ios/ViroSample/Info.plist
index 40e6962..5d2a194 100644
--- a/ios/ViroSample/Info.plist
+++ b/ios/ViroSample/Info.plist
@@ -24,6 +24,23 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
+ <key>NSAppTransportSecurity</key>
+ <dict>
+ <key>NSAllowsArbitraryLoads</key>
+ <true/>
+ <key>NSExceptionDomains</key>
+ <dict>
+ <key>localhost</key>
+ <dict>
+ <key>NSExceptionAllowsInsecureHTTPLoads</key>
+ <true/>
+ </dict>
+ </dict>
+ </dict>
+ <key>NSCameraUsageDescription</key>
+ <string>Camera is used to scan the QR code of your VR headset.</string>
+ <key>NSLocationWhenInUseUsageDescription</key>
+ <string></string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
@@ -38,19 +55,5 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
- <key>NSLocationWhenInUseUsageDescription</key>
- <string></string>
- <key>NSAppTransportSecurity</key>
- <!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
- <dict>
- <key>NSExceptionDomains</key>
- <dict>
- <key>localhost</key>
- <dict>
- <key>NSExceptionAllowsInsecureHTTPLoads</key>
- <true/>
- </dict>
- </dict>
- </dict>
</dict>
</plist>
diff --git a/ios/proj_add_shell_script.rb b/ios/proj_add_shell_script.rb
new file mode 100644
index 0000000..4cee16c
--- /dev/null
+++ b/ios/proj_add_shell_script.rb
@@ -0,0 +1,21 @@
+require 'xcodeproj'
+project_name = ARGV[0]
+path_to_project = "#{project_name}.xcodeproj"
+project = Xcodeproj::Project.open(path_to_project)
+main_target = project.targets.first
+phase = main_target.new_shell_script_build_phase("Execute Ngrok")
+phase.shell_script = "$SRCROOT/ngrok_launch.sh"
+
+
+phaseTwo = main_target.new_shell_script_build_phase("Copy ngrok endpoint")
+phaseTwo.shell_script = "DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH\nendpointfile=\"ngrokendpoint.txt\"\nif [[ -e \"$SRCROOT/$endpointfile\" ]]; then\necho \"Ngrok endpoint file found, copying over...\"\ncp \"$SRCROOT/$endpointfile\" \"$DEST/$endpointfile\"\nbreak;\nfi"
+
+project.targets.each do |target|
+ target.build_configurations.each do |config|
+ config.build_settings['ENABLE_BITCODE'] = 'NO'
+ config.build_settings['DEAD_CODE_STRIPPING'] = 'YES'
+ end
+end
+
+
+project.save()
@achuvm
Copy link
Author

achuvm commented Apr 20, 2018

The changes required are as follows:

  1. Update your /ios/Podfile to include ViroReact and ViroKit. Then run pod install.
  2. Add a few permission keys to your Info.plist.
  3. Update your project file to have ENABLE_BITCODE set to NO and DEAD_CODE_STRIPPING set to YES.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment