$ npm install react-native-ca-mas --save
$ react-native link react-native-ca-mas
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-ca-mas
and addRNCaMas.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNCaMas.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
- Open up
android/app/src/main/java/[...]/MainApplication.java
- Add
import com.armandoassuncao.RNCaMasPackage;
to the imports at the top of the file - Add
new RNCaMasPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-ca-mas' project(':react-native-ca-mas').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-ca-mas/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-ca-mas')
-
Open Xcode's "Build Settings" tab in your project and add
../node_modules/react-native-ca-mas/ios/frameworks
path to "Framework Search Paths" setting.
Open Xcode's "General" tab in your project and add the all.framework
of the../node_modules/react-native-ca-mas/ios/frameworks
folder in "Embedded Binaries" setting. -
do steps 2 of the official documentation:
step 2 -
Put your
msso_config.json
inios/
. Reference -
Open your React-Native project iOS with Xcode, click in "Add Files" and select your
ios/msso_config.json
. -
Append the following lines to
AppDelegate.m
:
#import <MASFoundation/MASFoundation.h> // <- this line
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// other codes
[MAS startWithDefaultConfiguration:YES completion:^(BOOL completed, NSError *error) { }]; // <- this line
return YES;
- In your project, update
app/build.gradle
:
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
minSdkVersion 19
// other configs
}
// other configs
}
-
Put the
msso_config.json
inandroid/src/main/assets/
. -
Append the following lines to
MainApplication.java
:
import com.ca.mas.foundation.MAS; // <- this line
@Override
public void onCreate() {
super.onCreate();
MAS.start(getApplicationContext()); // <- this line
// other methods
}
- if your Android project cause error like:
DexIndexOverflowException: Cannot merge new index 65565 into a non-jumbo instruction!
add in yourapp/build.gradle
:
android {
dexOptions {
jumboMode true
}
- if your Android project cause error like:
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: field ID not in [0, 0xffff]: 65536
add in yourapp/build.gradle
:
android {
defaultConfig {
multiDexEnabled true
...
}