forked from twobitlabs/AnalyticsKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnalyticsKitDebugProvider.m
More file actions
75 lines (53 loc) · 2.21 KB
/
AnalyticsKitDebugProvider.m
File metadata and controls
75 lines (53 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//
// AnalyticsKitDebug.m
// TeamStream
//
// Created by Susan Detwiler on 5/29/12.
// Copyright (c) 2012 Two Bit Labs. All rights reserved.
//
#import "AnalyticsKitDebugProvider.h"
@interface AnalyticsKitDebugProvider()
#if __has_feature(objc_arc)
@property(nonatomic,weak)UIAlertView *alert;
#endif
@end
@implementation AnalyticsKitDebugProvider
#pragma mark -
#pragma mark Lifecycle
-(void)applicationWillEnterForeground{}
-(void)applicationDidEnterBackground{}
-(void)applicationWillTerminate{}
-(void)uncaughtException:(NSException *)exception{}
#pragma mark -
#pragma mark Event Logging
-(void)logScreen:(NSString *)screenName{}
-(void)logEvent:(NSString *)value {}
-(void)logEvent:(NSString *)event withProperty:(NSString *)key andValue:(NSString *)value {}
-(void)logEvent:(NSString *)event withProperties:(NSDictionary *)dict {}
-(void)logEvent:(NSString *)eventName timed:(BOOL)timed{}
-(void)logEvent:(NSString *)eventName withProperties:(NSDictionary *)dict timed:(BOOL)timed{}
-(void)endTimedEvent:(NSString *)eventName withProperties:(NSDictionary *)dict{}
-(void)showDebugAlert:(NSString *)message{
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"AnalyticsKit Received Error"
message:message
delegate:nil cancelButtonTitle:@"OK"
otherButtonTitles:nil];
#if !__has_feature(objc_arc)
[alert autorelease];
#else
if (self.alert) [alert dismissWithClickedButtonIndex:0 animated:NO];
self.alert = alert;
#endif
[alert show];
}];
}
-(void)logError:(NSString *)name message:(NSString *)message exception:(NSException *)exception{
NSString *detail = [NSString stringWithFormat:@"%@\n\n%@\n\n%@", name, message, exception];
[self showDebugAlert:detail];
}
-(void)logError:(NSString *)name message:(NSString *)message error:(NSError *)error{
NSString *detail = [NSString stringWithFormat:@"%@\n\n%@\n\n%@", name, message, error];
[self showDebugAlert:detail];
}
@end