inbrain-surveys-legacy
v1.0.10
Published
Survey library to monetize your mobile app, provided by inBrain.ai (for Legacy build System, XCode 11.2.1)
Downloads
25
Readme
InBrain Surveys
[Legacy] Survey library to monetize your mobile app, provided by inBrain.ai
Requirements
This SDK is targeted to the following tools:
- XCode 11.2.1 with the Legacy Build System
- Swift 5
- React Native >=0.59.9
If you are using newer versions of these tools, please refer to the 'inbrain-surveys' npm package.
Installation
Install and link the module:
$ npm install inbrain-surveys-legacy --save
$ react-native link inbrain-surveys
Extra steps iOS
Visit your app’s Target in the Project Settings and Choose the General tab. Scroll down until you hit the Embedded Binaries section…
- Press ‘+’, Add Other...
- Select the InBrainSurveys_SDK_Legacy.framework in your project
nodes_modules/inbrain-surveys-legacy/ios/Frameworks
folder and select 'Embed and Sign' - Search for
Framework Search Paths
in your Target and add a recursive entry$(SRCROOT)/../node_modules/inbrain-surveys-legacy
- Confirm
Configure your info.plist as specified here
Add jitpack repository you your gradle configuration android/build.gradle > allprojects > repositories
maven {
// Inbrain
url 'https://jitpack.io'
}`
Usage
import inbrain from 'inbrain-surveys-legacy';
Available functions:
Initialise the SDK
inbrain.init(clientId: string, secretId: string, options?: InitOptions)
- clientId: The client ID obtained from your account manager (NOT USED ON iOS, use info.plist instead)
- clientSecret: The client secret obtained from your account manager.
- options: [Optional] Options. Possible optional options:
- title: The surveys view title
- navbarColor: The surveys view navigation barcolor (hexadecimal string color, e.g #ff0000)
- sessionUid: The session uid obtained from your account manager.
- userId: The user identifier (usually an email)
- dataPoints: Dictionnary containing data points. e.g: { gender: "male", age: "25"}
Show the surveys webview
inbrain.showSurveys()
Get the rewards
inbrain.getRewards() (Useful for server less app)
Confirm a list of rewards
inbrain.confirmRewards(rewards: InBrainReward[]) (Useful for server less app)
- rewards: List of rewards to confirm
On webview dismissed
inbrain.setOnCloseListener(callback: () => void)
- callback: callback to perform when it happens
On webview dismissed from page
inbrain.setOnCloseListenerFromPage(callback: () => void)
- callback: callback to perform when it happens
Development
To install and build locally, pull the repository. Run
npm install
npm run build
npm run start
You can alternatively run 'npm run watch' instead of 'npm run build' if you want live reload.
Troubleshoots
[BUILD TIME] 'InBrainSurveys_SDK_Legacy/InBrainSurveys_SDK_Legacy-Swift.h' file not found
This problem usually happens if the framework is not set in the Embedded Binaries. See above for set up. Clean and build the project after changes.
[BUILD TIME] framework not found InBrainSurveys_SDK_Legacy
This problem usually happens if the 'Framework Search Path' is not set correctly or the framework is not Embedded with the app. See above for set up. Clean and build the project after changes.
[RUNTIME] Library not loaded: @rpath/libswiftCore.dylib
This problem can happen if your project doesn't have the Swift standard libraries included. Set the 'Always Embed Swift Standard Libraries' to yes in your target to fix it. Clean and build the project after changes. This problem also consistently appears when usinx XCode10
[RUNTIME] Application crashing without obvious reasons
This problem can happen if you didn't configure the info.plist correctly. See above for set up. Clean and build the project after changes.