Crashlyticsは入れておくだけでクラッシュ時のコールスタックが表示されるので調査に便利
また追加情報も送信できる仕組みもある。
1. ユーザ情報を送る
#import <Crashlytics/Crashlytics.h>
- (void)testMethod2
{
[[Crashlytics sharedInstance] setUserEmail:@"user@email.com"];
[[Crashlytics sharedInstance] setUserIdentifier:@"12344556789"];
[[Crashlytics sharedInstance] setUserName:@"test user"];
[[Crashlytics sharedInstance] crash];
}
- 結果
2. Key,Valueで送る
- (void)testMethod2
{
[[Crashlytics sharedInstance] setBoolValue:YES forKey:@"boolLog"];
[[Crashlytics sharedInstance] setFloatValue:0.12345 forKey:@"floatLog"];
[[Crashlytics sharedInstance] setIntValue:3 forKey:@"intLog"];
[[Crashlytics sharedInstance] setObjectValue:@"objectValue..test" forKey:@"objectLog"];
[[Crashlytics sharedInstance] crash];
}
- 結果
3. ログ情報を送る
- (void)testMethod2
{
CLS_LOG(@"CLS_LOG for Dict %@", @{@"key1":@"value1", @"key2":@"value2", @"key3":@"value3"});
[[Crashlytics sharedInstance] crash];
}
- 結果
4. NSException以外のカスタム例外を送る
- (void)testMethod2
{
[[Crashlytics sharedInstance] recordCustomExceptionName:@"customEx..." reason:@"custom_reason.." frameArray:@[[CLSStackFrame stackFrameWithAddress:1234567]]];
[[Crashlytics sharedInstance] crash];
}
- 結果
参考:
http://support.crashlytics.com/knowledgebase/articles/92519-how-do-i-use-logging-
http://support.crashlytics.com/knowledgebase/articles/92520-how-do-i-use-custom-keys-
http://support.crashlytics.com/knowledgebase/articles/92521-how-do-i-set-user-information-