Flurry Push-уведомления в Swift - PullRequest
0 голосов
/ 23 мая 2018

Я использую Flurry, чтобы попытаться отправить push-уведомления, учебник для всех других элементов Flurry, таких как аналитика, события и т. Д., Все они имеют Swift и Obj-C, однако для Push все в Obj-C.

Я добавил flurry ios sdk, и все работает хорошо, потому что я вижу свои данные на сайте суматохи.

Я застрял на этом этапе, когда он говорит мне

Включить FlurryMessaging.h

Как включить файл .h в Swift?

Затем он просит меня сделать следующее, но его нет в Swift

(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

//Step1 : Call the Integration API

[FlurryMessaging setAutoIntegrationForMessaging];

//Step2 (Optional): Get a callback

[FlurryMessaging setMessagingDelegate:self];

FlurrySessionBuilder* builder = [[[FlurrySessionBuilder alloc] withIncludeBackgroundSessionsInMetrics:YES];

[Flurry startSession:@”API_KEY” withOptions:launchOptions withSessionBuilder:builder];

return YES;

}

Implement the Delegate method for Received
-(void) didReceiveMessage:(nonnull FlurryMessage*)message

{

NSLog(@”didReceiveMessage = %@”, [message description]);

//App specific implementation

}

Implement the Delegate method for Clicked
-(void) didReceiveActionWithIdentifier:(nullable NSString*)identifier message:(nonnull FlurryMessage*)message

{

NSLog(@”didReceiveAction %@ , Message = %@”,identifier, [message description]);

//Any app specific logic goes here.

//Ex: Deeplink logic (loading of viewControllers (nibs or storboards),

//additional logging, etc

}

1 Ответ

0 голосов
/ 24 мая 2018

Если вы интегрируетесь через Cocoapods, обязательно включите Flurry-iOS-SDK / FlurryMessaging в ваш подфайл.Если у вас есть, то вы можете получить доступ к методам обмена сообщениями, добавив это в свои операторы импорта:

import Flurry_iOS_SDK

Затем установите автоматическую интеграцию:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

FlurryMessaging.setAutoIntegrationForMessaging()
FlurryMessaging.setMessagingDelegate(self)

//And set up your Builder:

let builder = FlurrySessionBuilder.init()

    .withIncludeBackgroundSessionsInMetrics(true)

Flurry.startSession("YOUR_API_KEY", with: builder)
return true
}

Реализация делегатаметод для Получено

func didReceive(_ message: FlurryMessage) {
    print("Did Receive Message")
    //App specific implementation
}

Реализация метода делегата для Clicked

func didReceiveAction(withIdentifier identifier: String?, message: FlurryMessage) {
    print("Message Clicked")
    //Any app specific logic goes here.
}
...