ios frame安卓三方库iOS开发点滴

HockeyApp for iOS集成

2017-03-20  本文已影响331人  想养只土狗

创建App获取App Identifier:

  1. 登录 https://rink.hockeyapp.net.
  2. 点击NewApp->manually手动创建App
  3. 填写App信息


    Screen Shot 2017-03-23 at 4.57.37 PM.png
  4. 在App-Overview获取到App ID


    Screen Shot 2017-03-23 at 5.03.10 PM.png

在项目中集成SDK有多种方式:

1. Framework

  1. 下载最新版本HockeySDK-iOS: https://hockeyapp.net/releases/#s.
  2. SDK解压后有分4中不同版本分别在不同文件夹下:
    1. 默认无Feedback版本:HockeySDK.embeddedframework
    2. 全功能包括Feedback:HockeySDKAllFeatures
    3. 仅有CrashReport版本:HockeySDKCrashOnly
    4. 为extensions设计的仅CrashReport版本:HockeySDKCrashOnlyExtension
Screen Shot 2017-03-23 at 5.23.34 PM.png

区分Default 和 AllFeatures 主要是由于iOS10中Apple要求开发者在用到Photos.framework的时候要在Info.plist中添加NSPhotoLibraryUsageDescription。否则会在运行时Crash以及在App Store审核的时候被拒绝Orz...

如果你使用AllFeatures,记得在Info.plist中添加:

Screen Shot 2017-03-23 at 5.42.47 PM.png

选择合适的SDK并拖到你的工程中。记得先Copy到工程路径下,或者勾选一下Copy items if needed。

Screen Shot 2017-03-23 at 5.34.47 PM.png

2. CocoaPods

Podfile

platform :ios, '8.0'
pod "HockeySDK"

以上的配置会获取默认SDK,是没有Feedback功能的,HockeyApp 提供了其他几种submodle:

  1. 所有功能,包含Feedback:
    pod "HockeySDK", :subspecs => ['AllFeaturesLib']

有Feedback功能就需要添加NSPhotoLibraryUsageDescription,在之前已经提到不在赘述。

  1. 仅Crash reporting奔溃报告功能:
    pod "HockeySDK", :subspecs => ['CrashOnlyLib']
  1. 如果你是给extension用:
    pod "HockeySDK", :subspecs => ['CrashOnlyExtensionsLib']

Now Coding...

Objective-C

  1. 打开 AppDelegate.m.

  2. 引入HockeySDK:

     @import HockeySDK;
    
  3. 找到 application:didFinishLaunchingWithOptions:

  4. 添加以下代码配置以及启动HockeyApp SDK:

     [[BITHockeyManager sharedHockeyManager] configureWithIdentifier:@"APP_IDENTIFIER"];
     // Do some additional configuration if needed here
     [[BITHockeyManager sharedHockeyManager] startManager];
     [[BITHockeyManager sharedHockeyManager].authenticator authenticateInstallation]; // This line is obsolete in the crash only builds
    

Swift

  1. 打开 AppDelegate.swift.

  2. 引入HockeySDK:

     import HockeySDK
    
  3. 找到方法:

     application(application: UIApplication, didFinishLaunchingWithOptions launchOptions:[NSObject: AnyObject]?) -> Bool
    
  4. 添加以下代码配置及启动HockeyApp SDK:

     BITHockeyManager.sharedHockeyManager().configureWithIdentifier("APP_IDENTIFIER")
     BITHockeyManager.sharedHockeyManager().startManager()
     BITHockeyManager.sharedHockeyManager().authenticator.authenticateInstallation() // This line is obsolete in the crash only builds
    

Reference: https://support.hockeyapp.net/kb/client-integration-ios-mac-os-x-tvos/hockeyapp-for-ios.

上一篇 下一篇

猜你喜欢

热点阅读