BugSense in iOS

http://www.bugsense.com/docs/ios

Using BugSense in your iOS application is super easy!

  1. Download the BugSense-iOS [rev4.4].zip file, and unzip it.
  2. In Xcode, select the target that you want to use and, in the "Build Phases" tab expand the "Link Binary With Libraries" section. Press the "+" button, and then press "Add Other...". In the dialog box that appears, go to the framework's location and select it.
  3. The framework will appear at the top of the "Link Binary With Libraries" section and will also be added to your project files (left-hand pane).
  4. If your development stack is older than Xcode 4.2/iOS 5.0, BugSense may not work for you. We are working to improve compatibility with older development environments.

Configuring your project

BugSense depends on SystemConfiguration.framework, and you have to add it to your project by selecting it from the list of frameworks in "Link Binary With Libraries". Then, in your target properties:

  • change the value of "Strip Debug Symbols During Copy" and "Strip Linked Product" to No for all configurations (typically Debug and Release).
  • Make sure that "Deployment Post Processing" is set to No for all configurations.
  • Make sure that "Generate Debug Symbols" is similarly set to Yes.

Note: Your project should be working fine with those settings. However, if you find that reporting or symbolication is problematic, try this: * In your target's properties, * in "Other Linker Flags" add -ObjC * additionally, in "Other Linker Flags" add -all_load

Using BugSense

Add the following lines in the implementation file for your app delegate (something likeAppDelegate.m), ideally at the top ofapplication:didFinishLaunchingWithOptions: : 

#import <BugSense-iOS/BugSenseCrashController.h>
 
// ...
 
- ( BOOL ) application: ( UIApplication * ) application didFinishLaunchingWithOptions: ( NSDictionary * ) launchOptions {
     //...
     NSDictionary * myStuff = [ NSDictionary dictionaryWithObjectsAndKeys: @"myObject" , @"myKey" , nil ];
     [ BugSenseCrashController sharedInstanceWithBugSenseAPIKey: @"<Your BugSense API Key>"
                                                                              userDictionary: myStuff
                                                                              sendImmediately: NO ];
     //...
}
view raw gistfile1.m This Gist brought to you by  GitHub.

The first argument is the BugSense API key (NSString). The second argument is anNSDictionary where you can put any object/key pairs to send back with the crash report. The third argument is a switch (BOOL) that can enable the dispatch of a crash report immediately after the crash has occurred, instead of on relaunch.

 

To see your crashes being reported, use your app on their own (on your device or on the simulator) and not through Xcode.

Exception logging

Logging exceptions is very simple: use the BUGSENSE_LOG macro to post the exception and its stacktrace along with a tag to identify it, e.g.:

@try {
     // some exception throwing code
} @catch ( NSException * exc ) {
     BUGSENSE_LOG ( exc , @"Tag" );
}
view raw gistfile1.m This Gist brought to you by  GitHub.

 

Read the full guide at Github

转载于:https://www.cnblogs.com/pengyingh/articles/2511461.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值