卸载 1.1.6

卸载 1.1.6

测试已测试
Lang语言 Obj-CObjective C
许可 BSD
发布最后发布2015 年 9 月

卸载 维护。



卸载 1.1.6

  • 作者:
  • Aravind G S

Uninstall Insights iPhone SDK

Uninstall SDK (http://uninstall.io) 帮助您了解您的应用程序卸载的原因,使用强大的预测引擎来降低卸载率,并通过独特的行动渠道获取应用的重新安装。

本指南将提供有关如何仅在几分钟内集成 SDK 的逐步详细说明。以下步骤概述了集成过程的详细步骤。

下载压缩包并解压文件

克隆此存储库

git clone https://github.com/uninstallio/ios-sdk.git

或下载压缩包。

wget https://github.com/uninstallio/ios-sdk/archive/master.zip

解压文件(如果是作为 zip 下载的)。

将卸载库附加到您的项目

1. 添加静态库

将构建目录中 "All Targets" 的文件添加到您的项目中。如果您不熟悉将外部库添加到项目的过程。

a. 在项目导航窗格上单击任意位置,选择 "添加文件到 '您的项目'" 菜单

Alt text

b. 选中构建和 "All Targets" 文件夹。选择文件 "libNotifyManager.a" 和文件夹 "include",然后点击 "添加"。

Alt text

2. 链接 Core Location 框架

a. 在项目导航窗格上点击您的项目文件夹,然后转到 "构建设置" 选项卡

b. 展开链接二进制与库区域

Alt text

c. 点击 "+" 按钮,并选择以下项

  • CoreLocation.framework
  • CoreBluetooth.framework
  • CoreTelephony.framework
  • QuartzCore.framework
  • Security.framework
  • SystemConfiguration.framework
  • Ad.Support.framework

然后点击 "添加" 按钮

Alt text

配置项目中的库和权限

卸载需要一些后台功能。您需要在 info.plist 中的 "UIBackgroundModes" 键中指定您将使用这些功能。我们需要以下权限列表

  1. 获取
  2. 远程通知

最简单的方法是使用 Xcode 5 项目编辑器中的新功能选项卡,该选项卡包括用于轻松配置多任务选项的后台模式部分,如下所示。

Alt text

或者,您可以手动编辑密钥。

<key>UIBackgroundModes</key>
  <array>
    <string>fetch</string>
    <string>remote-notification</string>
  </array>

您还需要在info.plist文件中添加以下设备功能。

<key>UIRequiredDeviceCapabilities</key>
  <array>
    <string>location-services</string>
  </array>

一旦设置完成权限,我们就可以更改如下所示代码。

在项目中添加卸载方法

1. 导入

"NotifyManager.h" 到您的应用程序代理中

2. 添加

  [[NotifyManager sharedManager] processLaunchOptions:launchOptions];
  [[NotifyManager sharedManager] startNotifyServicesWithAppID:@"appToken" key:@"appSecret"];

  if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)])
    {
        [[UIApplication sharedApplication] registerForRemoteNotifications];
        UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:nil];
        [[UIApplication sharedApplication] registerUserNotificationSettings:settings];

    } else
    {
        [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
    }

到方法

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

在应用程序代理中。

注意:如果没有令牌和密钥,请通过邮件发送到 [email protected] 以获取您的应用程序的身份验证信息。

3. 添加

  [[NotifyManager sharedManager] startNotifyServicesWithAppID:@"appToken"
key:@"appSecret"];

到方法

  - (void)applicationWillEnterForeground:(UIApplication *)application

在应用程序代理中。

4. 添加

    [[NotifyManager sharedManager] registerForPushNotificationUsingDeviceToken:deviceToken];

到方法

-(void) application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken

5. 添加

    [[NotifyManager sharedManager] processRemoteNotification:userInfo];
    completionHandler(UIBackgroundFetchResultNewData);

到方法

- (void)  application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler

6. 添加

    [[NotifyManager sharedManager] startNotifyServicesWithAppID:@"appToken" key:@"appSecret"];
    completionHandler(UIBackgroundFetchResultNoData);

到方法

- (void) application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler

7. 添加

    [[NotifyManager sharedManager] didLoseFocus];

到方法

- (void)applicationDidEnterBackground:(UIApplication *)application

使用Uninstall库发送事件

如果您需要发送一些事件,那么您需要执行以下附加步骤。

1) 唯一系统用户标识符和电子邮件标识符

将唯一系统用户标识符和电子邮件标识符传递给我们的SDK。这些数据将用于在我们系统之间同步标识符并执行某些操作。此信息必须在应用程序生命周期中传递一次。以下帮助代码片段。

 NSUserDefaults* preferences = [NSUserDefaults standardUserDefaults];
 NSString* isFirstTimeInstall = @"isFirstTimeInstall";
 if([preferences objectForKey: isFirstTimeInstall] == nil)
    {
        [[NotifyManager sharedManager] identify:@"userId" traits:@{ @"name": @"User_Name",@"email": @"[email protected]" }];
    }
    else
    {
        const BOOL presentLevel = [preferences boolForKey: isFirstTimeInstall];
    }

NSUserDefaults* preferences = [NSUserDefaults standardUserDefaults];
NSString* isFirstTimeInstall = @"isFirstTimeInstall";
const NSInteger presentLevel = ...;
[preferences setBool:presentLevel forKey:isFirstTimeInstall];
const BOOL didSave = [preferences synchronize];

2) 应用程序事件

所有应用程序事件都必须传递给我们的SDK。信息可以通过两种方式传递

a. 通过第三方平台

如果您使用任何第三方分析平台,并支持通过API提取数据,那么发送API密钥,我们将直接从那里提取信息。有关第三方平台详细信息,请联系您的产品/市场营销经理。

b. 通过应用程序

如果未使用任何第三方平台或平台不支持任何API,则通过我们的事件捕获功能将数据传递给我们的SDK。以下帮助代码片段。

 [[NotifyManager sharedManager] track:@"eventName"  properties:@{ @"eventValue": @"Event-Value",@"IDSync": @"ABC1234"}];

将您的推送证书发送给我们以进行测试

在Apple开发者成员中心,点击iOS应用下的标识符,然后在列表中找到您的应用程序。单击您想要配置的应用程序。如果推送通知被禁用(如下所示)

Alt text

然后单击编辑,将显示类似于下面这样的内容。

Alt text

确保勾选“推送通知”旁边的复选框。

生成和下载您的证书

如需启用开发或生产推送SSL证书,请选择要创建的证书

点击“创建证书”后,您将看到“添加iOS证书向导”。按照向导中的说明操作,然后点击“继续”。

使用刚才创建的证书签名请求生成APNS推送SSL证书。

一旦出现下载按钮,您就准备好下载了。您可能需要重新加载页面以更新此操作。下载创建的证书。

Alt text

打开证书。打开证书将打开“密钥链访问”。

在“密钥链访问”中,您应该能在“我的证书”下找到证书。名称可能如下所示:苹果开发iOS推送服务:*xxxxxxxx

Alt text

导出.p12文件

选择刚刚添加到密钥链访问的证书,从菜单中选择“文件”->“导出项目...”。在保存文件时,请使用个人信息交换 (.p12) 格式。

Alt text

证书文件已经准备好了。请通过电子邮件发送给我们。

支持或联系

在集成过程中遇到问题?请在[email protected]与我们联系,我们会在第一时间帮您解决问题。