创建App获取App Identifier:
- 登录 https://rink.hockeyapp.net.
- 点击NewApp->manually手动创建App
-
填写App信息
Screen Shot 2017-03-23 at 4.57.37 PM.png -
在App-Overview获取到App ID
Screen Shot 2017-03-23 at 5.03.10 PM.png
在项目中集成SDK有多种方式:
1. Framework
- 下载最新版本HockeySDK-iOS: https://hockeyapp.net/releases/#s.
- SDK解压后有分4中不同版本分别在不同文件夹下:
- 默认无Feedback版本:
HockeySDK.embeddedframework
- 全功能包括Feedback:
HockeySDKAllFeatures
- 仅有CrashReport版本:
HockeySDKCrashOnly
- 为extensions设计的仅CrashReport版本:
HockeySDKCrashOnlyExtension
- 默认无Feedback版本:
区分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.png2. CocoaPods
Podfile
platform :ios, '8.0'
pod "HockeySDK"
以上的配置会获取默认SDK,是没有Feedback功能的,HockeyApp 提供了其他几种submodle:
- 所有功能,包含Feedback:
pod "HockeySDK", :subspecs => ['AllFeaturesLib']
有Feedback功能就需要添加NSPhotoLibraryUsageDescription
,在之前已经提到不在赘述。
- 仅Crash reporting奔溃报告功能:
pod "HockeySDK", :subspecs => ['CrashOnlyLib']
- 如果你是给extension用:
pod "HockeySDK", :subspecs => ['CrashOnlyExtensionsLib']
Now Coding...
Objective-C
-
打开
AppDelegate.m
. -
引入HockeySDK:
@import HockeySDK;
-
找到
application:didFinishLaunchingWithOptions:
-
添加以下代码配置以及启动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
-
打开
AppDelegate.swift
. -
引入HockeySDK:
import HockeySDK
-
找到方法:
application(application: UIApplication, didFinishLaunchingWithOptions launchOptions:[NSObject: AnyObject]?) -> Bool
-
添加以下代码配置及启动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.
网友评论