Getting Started with Objective-C
1. Instrumentation
Import the SDK in your AppDelegate
:
#import <ForeSee/ForeSee.h>
#import <ForeSeeCxMeasure/ForeSeeCxMeasure.h>
Start the SDK on the main thread after your application finishes launching:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[ForeSee start];
return YES;
}
And then check for eligibility wherever the invitation should be shown. This example shows how to check for eligibility every time the app is launched:
- (void)applicationDidBecomeActive:(UIApplication *)application {
[ForeSeeCxMeasure checkIfEligibleForSurvey];
}
A complete example:
#import "AppDelegate.h"
#import <ForeSee/ForeSee.h>
#import <ForeSeeCxMeasure/ForeSeeCxMeasure.h>
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[ForeSee start];
return YES;
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
[ForeSeeCxMeasure checkIfEligibleForSurvey];
}
@end
Scene Delegates
ForeSee iOS SDK v6.0.0 adds support for Scene Delegates, which were introduced in Xcode 11 and iOS 13.
2. Feedback
The ForeSeeFeedback framework is a Swift framework. Objective-C apps that implement the Feedback module require these additional steps. First, add Feedback to your Podfile
:
pod 'ForeSee'
pod 'ForeSee/ForeSeeFeedback
Next, embed the Swift standard libraries in "Build Settings" -> "Always Embed Swift Standard Libraries" -> "Yes"
And configure your app for Feedback. Here is a minimal sample Feedback configuration:
{
"clientId":"Ij6P1lfZHchO/co10lQ4BQ==",
"feedback":{
"feedbackSurveys":[
{
"name":"Sample 1",
"feedbackId":"AEvfwfp1vY"
}
]
},
"measures": {}
}
Now import both ForeSee and ForeSeeFeedback in a bridging header. If your application does not already have a bridging header, you can force the creation of one by adding a Swift file to your project (File -> New -> File... -> Swift File).
Xcode should ask whether you want to create the bridging header:


Select "Create Bridging Header."
Now import both ForeSee and ForeSeeFeeback-Swift in your bridging header:
#import <ForeSee/ForeSee.h>
#import <ForeSeeFeedback/ForeSeeFeedback-Swift.h>
You may now use ForeSeeFeedback in Swift inside your Objective-C application. Show the default Feedback survey like this:
ForeSeeFeedbackComponent.showFeedbackSurvey()
Updated over 2 years ago