Merge pull request #177 from realm/sk-code-sign-fix

Fixes for running apps on device
This commit is contained in:
Scott Kyle 2015-12-08 12:57:46 -08:00
commit 1231a45780
8 changed files with 637 additions and 338 deletions

View File

@ -12,8 +12,8 @@ The ReactNative example project is in the `examples/ReactExample` directory. You
## ReactNative Project Setup
- Create a new ReactNative project `react-native init <project-name>` and open the generated XCode project.
- Drag `RealmJS.xcodeproj` into the `Libraries` folder in your project.
- Drag `RealmReact.framework` from the `Products` directory under `RealmJS.xcodeproj` into the `Embedded Binaries` section in the `General` tab for your app's target settings. This bundles the library with your app.
- In the `Build Phases` tab for your app's target settings, add `RealmReact.framework` in the `Target Dependencies` and `Link Binary with Library` build phases.
- Drag `RealmReact.framework` from the `Products` directory under `RealmJS.xcodeproj` into the `Embedded Binaries` section in the `General` tab for your app's target settings. Make sure the checkbox under `Code Sign On Copy` is **not checked** because having it checked will cause issues when trying to run your app on a device.
- In the `Build Phases` tab for your app's target settings, add `RealmReact.framework` to the `Link Binary with Library` build phases.
- In your app's `package.json` file, add the `realm` dependency with a path to the `realm-js/lib` folder like this: `"realm": "file:path/to/realm-js/lib"` (symlinks are not yet supported by the React Native packager, see [issue #637](https://github.com/facebook/react-native/issues/637)).
- You can now `require('realm')` in your app's JS to use Realm!

7
RealmJS.mm Normal file
View File

@ -0,0 +1,7 @@
/* Copyright 2015 Realm Inc - All Rights Reserved
* Proprietary and Confidential
*/
#import "RealmJS.h"
// This file needs to exist for RealmJS.framework to build properly.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0710"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F63FF2EF1C16405C00B3B8E0"
BuildableName = "libGCDWebServers.a"
BlueprintName = "GCDWebServers"
ReferencedContainer = "container:RealmJS.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F63FF2EF1C16405C00B3B8E0"
BuildableName = "libGCDWebServers.a"
BlueprintName = "GCDWebServers"
ReferencedContainer = "container:RealmJS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F63FF2EF1C16405C00B3B8E0"
BuildableName = "libGCDWebServers.a"
BlueprintName = "GCDWebServers"
ReferencedContainer = "container:RealmJS.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0710"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F63FF2B01C1241E500B3B8E0"
BuildableName = "libRealmJS.a"
BlueprintName = "RealmJS static"
ReferencedContainer = "container:RealmJS.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F63FF2B01C1241E500B3B8E0"
BuildableName = "libRealmJS.a"
BlueprintName = "RealmJS static"
ReferencedContainer = "container:RealmJS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F63FF2B01C1241E500B3B8E0"
BuildableName = "libRealmJS.a"
BlueprintName = "RealmJS static"
ReferencedContainer = "container:RealmJS.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -126,20 +126,6 @@
remoteGlobalIDString = 58B5119B1A9E6C1200147676;
remoteInfo = RCTText;
};
F636F6E21BCDB72D0023F35C /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0270BC9E1B7D04D700010E03 /* RealmJS.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 02B29A151B7CF7C9008A7E6B;
remoteInfo = RealmReact;
};
F6EA29001BDEEC4B00ECDC7B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 83CBBA2D1A601D0E00E9B192;
remoteInfo = React;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
@ -396,8 +382,6 @@
buildRules = (
);
dependencies = (
F6EA29011BDEEC4B00ECDC7B /* PBXTargetDependency */,
F636F6E31BCDB72D0023F35C /* PBXTargetDependency */,
);
name = ReactExample;
productName = "Hello World";
@ -640,16 +624,6 @@
target = 13B07F861A680F5B00A75B9A /* ReactExample */;
targetProxy = 0277984B1BBB2F1000C96559 /* PBXContainerItemProxy */;
};
F636F6E31BCDB72D0023F35C /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = RealmReact;
targetProxy = F636F6E21BCDB72D0023F35C /* PBXContainerItemProxy */;
};
F6EA29011BDEEC4B00ECDC7B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = React;
targetProxy = F6EA29001BDEEC4B00ECDC7B /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */

30
scripts/download-core.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
set -e
set -o pipefail
: ${REALM_CORE_VERSION:=0.94.4} # set to "current" to always use the current build
echo "Downloading dependency: core ${REALM_CORE_VERSION}"
TMP_DIR="$TMPDIR/core_bin"
mkdir -p "${TMP_DIR}"
CORE_TMP_TAR="${TMP_DIR}/core-${REALM_CORE_VERSION}.tar.bz2.tmp"
CORE_TAR="${TMP_DIR}/core-${REALM_CORE_VERSION}.tar.bz2"
if [ ! -f "${CORE_TAR}" ]; then
curl -f -L -s "https://static.realm.io/downloads/core/realm-core-${REALM_CORE_VERSION}.tar.bz2" -o "${CORE_TMP_TAR}" ||
(echo "Downloading core failed. Please try again once you have an Internet connection." && exit 1)
mv "${CORE_TMP_TAR}" "${CORE_TAR}"
fi
(
cd "${TMP_DIR}"
rm -rf core
tar xjf "${CORE_TAR}"
mv core core-${REALM_CORE_VERSION}
)
rm -rf core-${REALM_CORE_VERSION} core
mv ${TMP_DIR}/core-${REALM_CORE_VERSION} .
ln -s core-${REALM_CORE_VERSION} core

View File

@ -25,7 +25,7 @@
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
F6F405C71BCE566300A1E24F /* RealmReact.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 0277991B1BBF3BB700C96559 /* RealmReact.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
F6F405C71BCE566300A1E24F /* RealmReact.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 0277991B1BBF3BB700C96559 /* RealmReact.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -127,13 +127,6 @@
remoteGlobalIDString = 58B5119B1A9E6C1200147676;
remoteInfo = RCTText;
};
F6F405B71BCE55FB00A1E24F /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 027799061BBF3BB700C96559 /* RealmJS.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 02B29A151B7CF7C9008A7E6B;
remoteInfo = RealmReact;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
@ -382,7 +375,6 @@
buildRules = (
);
dependencies = (
F6F405B81BCE55FB00A1E24F /* PBXTargetDependency */,
);
name = ReactTestApp;
productName = "Hello World";
@ -626,11 +618,6 @@
target = 13B07F861A680F5B00A75B9A /* ReactTestApp */;
targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */;
};
F6F405B81BCE55FB00A1E24F /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = RealmReact;
targetProxy = F6F405B71BCE55FB00A1E24F /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */