Skip to main content

bfgManager Class

Initialize the Big Fish Game Components. More...#import <bfgManager.h>

Class Methods

(NSInteger) + sessionCount
 
(BOOL) + isInitialLaunch
 
(BOOL) + isFirstTime
 
(BOOL) + isInitialized
 
(NSNumber *_Nonnull) + userID
 
(void) + setUserID:
 
(void) + setAttributionUserID:
 
(void) + showSupport
 
(void) + showPrivacy
 
(void) + showTerms
 
(BOOL) + showWebBrowser:
 
(void) + removeWebBrowser
 
(BOOL) + checkForInternetConnection
 
(BOOL) + checkForInternetConnectionAndAlert:
 
(void) + setParentViewController:
 
(UIViewController *_Nonnull) + parentViewController
 
(NSMutableDictionary *_Nullable) + debugDictionary
 
(void) + limitEventAndDataUsage:
 
(ios(14.5) + API_AVAILABLE
 
(BOOL) + attSelectionRequired
 
(BOOL) + attMeetsSystemRequirements
 
(void) + applicationDidReceiveLocalNotification
 
(BOOL) + applicationOpenURL:options:
 Call this method from your app delegate at the beginning of applicationOpenURL:options. More...
 
(BOOL) + applicationContinueUserActivity:restorationHandler:
 Call this method from your app delegate at the beginning of application:continueUserActivity:userActivity restorationHandler. More...
 
(void) + applicationDidRegisterForRemoteNotificationsWithDeviceToken:
 Call this method from your app delegate at the beginning of application:didRegisterForRemoteNotificationsWithDeviceToken: More...
 
(void) + applicationDidFailToRegisterForRemoteNotificationsWithError:
 Call this method from your app delegate at the beginning of application:didFailToRegisterForRemoteNotificationsWithError: More...
 
(void) + applicationDidReceiveRemoteNotification:
 Call this method from your app delegate at the beginning of application:didReceiveRemoteNotification: More...
 
(void) + applicationDidRegisterUserNotificationSettings:
 Call this method from your app delegate at the beginning of application:didRegisterUserNotificationSettings: More...
 
(void) + addPauseResumeDelegate:
 
(void) + removePauseResumeDelegate:
 
(BOOL) + isPaused
 
(BOOL) + startWithLaunchOptions:parentViewController:
 
(BOOL) + initWithLaunchOptions:
 
(BOOL) + startWithParentViewController:
 
(void) + addPolicyListener:willShowPolicies:onPoliciesCompleted:
 
(void) + removePolicyListener:
 
(BOOL) + didAcceptPolicyControl:
 

Detailed Description

Initialize the Big Fish Game Components. You should initialize the bfgManager when your application finishes launching with either your root view controller or your main window. If your main window is ready inside the AppDelegate, then you will use this call:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
[bfgManager startWithLaunchOptions:launchOptions parentViewController:myRootViewController];
...
}
Initialize the Big Fish Game Components.
Definition: bfgManager.h:129
UIViewController *_Nonnull parentViewController()
If your main window will not be ready until later, then you will do the following. In the AppDelegate:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
[bfgManager initWithLaunchOptions:launchOptions];
...
}
Then, whenever your main window is ready:
- (void)myMainWindowReady
{
...
[bfgManager startWithParentViewController:myMainViewController];
...
}
If you are using these APIs, you should become an observer for the following events:
  • BFG_NOTIFICATION_COLD_START - Sent after the app is foregrounded and this is a first launch.
  • BFG_NOTIFICATION_WARM_START - Sent after the app is foregrounded and this is not a first launch.
Lastly, if you are interested in pausing and resuming your game when the SDK is doing something that will obscure your game window (e.g., presenting an upsell), you can become a delegate for these events by implementing the bfgManagerPauseResumeDelegate .

Method Documentation

◆ addPauseResumeDelegate:

+ (void) addPauseResumeDelegate: (id< bfgManagerPauseResumeDelegate > _Nonnull) delegate
Call this method to add a delegate to listen for pause/resume events from the SDK.
Parameters
delegateThe object that will act as a delegate for pause/resume events. Needs to conform to the bfgManagerPauseResumeDelegate .
Since
6.0

◆ addPolicyListener:willShowPolicies:onPoliciesCompleted:

