Skip to content

Commit 5c4b767

Browse files
fix: Add Static Library Install Steps (#204)
1 parent b2090b0 commit 5c4b767

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

README.md

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,42 @@ $ npm install react-native-mparticle --save
3030

3131
2. **Install the SDK** using CocoaPods:
3232

33+
The npm install step above will automatically include our react framework and the core iOS framework in yur project. However depending on your app and its other dependecies you must integrate it in 1 of 3 ways
34+
35+
A. Static Libraries are the React Native default but since mParticle iOS contains swift code you need to add an exception for it in the from of a pre-install command in the Podfile.
3336
```bash
34-
$ # Update your Podfile to be ready to use dynamically linked frameworks by commenting out the following line
35-
$ # :flipper_configuration => flipper_config,
37+
pre_install do |installer|
38+
installer.pod_targets.each do |pod|
39+
if pod.name == 'mParticle-Apple-SDK'
40+
def pod.build_type;
41+
Pod::BuildType.new(:linkage => :dynamic, :packaging => :framework)
42+
end
43+
end
44+
end
45+
end
3646
```
3747
Then run the following command
3848
```
49+
bundle exec pod install
50+
```
51+
52+
B&C. Frameworks are the default for Swift development and while it isn't preferred by React Native it is supported. Additionally you can define whether the frameworks are built staticly or dynamically.
53+
54+
Update your Podfile to be ready to use dynamically linked frameworks by commenting out the following line
55+
```bash
56+
# :flipper_configuration => flipper_config,
57+
```
58+
Then run either of the following commands
59+
```
60+
$ USE_FRAMEWORKS=static bundle exec pod install
61+
```
62+
or
63+
```
3964
$ USE_FRAMEWORKS=dynamic bundle exec pod install
4065
```
4166
67+
3. Import and start the mParticle Apple SDK into Swift or Objective-C.
68+
4269
The mParticle SDK is initialized by calling the `startWithOptions` method within the `application:didFinishLaunchingWithOptions:` delegate call.
4370
4471
Preferably the location of the initialization method call should be one of the last statements in the `application:didFinishLaunchingWithOptions:`.
@@ -49,9 +76,6 @@ The `startWithOptions` method requires an options argument containing your key a
4976
5077
For more help, see [the iOS set up docs](https://docs.mparticle.com/developers/sdk/ios/getting-started/#create-an-input).
5178
52-
3. Import and start the mParticle Apple SDK into Swift or Objective-C.
53-
54-
5579
#### Swift Example
5680
5781
```swift

0 commit comments

Comments
 (0)