MCLDelegate
@protocol MCLDelegate <NSObject>
Implement this protocol to get callbacks for events happening in the SDK. All methods are optional.
-
Optional callback when a user has completed a share.
Integration:
1) Add MCLDelegate to your interface:
\@interface ViewController ()<MCLDelegate>
2) Pass the delegate to the SDK during startup:
-[Megacool startWithAppConfig:@"<appConfig>" andConfigBlock:^(MCLMegacoolConfig *config) { config.delegate = self; }];
3) Implement the method somewhere in your code:
- (void)megacoolDidCompleteShare { NSLog(@"Reward Player"); }
Note
This method being called does not imply that anyone has actually joined the game from the share, only that the share was probably sent to some app. Not all apps report this correctly.Declaration
Objective-C
- (void)megacoolDidCompleteShare;
Swift
optional func megacoolDidCompleteShare()
-
Optional callback when a user has aborted (dismissed) a share.
Integration:
1) Add MCLDelegate to your interface:
\@interface ViewController ()<MCLDelegate>
2) Pass the delegate to the SDK during startup:
-[Megacool startWithAppConfig:@"<appConfig>" andConfigBlock:^(MCLMegacoolConfig *config) { config.delegate = self; }];
3) Add the method somewhere in your code:
- (void)megacoolDidDismissShareView{ NSLog(@"Dismissed share modal"); }
Declaration
Objective-C
- (void)megacoolDidDismissShareView;
Swift
optional func megacoolDidDismissShareView()
-
A link was clicked by the user.
This event is purely local to the device and thus both available offline and very fast, and thus suitable for navigation within the app (with sanity checking of destinations).
Declaration
Objective-C
- (void)megacoolLinkClicked:(nonnull MCLLinkClickedEvent *)event;
Swift
optional func megacoolLinkClicked(_ event: MCLLinkClickedEvent)
-
This device clicked on a share sent by someone else.
This event comes from the server when it detects that the user has clicked on a share. This happens during installs or re-engagements (check
MCLReceivedShareOpenedEvent.isFirstSession
to determine which type of session you’re in) and can be used to automatically connect the user to the person who sent the share in the game (usingMCLReceivedShareOpenedEvent.senderUserId
).Declaration
Objective-C
- (void)megacoolReceivedShareOpened: (nonnull MCLReceivedShareOpenedEvent *)event;
Swift
optional func megacoolReceivedShareOpened(_ event: MCLReceivedShareOpenedEvent)
-
A share sent by this user was clicked on by someone else.
Use this event to reward the user for referring a friend. Use
MCLSentShareOpenedEvent.isFirstSession
to tell if the referral resulted in a new install or a re-engagement, or useMCLSentShareOpenedEvent.receiverUserId
to automatically connect the users in the app.Declaration
Objective-C
- (void)megacoolSentShareOpened:(nonnull MCLSentShareOpenedEvent *)event;
Swift
optional func megacoolSentShareOpened(_ event: MCLSentShareOpenedEvent)