Skip to content

Commit

Permalink
fix: Add Static Library Install Steps (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonStalnaker authored Mar 22, 2024
1 parent b2090b0 commit 5c4b767
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,42 @@ $ npm install react-native-mparticle --save

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

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

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.
```bash
$ # Update your Podfile to be ready to use dynamically linked frameworks by commenting out the following line
$ # :flipper_configuration => flipper_config,
pre_install do |installer|
installer.pod_targets.each do |pod|
if pod.name == 'mParticle-Apple-SDK'
def pod.build_type;
Pod::BuildType.new(:linkage => :dynamic, :packaging => :framework)
end
end
end
end
```
Then run the following command
```
bundle exec pod install
```
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.
Update your Podfile to be ready to use dynamically linked frameworks by commenting out the following line
```bash
# :flipper_configuration => flipper_config,
```
Then run either of the following commands
```
$ USE_FRAMEWORKS=static bundle exec pod install
```
or
```
$ USE_FRAMEWORKS=dynamic bundle exec pod install
```
3. Import and start the mParticle Apple SDK into Swift or Objective-C.
The mParticle SDK is initialized by calling the `startWithOptions` method within the `application:didFinishLaunchingWithOptions:` delegate call.
Preferably the location of the initialization method call should be one of the last statements in the `application:didFinishLaunchingWithOptions:`.
Expand All @@ -49,9 +76,6 @@ The `startWithOptions` method requires an options argument containing your key a
For more help, see [the iOS set up docs](https://docs.mparticle.com/developers/sdk/ios/getting-started/#create-an-input).
3. Import and start the mParticle Apple SDK into Swift or Objective-C.


#### Swift Example
```swift
Expand Down

0 comments on commit 5c4b767

Please sign in to comment.