ACPReminder 1.0.2

ACPReminder 1.0.2

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最后发布2015年3月

Antonio Casero 维护。




  • 版权
  • Antonio Casero

用途

ACPReminder 提供自动本地提醒,例如,用于推广您的游戏或向用户说明您的应用的不同用法...当用户关闭应用程序时,它会自动计划您的预定义信息之一,如果用户在预定义时间段内没有打开应用,则将触发提醒。

安装

从源代码

克隆仓库

$ git clone [email protected]:antoniocasero/ACPReminder.git

或者将 ACPReminder(.h.m) 直接拖拽到您的项目中。

如何使用

您只需在您的 appDelegate 中导入 ACPReminder 类。它有两个主要方法:

  • 在方法 applicationDidEnterBackground:(UIApplication *)application 中。
ACPReminder * localNotifications = [ACPReminder sharedManager];
[localNotifications createLocalNotification];

它将计划您的本地通知,

  • 在方法 applicationDidBecomeActive:(UIApplication *)application 中添加以下代码:
[localNotifications checkIfLocalNotificationHasBeenTriggered];

它将检查是否有计划本地通知,如果通知尚未触发,则重置它。

属性

@property (nonatomic, strong) NSArray* messages;

NSString 数组,包含您想要作为本地通知展示的消息。强烈建议使用 NSLocalizedString。

@property (nonatomic, strong) NSArray* timePeriods;

NSNumbers 数组,定义展示本地通知之间的时间间隔。默认情况下,这些数字代表天数,但是有一个仅用于测试的目的的属性,可以将这些天数转换为秒。(@see 代码示例)

@property (nonatomic, assign) BOOL randomMessage;

该属性控制如何从数组中选择消息。如果设置为 YES,则将从数组中随机选择消息,如果设置为 NO,则按顺序选择(默认情况)。

@property (nonatomic, assign) BOOL circularTimePeriod;

时间间隔数组是顺序的,如果将属性设置为 YES,则在取到最后一个元素时,下一个将是第一个元素。否则下一个将是数组的最后一个元素。

@property (nonatomic, strong) NSString* appDomain;

该属性定义您通知的域,以防止冲突。

示例

ACPReminder * localNotifications = [ACPReminder sharedManager];

localNotifications.messages = @[@"Hey - This potion's really odd. Come and See", @"Your Village miss you"", @"Did you know our new features?"]; 
localNotifications.timePeriods = @[@(7),@(10)];
localNotifications.appDomain = @"com.mydomain.appName";

[localNotifications createLocalNotification];

更详细的信息,请检查此仓库中的示例应用程序。

记住,有了强大的功能,就会有责任。你知道我的意思...

兼容性

  • 支持 ARC。
  • 与 iOS5、iOS6 和 iOS7 兼容。

发布说明

  • v1.0 初始发行

许可证

ACPReminder 开源协议为 MIT 协议。更多信息请参阅 LICENSE 文件。