Ios Swift中的Flurry推送通知
我正在使用Flurry尝试发送推送通知,Flurry的所有其他元素(如分析、事件等)的教程都有Swift和Obj-C,而推送的全部内容都在Obj-C中 我已经添加了flurry ios sdk,一切正常,因为我可以在flurry站点上查看我的数据 当它让我这么做的时候,我被困在这一点上了 包括FlurryMessaging.h 如何在Swift中包含.h文件 然后它要求我做以下事情,但不是用SwiftIos Swift中的Flurry推送通知,ios,swift,flurry,Ios,Swift,Flurry,我正在使用Flurry尝试发送推送通知,Flurry的所有其他元素(如分析、事件等)的教程都有Swift和Obj-C,而推送的全部内容都在Obj-C中 我已经添加了flurry ios sdk,一切正常,因为我可以在flurry站点上查看我的数据 当它让我这么做的时候,我被困在这一点上了 包括FlurryMessaging.h 如何在Swift中包含.h文件 然后它要求我做以下事情,但不是用Swift (BOOL)application:(UIApplication *)application
(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
}
如果您是通过Cocoapods进行集成,请确保在您的podfile中包含“Flurry iOS SDK/FlurryMessage”。如果有,则可以通过将其添加到导入语句来访问消息传递方法: 导入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
}
为单击的对象实现委托方法
func didReceiveAction(withIdentifier identifier: String?, message: FlurryMessage) {
print("Message Clicked")
//Any app specific logic goes here.
}