+ (void) addPolicyListener: (nonnull id) listener
willShowPolicies:(nullable bfgManagerWillShowPoliciesBlockwillShowPolicies
onPoliciesCompleted:(nullable bfgManagerOnPoliciesCompletedBlockonPoliciesCompleted 
Respond to the manager showing the screen or perform actions when the UI is cleared. Can only have one set of blocks per listener. Care should be exercised in the completion blocks not to create strong references to the listener, as this can lead to a retain cycle where you may believe you no longer have a reference to the listener, but the completion blocks stored by the manager do. If you need to reference listener inside a block, then use a weak reference such as "__weak __typeof(self) weakSelf = self", then use "weakSelf" inside the block.
Parameters
listenerShould always be self.
willShowPoliciesThe code block you want executed if the manager is going to present the UI. Always called on the main thread.
onPoliciesCompletedThe code block you want executed whenever the manager is done. This can be called either because the user accepted all policies or because the user was not required to accept any policies. Will be executed immediately upon adding if policies have already been cleared. Always called on the main thread.
Since
6.7

◆ API_AVAILABLE

+ (ios(14.5) API_AVAILABLE
Displays a native Apple prompt to request tracking authorization, i.e IDFA access.
Warning
This method is only available on iOS 14.5 and above.
Since
7.2

◆ applicationContinueUserActivity:restorationHandler:

+ (BOOL) applicationContinueUserActivity: (NSUserActivity *_Nonnull) userActivity
restorationHandler:(void(^)(NSArray *_Nullable restorableObjects)) restorationHandler 
Call this method from your app delegate at the beginning of application:continueUserActivity:userActivity restorationHandler. Universal deeplinks trigger this delegate method instead of openURL.
Parameters
userActivityFrom the delegate call.
restorationHandlerFrom the delegate call.
Return values
YESThe SDK acted upon the App Link.
NOThe SDK did not act upon the App Link.
Note
A known issue is causing this method always to return YES. Always inspect the activity if you might need to handle it.
Since
5.11

◆ applicationDidFailToRegisterForRemoteNotificationsWithError:

+ (void) applicationDidFailToRegisterForRemoteNotificationsWithError: (NSError *_Nonnull) error
Call this method from your app delegate at the beginning of application:didFailToRegisterForRemoteNotificationsWithError:
Parameters
errorFrom the delegate call.
Since
5.10

◆ applicationDidReceiveLocalNotification

+ (void) applicationDidReceiveLocalNotification
Call this method from your app delegate at the beginning of application:didReceiveLocalNotification:
Since
5.8

◆ applicationDidReceiveRemoteNotification:

+ (void) applicationDidReceiveRemoteNotification: (NSDictionary *_Nonnull) userInfo
Call this method from your app delegate at the beginning of application:didReceiveRemoteNotification:
Parameters
userInfoFrom the delegate call.
Since
5.10

◆ applicationDidRegisterForRemoteNotificationsWithDeviceToken:

+ (void) applicationDidRegisterForRemoteNotificationsWithDeviceToken: (NSData *_Nonnull) deviceToken
Call this method from your app delegate at the beginning of application:didRegisterForRemoteNotificationsWithDeviceToken: This method is critical for Big Fish to set up push notifications for your app.
Parameters
deviceTokenFrom the delegate call.
Since
5.10

◆ applicationDidRegisterUserNotificationSettings:

+ (void) applicationDidRegisterUserNotificationSettings: (UIUserNotificationSettings *_Nonnull) notificationSettings
Call this method from your app delegate at the beginning of application:didRegisterUserNotificationSettings:
Parameters
notificationSettingsFrom the delegate call.
Since
5.10

◆ applicationOpenURL:options:

+ (BOOL) applicationOpenURL: (NSURL *_Nonnull) url
options:(NSDictionary< NSString *, id > *_Nullable) options 
Call this method from your app delegate at the beginning of applicationOpenURL:options. The app delegate may be asked to open a resource via a URL. Some URLs can be handled by the Big Fish SDK. This method supports versions of iOS 9+.
Parameters
urlFrom the delegate call.
optionsFrom the delegate call.
Note
A known issue is causing this method always to return YES. Always inspect the URL to see if you need to handle it.
Return values
YESThe SDK acted upon the App Link.
NOThe SDK did not act upon the App Link.
Since
5.10

◆ attMeetsSystemRequirements

+ (BOOL) attMeetsSystemRequirements
Returns TRUE if iOS version meets requirements to handle App Tracking Transparency
Since
7.2

◆ attSelectionRequired

+ (BOOL) attSelectionRequired
Returns TRUE if user must make a selection via App Tracking Transparency dialog
Since
7.2

◆ checkForInternetConnection

+ (BOOL) checkForInternetConnection
Returns
Return values
YESif there is a connection to the Internet.
NOif there is not a connection to the Internet, and displays alert.

◆ checkForInternetConnectionAndAlert:

+ (BOOL) checkForInternetConnectionAndAlert: (BOOL) displayAlert
Parameters
displayAlertIf YES, displays a UIAlert that it cannot connect to the Internet.
Returns
Return values
YESif can connect to the Internet.
NOif cannot connect to the Internet.

◆ debugDictionary

+ (NSMutableDictionary *_Nullable) debugDictionary
Certain aspects of the SDK can be flagged for debugging either in bfgSettings or with a bfgDebug.json file placed in the Documents folder. To programmatically set flags, you can make changes directly to this dictionary.
Returns
A mutable dictionary of debug settings.
Since
5.7

◆ didAcceptPolicyControl:

+ (BOOL) didAcceptPolicyControl: (nonnull NSString *) policyControl
Check if the user has accepted a specific control.
Parameters
policyControlThe control you are interested in checking.
Returns
YES if the user has accepted the control, NO if declined or there is no record of the user accepting it.
Since
6.7

◆ initWithLaunchOptions:

+ (BOOL) initWithLaunchOptions: (NSDictionary *_Nonnull) launchOptions
Call this method from your app delegate in application:didFinishLaunchingWithOption: when your SDK view controller IS NOT available.
Parameters
launchOptionsThe launch options sent to the delegate call.
Since
6.0

◆ isFirstTime

+ (BOOL) isFirstTime
Application has been started from a cold-started.

◆ isInitialized

+ (BOOL) isInitialized
Returns
Return values
YESif bfgManger initialized.
NOif bfgManger did not initialize.

◆ isInitialLaunch

+ (BOOL) isInitialLaunch
It is the initial launch or "install" of the application.

◆ isPaused

+ (BOOL) isPaused
Test to see if game should be paused.
Return values
YESThe game should be paused.
NOThe game should not be paused.
Since
6.0

◆ limitEventAndDataUsage:

+ (void) limitEventAndDataUsage: (BOOL) limitData
Helper method to allow a game to limit event and data usage in the Facebook SDK without having to call into the FBSDK directly. Primarily used by the Unity Wrapper.
Parameters
limitDataA boolean value indicating whether events/data usage should should be limited.
Since
7.1

◆ parentViewController

+ (UIViewController *_Nonnull) parentViewController
Gets the parent view controller.
Returns
Returns the parent view controller.

◆ removePauseResumeDelegate:

+ (void) removePauseResumeDelegate: (id< bfgManagerPauseResumeDelegate > _Nonnull) delegate
Call this method to remove a pause/resume event delegate.
Parameters
delegateThe delegate you wish to remove. Needs to conform to the bfgManagerPauseResumeDelegate .
Since
6.0

◆ removePolicyListener:

+ (void) removePolicyListener: (nonnull id) listener
Removes the listener.
Parameters
listenerThe listener to remove.
Since
6.7

◆ removeWebBrowser

+ (void) removeWebBrowser
Removes the in-game browser shown via showWebBrowser:

◆ sessionCount

+ (NSInteger) sessionCount
Number of session for the application. Incremented on each UIApplicationDidBecomeActiveNotification.

◆ setAttributionUserID:

+ (void) setAttributionUserID: (NSString *_Nullable) attributionUserID
Sets attributionUserID, the unique string identifying this user to attribution. Used in all reporting calls to services.
Parameters
attributionUserIDThe unique string identifying this user.

◆ setParentViewController:

+ (void) setParentViewController: (UIViewController *_Nonnull) parent
The view controller to use when showing any UI, for both startup and resume. If you change your root ViewController for your application, you should update bfgManager.

◆ setUserID:

+ (void) setUserID: (NSNumber *_Nullable) userID
Sets gameUID, the unique integer identifying this user. Used in all reporting calls to services.
Parameters
userIDThe unique integer identifying this user. If nil is passed, GameUID will be set back to the current UID value.

◆ showPrivacy

+ (void) showPrivacy
Shows the Privacy page in Mobile Safari.

◆ showSupport

+ (void) showSupport
Shows Help Desk Support using Zendesk SDK.
Updated:\n 6.5

◆ showTerms

+ (void) showTerms
Shows the Terms of Use page in Mobile Safari.

◆ showWebBrowser:

+ (BOOL) showWebBrowser: (NSString *_Nullable) startPage
Shows an in-game browser displaying startPage.
Returns
Web browser can be created.

◆ startWithLaunchOptions:parentViewController:

+ (BOOL) startWithLaunchOptions: (NSDictionary *_Nonnull) launchOptions
parentViewController:(UIViewController *_Nonnull) parentViewController 
Call this method from your app delegate in application:didFinishLaunchingWithOption: when the view controller for the SDK is available.
Parameters
launchOptionsThe launch options sent to the delegate call.
parentViewControllerThe view controller the SDK should use.
Since
6.0

◆ startWithParentViewController:

+ (BOOL) startWithParentViewController: (UIViewController *_Nonnull) parentViewController
Call this method when your view controller was not ready in application:didFinishLaunchingWithOption: and it has finally been initialized.
Parameters
parentViewControllerThe view controller the SDK should use.
Since
6.0

◆ userID

+ (NSNumber *_Nonnull) userID
Gets the unique integer identifying this user. Used in all reporting calls to services.
Returns
Obtains the GameUID, and defaults to UID if it does not exist. If UID does not exist, it defaults to zero.