博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
BugSense in iOS
阅读量:5962 次
发布时间:2019-06-19

本文共 2884 字,大约阅读时间需要 9 分钟。

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

Using BugSense in your iOS application is super easy!

  1. Download the  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
];
    
//...
}
 brought to you by  .

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"
);
}
 brought to you by  .

 

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

你可能感兴趣的文章
sed单行处理命令奇偶行输出
查看>>
VC++深入详解学习笔记1
查看>>
安装配置discuz
查看>>
线程互互斥锁
查看>>
KVM虚拟机&openVSwitch杂记(1)
查看>>
win7下ActiveX注册错误0x80040200解决参考
查看>>
《.NET应用架构设计:原则、模式与实践》新书博客--试读-1.1-正确认识软件架构...
查看>>
2013 Linux领域年终盘点
查看>>
linux学习之查看程序端口占用情况
查看>>
相逢在栀枝花开的季节
查看>>
linux下git自动补全命令
查看>>
Ubuntu14.04LTS更新源
查看>>
Linux报“Unknown HZ value! (288) Assume 100”错误
查看>>
mysql多实例实例化数据库
查看>>
我的友情链接
查看>>
golang xml和json的解析与生成
查看>>
javascript 操作DOM元素样式
查看>>
Android 内存管理 &Memory Leak & OOM 分析
查看>>
【查找算法】基于存储的查找算法(哈希查找)
查看>>
JavaWeb网上图书商城完整项目--day02-10.提交注册表单功能之页面实现
查看>>