Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add Static Library Install Steps #204

Merged
merged 2 commits into from
Mar 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading