If you are looking for a customizble iMessage sticker project with Fabric integrated, see github.com/Fluffcorn.
How to integrate Fabric with your own iOS extension (with API key and build secret isolation for public projects and distribution)
-
Download the Fabric frameworks.
-
Import frameworks into your Xcode project
- Create
fabric.apikey
andfabric.buildsecret
files in Xcode project directory root. Put your Fabric API key and build secret into the files respectively.
-
Add the below lines to the project
.gitignore
file if you intend on making the project public.fabric.apikey fabric.buildsecret
-
Add Run Script below to your extension target. Run Script is located under the [ExtensionTarget] > Build Phases.
FABRIC_APIKEY=$(cat ${SRCROOT}/fabric.apikey) FABRIC_BUILDSECRET=$(cat ${SRCROOT}/fabric.buildsecret) ${SRCROOT}/Fabric.framework/run ${FABRIC_APIKEY} ${FABRIC_BUILDSECRET}
-
Import frameworks into your initial view controller or class.
#import <Fabric/Fabric.h> #import <Crashlytics/Crashlytics.h>
-
Add or modify
initWithCoder:
method in your initial view controller or class.- (id)initWithCoder:(NSCoder *)decoder { self = [super initWithCoder:decoder]; if (!self) { return nil; } NSURL* resourceURL = [[NSBundle mainBundle] URLForResource:@"fabric.apikey" withExtension:nil]; NSStringEncoding usedEncoding; NSString* fabricAPIKey = [NSString stringWithContentsOfURL:resourceURL usedEncoding:&usedEncoding error:NULL]; NSCharacterSet* whitespaceToTrim = [NSCharacterSet whitespaceAndNewlineCharacterSet]; NSString* fabricAPIKeyTrimmed = [fabricAPIKey stringByTrimmingCharactersInSet:whitespaceToTrim]; [Crashlytics startWithAPIKey:fabricAPIKeyTrimmed]; return self; }
-
Build and Run