176 lines
6.5 KiB
C
Raw Normal View History

2014-01-20 18:27:31 +08:00
//
// APService.h
// APService
//
// Created by JPush on 12-8-15.
// Copyright (c) 2012年 HXHG. All rights reserved.
2015-07-10 15:43:52 +08:00
// Version: 1.8.3
2014-01-20 18:27:31 +08:00
2014-09-24 20:02:07 +08:00
@class CLRegion;
@class UILocalNotification;
2014-01-20 18:27:31 +08:00
2014-09-24 20:02:07 +08:00
extern NSString *const kJPFNetworkDidSetupNotification; // 建立连接
extern NSString *const kJPFNetworkDidCloseNotification; // 关闭连接
extern NSString *const kJPFNetworkDidRegisterNotification; // 注册成功
extern NSString *const kJPFNetworkDidLoginNotification; // 登录成功
2014-06-04 13:20:24 +08:00
extern NSString *const
2014-09-24 20:02:07 +08:00
kJPFNetworkDidReceiveMessageNotification; // 收到消息(非APNS)
extern NSString *const kJPFServiceErrorNotification; // 错误提示
2014-01-20 18:27:31 +08:00
2014-09-24 20:02:07 +08:00
@class CLLocation;
2014-01-20 18:27:31 +08:00
@interface APService : NSObject
2014-09-24 20:02:07 +08:00
#pragma - mark 基本功能
2014-01-20 18:27:31 +08:00
// 以下四个接口是必须调用的
2014-06-04 13:20:24 +08:00
+ (void)setupWithOption:(NSDictionary *)launchingOption; // 初始化
2014-09-24 20:02:07 +08:00
+ (void)registerForRemoteNotificationTypes:(NSUInteger)types
categories:(NSSet *)categories; // 注册APNS类型
2014-06-04 13:20:24 +08:00
+ (void)registerDeviceToken:(NSData *)deviceToken; // 向服务器上报Device Token
+ (void)handleRemoteNotification:(NSDictionary *)
remoteInfo; // 处理收到的APNS消息向服务器上报收到APNS消息
2014-01-20 18:27:31 +08:00
// 下面的接口是可选的
// 设置标签和(或)别名若参数为nil则忽略若是空对象则清空详情请参考文档http://docs.jpush.cn/pages/viewpage.action?pageId=3309913
2014-06-04 13:20:24 +08:00
+ (void)setTags:(NSSet *)tags
alias:(NSString *)alias
callbackSelector:(SEL)cbSelector
target:(id)theTarget;
+ (void)setTags:(NSSet *)tags
alias:(NSString *)alias
callbackSelector:(SEL)cbSelector
object:(id)theTarget;
+ (void)setTags:(NSSet *)tags
callbackSelector:(SEL)cbSelector
object:(id)theTarget;
+ (void)setAlias:(NSString *)alias
callbackSelector:(SEL)cbSelector
object:(id)theTarget;
2014-01-20 18:27:31 +08:00
// 用于过滤出正确可用的tags如果总数量超出最大限制则返回最大数量的靠前的可用tags
2014-06-04 13:20:24 +08:00
+ (NSSet *)filterValidTags:(NSSet *)tags;
2014-09-24 20:02:07 +08:00
#pragma - mark 上报日志
2014-06-04 13:20:24 +08:00
/**
*
* startLogPageView和stopLogPageView为自动计算停留时间
* beginLogPageView为手动自己输入停留时间
*
* @param pageName
* @param seconds
*/
+ (void)startLogPageView:(NSString *)pageName;
+ (void)stopLogPageView:(NSString *)pageName;
+ (void)beginLogPageView:(NSString *)pageName duration:(int)seconds;
2014-01-20 18:27:31 +08:00
2014-09-24 20:02:07 +08:00
/**
* Crash日志收集, .
*/
+ (void)crashLogON;
/**
*
*
* CoreLocation.framework #import <CoreLocation/CoreLocation.h>
* @param latitude .
* @param longitude .
* @param location CLLocation *
*/
+ (void)setLatitude:(double)latitude longitude:(double)longitude;
+ (void)setLocation:(CLLocation *)location;
#pragma - mark 本地通知
/**
* 64
* @param fireDate
* @param alertBody
* @param badge -1
* @param alertAction IOS 8"打开","启动"
* @param notificationKey
* @param userInfo
* @param soundName nil为默认声音
* IOS8新参数
* @param region
* @param regionTriggersOnce
* @param category
*/
+ (UILocalNotification *)setLocalNotification:(NSDate *)fireDate
alertBody:(NSString *)alertBody
badge:(int)badge
alertAction:(NSString *)alertAction
identifierKey:(NSString *)notificationKey
userInfo:(NSDictionary *)userInfo
soundName:(NSString *)soundName;
+ (UILocalNotification *)setLocalNotification:(NSDate *)fireDate
alertBody:(NSString *)alertBody
badge:(int)badge
alertAction:(NSString *)alertAction
identifierKey:(NSString *)notificationKey
userInfo:(NSDictionary *)userInfo
soundName:(NSString *)soundName
region:(CLRegion *)region
regionTriggersOnce:(BOOL)regionTriggersOnce
category:(NSString *)category
NS_AVAILABLE_IOS(8_0);
/**
* App在前台运行时不会进行弹窗
* @param notification
* @param notificationKey
*/
+ (void)showLocalNotificationAtFront:(UILocalNotification *)notification
identifierKey:(NSString *)notificationKey;
/**
*
* @param notificationKey
* @param myUILocalNotification
*/
+ (void)deleteLocalNotificationWithIdentifierKey:(NSString *)notificationKey;
+ (void)deleteLocalNotification:(UILocalNotification *)localNotification;
/**
*
* @param notificationKey
* @return ,[array count]0
*/
+ (NSArray *)findLocalNotificationWithIdentifier:(NSString *)notificationKey;
/**
*
*/
+ (void)clearAllLocalNotifications;
#pragma - mark 设置Badge
/**
* set setBadge
* @param value JPush服务器的badge的值
* UIApplication:setApplicationIconBadgeNumber函数,
*/
+ (BOOL)setBadge:(NSInteger)value;
/**
* set setBadge
* @param value JPush服务器对badge值的设定.
* UIApplication:setApplicationIconBadgeNumber函数,
*/
+ (void)resetBadge;
2014-06-04 13:20:24 +08:00
/**
2014-09-24 20:02:07 +08:00
* get RegistrationID
*/
+ (NSString *)registrationID;
#pragma - mark 打印日志信息配置
/**
* setDebugMode获取更多的Log信息
* DebugMode
*
* setLogOFF关闭除了错误信息外的所有Log
* LogOFF用于节省性能开销
*
* DebugLog,
2014-06-04 13:20:24 +08:00
*/
2014-09-24 20:02:07 +08:00
+ (void)setDebugMode;
+ (void)setLogOFF;
2014-01-20 18:27:31 +08:00
@end