GetSocial iOS SDK Manual Initialization Guide¶
Disable Auto Initialization¶
By default GetSocial SDK is initialized automatically on application start. You can disable this behavior and initialize from code.
Using GetSocial Installer Script¶
If you are using GetSocial Installer script, to disable auto initialization:
- In your Xcode project, open Project settings and select target you want to modify.
-
Go to Build Phases tab → Run Script section:
./getsocial-sdk7.sh --app-id="your-getsocial-app-id"
Using getsocial.json
file¶
- Open
getsocial.json
file. -
Set
autoInit
property tofalse
:... "autoInit": false, ...
Initialize From Code¶
To initialize GetSocial SDK from code, just call GetSocial.initSdk()
.
Most of GetSocial APIs require initialized SDK. You can check SDK initialization state in sync or async way.
if GetSocial.isInitialized() {
// use GetSocial
}
If you want to be notified about initialization complete, you can add a listener, that will be invoked when SDK gets initialized or invoked immediately if it is already initialized:
GetSocial.addOnInitializedListener {
// GetSocial is ready to be used
})
Initialize With Dynamic Application Id¶
Also, you can specify application ID to initialize with from code:
let appId = "<APP_ID>"
GetSocial.initSdk(appId: appId)