* CoreTelephony.framework
* SystemConfiguration.framework
* UserNotifications.framework
* libXG-SDK.a
* libz.tbd
* libsqlite3.0.tbd
注意:checkTargetOtherLinkFlagForObjc报错,是因为build setting中,Other link flags未添加-ObjC
/**
收到推送的回调
@param application UIApplication 实例
@param userInfo 推送时指定的参数
@param completionHandler 完成回调
*/
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
[[XGPush defaultManager] reportXGNotificationInfo:userInfo];
completionHandler(UIBackgroundFetchResultNewData);
}
// iOS 10 新增回调 API
// App 用户点击通知
// App 用户选择通知中的行为
// App 用户在通知中心清除消息
// 无论本地推送还是远程推送都会走这个回调
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
- (void)xgPushUserNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
withCompletionHandler:(void (^)(void))completionHandler
{
[[XGPush defaultManager] reportXGNotificationResponse:response];
completionHandler();
}
// App 在前台弹通知需要调用这个接口
- (void)xgPushUserNotificationCenter:(UNUserNotificationCenter *)center
willPresentNotification:(UNNotification *)notification
withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler
{
[[XGPush defaultManager] reportXGNotificationInfo:notification.request.content.userInfo];
completionHandler(UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert);
}
#endif
//打开debug开关
[[XGPush defaultManager] setEnableDebug:YES];
/**
@brief 监控信鸽推送服务地启动情况
@param isSuccess 信鸽推送是否启动成功
@param error 信鸽推送启动错误的信息
*/
- (void)xgPushDidFinishStart:(BOOL)isSuccess error:(nullable NSError *)error;
/**
@brief 向信鸽服务器注册设备token的回调
@param deviceToken 当前设备的token
@param error 错误信息
@note 当前的token已经注册过之后,将不会再调用此方法
*/
- (void)xgPushDidRegisteredDeviceToken:(nullable NSString *)deviceToken error:(nullable NSError *)error;
-[AppDelegate xgPushDidFinishStart:error:], result OK, error (null)
[xgpush] clientid is 331F8A86-CDF5-4C6F-BF8C-13EFB8EAD34E
package Size is 359
[xgpush]Current device token is c4294001507045547bfe64581eecb95f6d6a46c9cf9a9a0878233f6c0e8e3b8f
[xgpush info]msgLen's length is 108
[xgpush] 服务器返回码: 0
-[AppDelegate xgPushDidRegisteredDeviceToken:error:], result OK, error (null)