Skip to content

Commit 94dc966

Browse files
committed
Adding Crashlytics.
Close #66
1 parent 6d95db8 commit 94dc966

33 files changed

+1132
-1
lines changed

Crashlytics.framework/Crashlytics

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Crashlytics

Crashlytics.framework/Headers

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Headers

Crashlytics.framework/Modules

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Modules

Crashlytics.framework/Resources

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Resources
1.12 MB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//
2+
// ANSCompatibility.h
3+
// AnswersKit
4+
//
5+
// Copyright (c) 2015 Crashlytics, Inc. All rights reserved.
6+
//
7+
8+
#pragma once
9+
10+
#if !__has_feature(nullability)
11+
#define nonnull
12+
#define nullable
13+
#define _Nullable
14+
#define _Nonnull
15+
#endif
16+
17+
#ifndef NS_ASSUME_NONNULL_BEGIN
18+
#define NS_ASSUME_NONNULL_BEGIN
19+
#endif
20+
21+
#ifndef NS_ASSUME_NONNULL_END
22+
#define NS_ASSUME_NONNULL_END
23+
#endif
24+
25+
#if __has_feature(objc_generics)
26+
#define ANS_GENERIC_NSARRAY(type) NSArray<type>
27+
#define ANS_GENERIC_NSDICTIONARY(key_type,object_key) NSDictionary<key_type, object_key>
28+
#else
29+
#define ANS_GENERIC_NSARRAY(type) NSArray
30+
#define ANS_GENERIC_NSDICTIONARY(key_type,object_key) NSDictionary
31+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
//
2+
// Answers.h
3+
// Crashlytics
4+
//
5+
// Copyright (c) 2015 Crashlytics, Inc. All rights reserved.
6+
//
7+
8+
#import <Foundation/Foundation.h>
9+
#import "ANSCompatibility.h"
10+
11+
NS_ASSUME_NONNULL_BEGIN
12+
13+
/**
14+
* This class exposes the Answers Events API, allowing you to track key
15+
* user user actions and metrics in your app.
16+
*/
17+
@interface Answers : NSObject
18+
19+
/**
20+
* Log a Sign Up event to see users signing up for your app in real-time, understand how
21+
* many users are signing up with different methods and their success rate signing up.
22+
*
23+
* @param signUpMethodOrNil The method by which a user logged in, e.g. Twitter or Digits.
24+
* @param signUpSucceededOrNil The ultimate success or failure of the login
25+
* @param customAttributesOrNil A dictionary of custom attributes to associate with this event.
26+
*/
27+
+ (void)logSignUpWithMethod:(nullable NSString *)signUpMethodOrNil
28+
success:(nullable NSNumber *)signUpSucceededOrNil
29+
customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil;
30+
31+
/**
32+
* Log an Log In event to see users logging into your app in real-time, understand how many
33+
* users are logging in with different methods and their success rate logging into your app.
34+
*
35+
* @param loginMethodOrNil The method by which a user logged in, e.g. email, Twitter or Digits.
36+
* @param loginSucceededOrNil The ultimate success or failure of the login
37+
* @param customAttributesOrNil A dictionary of custom attributes to associate with this event.
38+
*/
39+
+ (void)logLoginWithMethod:(nullable NSString *)loginMethodOrNil
40+
success:(nullable NSNumber *)loginSucceededOrNil
41+
customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil;
42+
43+
/**
44+
* Log a Share event to see users sharing from your app in real-time, letting you
45+
* understand what content they're sharing from the type or genre down to the specific id.
46+
*
47+
* @param shareMethodOrNil The method by which a user shared, e.g. email, Twitter, SMS.
48+
* @param contentNameOrNil The human readable name for this piece of content.
49+
* @param contentTypeOrNil The type of content shared.
50+
* @param contentIdOrNil The unique identifier for this piece of content. Useful for finding the top shared item.
51+
* @param customAttributesOrNil A dictionary of custom attributes to associate with this event.
52+
*/
53+
+ (void)logShareWithMethod:(nullable NSString *)shareMethodOrNil
54+
contentName:(nullable NSString *)contentNameOrNil
55+
contentType:(nullable NSString *)contentTypeOrNil
56+
contentId:(nullable NSString *)contentIdOrNil
57+
customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil;
58+
59+
/**
60+
* Log an Invite Event to track how users are inviting other users into
61+
* your application.
62+
*
63+
* @param inviteMethodOrNil The method of invitation, e.g. GameCenter, Twitter, email.
64+
* @param customAttributesOrNil A dictionary of custom attributes to associate with this event.
65+
*/
66+
+ (void)logInviteWithMethod:(nullable NSString *)inviteMethodOrNil
67+
customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil;
68+
69+
/**
70+
* Log a Purchase event to see your revenue in real-time, understand how many users are making purchases, see which
71+
* items are most popular, and track plenty of other important purchase-related metrics.
72+
*
73+
* @param itemPriceOrNil The purchased item's price.
74+
* @param currencyOrNil The ISO4217 currency code. Example: USD
75+
* @param purchaseSucceededOrNil Was the purchase successful or unsuccessful
76+
* @param itemNameOrNil The human-readable form of the item's name. Example:
77+
* @param itemTypeOrNil The type, or genre of the item. Example: Song
78+
* @param itemIdOrNil The machine-readable, unique item identifier Example: SKU
79+
* @param customAttributesOrNil A dictionary of custom attributes to associate with this purchase.
80+
*/
81+
+ (void)logPurchaseWithPrice:(nullable NSDecimalNumber *)itemPriceOrNil
82+
currency:(nullable NSString *)currencyOrNil
83+
success:(nullable NSNumber *)purchaseSucceededOrNil
84+
itemName:(nullable NSString *)itemNameOrNil
85+
itemType:(nullable NSString *)itemTypeOrNil
86+
itemId:(nullable NSString *)itemIdOrNil
87+
customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil;
88+
89+
/**
90+
* Log a Level Start Event to track where users are in your game.
91+
*
92+
* @param levelNameOrNil The level name
93+
* @param customAttributesOrNil A dictionary of custom attributes to associate with this level start event.
94+
*/
95+
+ (void)logLevelStart:(nullable NSString *)levelNameOrNil
96+
customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil;
97+
98+
/**
99+
* Log a Level End event to track how users are completing levels in your game.
100+
*
101+
* @param levelNameOrNil The name of the level completed, E.G. "1" or "Training"
102+
* @param scoreOrNil The score the user completed the level with.
103+
* @param levelCompletedSuccesfullyOrNil A boolean representing whether or not the level was completed successfully.
104+
* @param customAttributesOrNil A dictionary of custom attributes to associate with this event.
105+
*/
106+
+ (void)logLevelEnd:(nullable NSString *)levelNameOrNil
107+
score:(nullable NSNumber *)scoreOrNil
108+
success:(nullable NSNumber *)levelCompletedSuccesfullyOrNil
109+
customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil;
110+
111+
/**
112+
* Log an Add to Cart event to see users adding items to a shopping cart in real-time, understand how
113+
* many users start the purchase flow, see which items are most popular, and track plenty of other important
114+
* purchase-related metrics.
115+
*
116+
* @param itemPriceOrNil The purchased item's price.
117+
* @param currencyOrNil The ISO4217 currency code. Example: USD
118+
* @param itemNameOrNil The human-readable form of the item's name. Example:
119+
* @param itemTypeOrNil The type, or genre of the item. Example: Song
120+
* @param itemIdOrNil The machine-readable, unique item identifier Example: SKU
121+
* @param customAttributesOrNil A dictionary of custom attributes to associate with this event.
122+
*/
123+
+ (void)logAddToCartWithPrice:(nullable NSDecimalNumber *)itemPriceOrNil
124+
currency:(nullable NSString *)currencyOrNil
125+
itemName:(nullable NSString *)itemNameOrNil
126+
itemType:(nullable NSString *)itemTypeOrNil
127+
itemId:(nullable NSString *)itemIdOrNil
128+
customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil;
129+
130+
/**
131+
* Log a Start Checkout event to see users moving through the purchase funnel in real-time, understand how many
132+
* users are doing this and how much they're spending per checkout, and see how it related to other important
133+
* purchase-related metrics.
134+
*
135+
* @param totalPriceOrNil The total price of the cart.
136+
* @param currencyOrNil The ISO4217 currency code. Example: USD
137+
* @param itemCountOrNil The number of items in the cart.
138+
* @param customAttributesOrNil A dictionary of custom attributes to associate with this event.
139+
*/
140+
+ (void)logStartCheckoutWithPrice:(nullable NSDecimalNumber *)totalPriceOrNil
141+
currency:(nullable NSString *)currencyOrNil
142+
itemCount:(nullable NSNumber *)itemCountOrNil
143+
customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil;
144+
145+
/**
146+
* Log a Rating event to see users rating content within your app in real-time and understand what
147+
* content is most engaging, from the type or genre down to the specific id.
148+
*
149+
* @param ratingOrNil The integer rating given by the user.
150+
* @param contentNameOrNil The human readable name for this piece of content.
151+
* @param contentTypeOrNil The type of content shared.
152+
* @param contentIdOrNil The unique identifier for this piece of content. Useful for finding the top shared item.
153+
* @param customAttributesOrNil A dictionary of custom attributes to associate with this event.
154+
*/
155+
+ (void)logRating:(nullable NSNumber *)ratingOrNil
156+
contentName:(nullable NSString *)contentNameOrNil
157+
contentType:(nullable NSString *)contentTypeOrNil
158+
contentId:(nullable NSString *)contentIdOrNil
159+
customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil;
160+
161+
/**
162+
* Log a Content View event to see users viewing content within your app in real-time and
163+
* understand what content is most engaging, from the type or genre down to the specific id.
164+
*
165+
* @param contentNameOrNil The human readable name for this piece of content.
166+
* @param contentTypeOrNil The type of content shared.
167+
* @param contentIdOrNil The unique identifier for this piece of content. Useful for finding the top shared item.
168+
* @param customAttributesOrNil A dictionary of custom attributes to associate with this event.
169+
*/
170+
+ (void)logContentViewWithName:(nullable NSString *)contentNameOrNil
171+
contentType:(nullable NSString *)contentTypeOrNil
172+
contentId:(nullable NSString *)contentIdOrNil
173+
customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil;
174+
175+
/**
176+
* Log a Search event allows you to see users searching within your app in real-time and understand
177+
* exactly what they're searching for.
178+
*
179+
* @param queryOrNil The user's query.
180+
* @param customAttributesOrNil A dictionary of custom attributes to associate with this event.
181+
*/
182+
+ (void)logSearchWithQuery:(nullable NSString *)queryOrNil
183+
customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil;
184+
185+
/**
186+
* Log a Custom Event to see user actions that are uniquely important for your app in real-time, to see how often
187+
* they're performing these actions with breakdowns by different categories you add. Use a human-readable name for
188+
* the name of the event, since this is how the event will appear in Answers.
189+
*
190+
* @param eventName The human-readable name for the event.
191+
* @param customAttributesOrNil A dictionary of custom attributes to associate with this event. Attribute keys
192+
* must be <code>NSString</code> and values must be <code>NSNumber</code> or <code>NSString</code>.
193+
* @discussion How we treat <code>NSNumbers</code>:
194+
* We will provide information about the distribution of values over time.
195+
*
196+
* How we treat <code>NSStrings</code>:
197+
* NSStrings are used as categorical data, allowing comparison across different category values.
198+
* Strings are limited to a maximum length of 100 characters, attributes over this length will be
199+
* truncated.
200+
*
201+
* When tracking the Tweet views to better understand user engagement, sending the tweet's length
202+
* and the type of media present in the tweet allows you to track how tweet length and the type of media influence
203+
* engagement.
204+
*/
205+
+ (void)logCustomEventWithName:(NSString *)eventName
206+
customAttributes:(nullable ANS_GENERIC_NSDICTIONARY(NSString *, id) *)customAttributesOrNil;
207+
208+
@end
209+
210+
NS_ASSUME_NONNULL_END
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//
2+
// CLSAttributes.h
3+
// Crashlytics
4+
//
5+
// Copyright (c) 2015 Crashlytics, Inc. All rights reserved.
6+
//
7+
8+
#pragma once
9+
10+
#define CLS_DEPRECATED(x) __attribute__ ((deprecated(x)))
11+
12+
#if !__has_feature(nullability)
13+
#define nonnull
14+
#define nullable
15+
#define _Nullable
16+
#define _Nonnull
17+
#endif
18+
19+
#ifndef NS_ASSUME_NONNULL_BEGIN
20+
#define NS_ASSUME_NONNULL_BEGIN
21+
#endif
22+
23+
#ifndef NS_ASSUME_NONNULL_END
24+
#define NS_ASSUME_NONNULL_END
25+
#endif
26+
27+
#if __has_feature(objc_generics)
28+
#define CLS_GENERIC_NSARRAY(type) NSArray<type>
29+
#define CLS_GENERIC_NSDICTIONARY(key_type,object_key) NSDictionary<key_type, object_key>
30+
#else
31+
#define CLS_GENERIC_NSARRAY(type) NSArray
32+
#define CLS_GENERIC_NSDICTIONARY(key_type,object_key) NSDictionary
33+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
//
2+
// CLSLogging.h
3+
// Crashlytics
4+
//
5+
// Copyright (c) 2015 Crashlytics, Inc. All rights reserved.
6+
//
7+
#ifdef __OBJC__
8+
#import "CLSAttributes.h"
9+
#import <Foundation/Foundation.h>
10+
11+
NS_ASSUME_NONNULL_BEGIN
12+
#endif
13+
14+
15+
16+
/**
17+
*
18+
* The CLS_LOG macro provides as easy way to gather more information in your log messages that are
19+
* sent with your crash data. CLS_LOG prepends your custom log message with the function name and
20+
* line number where the macro was used. If your app was built with the DEBUG preprocessor macro
21+
* defined CLS_LOG uses the CLSNSLog function which forwards your log message to NSLog and CLSLog.
22+
* If the DEBUG preprocessor macro is not defined CLS_LOG uses CLSLog only.
23+
*
24+
* Example output:
25+
* -[AppDelegate login:] line 134 $ login start
26+
*
27+
* If you would like to change this macro, create a new header file, unset our define and then define
28+
* your own version. Make sure this new header file is imported after the Crashlytics header file.
29+
*
30+
* #undef CLS_LOG
31+
* #define CLS_LOG(__FORMAT__, ...) CLSNSLog...
32+
*
33+
**/
34+
#ifdef __OBJC__
35+
#ifdef DEBUG
36+
#define CLS_LOG(__FORMAT__, ...) CLSNSLog((@"%s line %d $ " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
37+
#else
38+
#define CLS_LOG(__FORMAT__, ...) CLSLog((@"%s line %d $ " __FORMAT__), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
39+
#endif
40+
#endif
41+
42+
/**
43+
*
44+
* Add logging that will be sent with your crash data. This logging will not show up in the system.log
45+
* and will only be visible in your Crashlytics dashboard.
46+
*
47+
**/
48+
49+
#ifdef __OBJC__
50+
OBJC_EXTERN void CLSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
51+
OBJC_EXTERN void CLSLogv(NSString *format, va_list ap) NS_FORMAT_FUNCTION(1,0);
52+
53+
/**
54+
*
55+
* Add logging that will be sent with your crash data. This logging will show up in the system.log
56+
* and your Crashlytics dashboard. It is not recommended for Release builds.
57+
*
58+
**/
59+
OBJC_EXTERN void CLSNSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2);
60+
OBJC_EXTERN void CLSNSLogv(NSString *format, va_list ap) NS_FORMAT_FUNCTION(1,0);
61+
62+
63+
NS_ASSUME_NONNULL_END
64+
#endif

0 commit comments

Comments
 (0)