diff --git a/iphone/CrittercismModule.xcodeproj/project.pbxproj b/iphone/CrittercismModule.xcodeproj/project.pbxproj index 7a84c3b..725935b 100644 --- a/iphone/CrittercismModule.xcodeproj/project.pbxproj +++ b/iphone/CrittercismModule.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 45; + objectVersion = 46; objects = { /* Begin PBXAggregateTarget section */ @@ -26,12 +26,12 @@ 24DD6CFA1134B3F500162E58 /* CrittercismModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 24DD6CF81134B3F500162E58 /* CrittercismModule.m */; }; 24DE9E1111C5FE74003F90F6 /* CrittercismModuleAssets.h in Headers */ = {isa = PBXBuildFile; fileRef = 24DE9E0F11C5FE74003F90F6 /* CrittercismModuleAssets.h */; }; 24DE9E1211C5FE74003F90F6 /* CrittercismModuleAssets.m in Sources */ = {isa = PBXBuildFile; fileRef = 24DE9E1011C5FE74003F90F6 /* CrittercismModuleAssets.m */; }; + 5D1B94B71A4619A600EF5232 /* CRFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D1B94B21A4619A600EF5232 /* CRFilter.h */; }; + 5D1B94B81A4619A600EF5232 /* Crittercism.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D1B94B31A4619A600EF5232 /* Crittercism.h */; }; + 5D1B94B91A4619A600EF5232 /* CrittercismDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D1B94B41A4619A600EF5232 /* CrittercismDelegate.h */; }; + 5D1B94BA1A4619A600EF5232 /* libCrittercism_v5_0_7.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D1B94B61A4619A600EF5232 /* libCrittercism_v5_0_7.a */; }; AA747D9F0F9514B9006C5449 /* Crittercism_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = AA747D9E0F9514B9006C5449 /* Crittercism_Prefix.pch */; }; AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; }; - F7969BCD19828BA70040226E /* CRFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = F7969BC819828BA70040226E /* CRFilter.h */; }; - F7969BCE19828BA70040226E /* Crittercism.h in Headers */ = {isa = PBXBuildFile; fileRef = F7969BC919828BA70040226E /* Crittercism.h */; }; - F7969BCF19828BA70040226E /* CrittercismDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = F7969BCA19828BA70040226E /* CrittercismDelegate.h */; }; - F7969BD019828BA70040226E /* libCrittercism_v4_3_4.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F7969BCC19828BA70040226E /* libCrittercism_v4_3_4.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -50,14 +50,14 @@ 24DD6D1B1134B66800162E58 /* titanium.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = titanium.xcconfig; sourceTree = ""; }; 24DE9E0F11C5FE74003F90F6 /* CrittercismModuleAssets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CrittercismModuleAssets.h; path = Classes/CrittercismModuleAssets.h; sourceTree = ""; }; 24DE9E1011C5FE74003F90F6 /* CrittercismModuleAssets.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CrittercismModuleAssets.m; path = Classes/CrittercismModuleAssets.m; sourceTree = ""; }; + 5D1B94B21A4619A600EF5232 /* CRFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CRFilter.h; sourceTree = ""; }; + 5D1B94B31A4619A600EF5232 /* Crittercism.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Crittercism.h; sourceTree = ""; }; + 5D1B94B41A4619A600EF5232 /* CrittercismDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CrittercismDelegate.h; sourceTree = ""; }; + 5D1B94B51A4619A600EF5232 /* dsym_upload.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = dsym_upload.sh; sourceTree = ""; }; + 5D1B94B61A4619A600EF5232 /* libCrittercism_v5_0_7.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libCrittercism_v5_0_7.a; sourceTree = ""; }; AA747D9E0F9514B9006C5449 /* Crittercism_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Crittercism_Prefix.pch; sourceTree = SOURCE_ROOT; }; AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; D2AAC07E0554694100DB518D /* libCrittercism.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCrittercism.a; sourceTree = BUILT_PRODUCTS_DIR; }; - F7969BC819828BA70040226E /* CRFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CRFilter.h; sourceTree = ""; }; - F7969BC919828BA70040226E /* Crittercism.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Crittercism.h; sourceTree = ""; }; - F7969BCA19828BA70040226E /* CrittercismDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CrittercismDelegate.h; sourceTree = ""; }; - F7969BCB19828BA70040226E /* dsym_upload.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = dsym_upload.sh; sourceTree = ""; }; - F7969BCC19828BA70040226E /* libCrittercism_v4_3_4.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libCrittercism_v4_3_4.a; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -65,8 +65,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - F7969BD019828BA70040226E /* libCrittercism_v4_3_4.a in Frameworks */, AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */, + 5D1B94BA1A4619A600EF5232 /* libCrittercism_v5_0_7.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -88,7 +88,7 @@ 32C88DFF0371C24200C91783 /* Other Sources */, 0867D69AFE84028FC02AAC07 /* Frameworks */, 034768DFFF38A50411DB9C8B /* Products */, - F7969BC719828BA70040226E /* CrittercismSDK */, + 5D1B94B11A4619A600EF5232 /* CrittercismSDK */, ); name = CrittercismModule; sourceTree = ""; @@ -121,17 +121,16 @@ name = "Other Sources"; sourceTree = ""; }; - F7969BC719828BA70040226E /* CrittercismSDK */ = { + 5D1B94B11A4619A600EF5232 /* CrittercismSDK */ = { isa = PBXGroup; children = ( - F7969BC819828BA70040226E /* CRFilter.h */, - F7969BC919828BA70040226E /* Crittercism.h */, - F7969BCA19828BA70040226E /* CrittercismDelegate.h */, - F7969BCB19828BA70040226E /* dsym_upload.sh */, - F7969BCC19828BA70040226E /* libCrittercism_v4_3_4.a */, + 5D1B94B21A4619A600EF5232 /* CRFilter.h */, + 5D1B94B31A4619A600EF5232 /* Crittercism.h */, + 5D1B94B41A4619A600EF5232 /* CrittercismDelegate.h */, + 5D1B94B51A4619A600EF5232 /* dsym_upload.sh */, + 5D1B94B61A4619A600EF5232 /* libCrittercism_v5_0_7.a */, ); - name = CrittercismSDK; - path = ../../../Downloads/Crittercism_v4_3_4/CrittercismSDK; + path = CrittercismSDK; sourceTree = ""; }; /* End PBXGroup section */ @@ -142,11 +141,11 @@ buildActionMask = 2147483647; files = ( AA747D9F0F9514B9006C5449 /* Crittercism_Prefix.pch in Headers */, - F7969BCF19828BA70040226E /* CrittercismDelegate.h in Headers */, - F7969BCE19828BA70040226E /* Crittercism.h in Headers */, + 5D1B94B91A4619A600EF5232 /* CrittercismDelegate.h in Headers */, + 5D1B94B81A4619A600EF5232 /* Crittercism.h in Headers */, 24DD6CF91134B3F500162E58 /* CrittercismModule.h in Headers */, 24DE9E1111C5FE74003F90F6 /* CrittercismModuleAssets.h in Headers */, - F7969BCD19828BA70040226E /* CRFilter.h in Headers */, + 5D1B94B71A4619A600EF5232 /* CRFilter.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -176,9 +175,10 @@ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { + LastUpgradeCheck = 0610; }; buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "CrittercismModule" */; - compatibilityVersion = "Xcode 3.1"; + compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( @@ -258,7 +258,7 @@ GCC_WARN_UNUSED_VALUE = NO; GCC_WARN_UNUSED_VARIABLE = NO; INSTALL_PATH = /usr/local/lib; - LIBRARY_SEARCH_PATHS = /Users/mfogg/Downloads/Crittercism_v4_3_4/CrittercismSDK; + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/CrittercismSDK"; OTHER_CFLAGS = ( "-DDEBUG", "-DTI_POST_1_2", @@ -295,8 +295,8 @@ GCC_WARN_UNUSED_VALUE = NO; GCC_WARN_UNUSED_VARIABLE = NO; INSTALL_PATH = /usr/local/lib; - IPHONEOS_DEPLOYMENT_TARGET = 4.0; - LIBRARY_SEARCH_PATHS = /Users/mfogg/Downloads/Crittercism_v4_3_4/CrittercismSDK; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/CrittercismSDK"; OTHER_CFLAGS = "-DTI_POST_1_2"; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = Crittercism; @@ -330,6 +330,8 @@ GCC_WARN_UNUSED_VALUE = NO; GCC_WARN_UNUSED_VARIABLE = NO; INSTALL_PATH = /usr/local/lib; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = ( "-DDEBUG", "-DTI_POST_1_2", @@ -341,6 +343,7 @@ RUN_CLANG_STATIC_ANALYZER = NO; SDKROOT = iphoneos; USER_HEADER_SEARCH_PATHS = ""; + "VALID_ARCHS[sdk=*]" = "arm64 armv7 armv7s"; }; name = Debug; }; @@ -367,7 +370,8 @@ GCC_WARN_UNUSED_VALUE = NO; GCC_WARN_UNUSED_VARIABLE = NO; INSTALL_PATH = /usr/local/lib; - IPHONEOS_DEPLOYMENT_TARGET = 4.0; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + ONLY_ACTIVE_ARCH = NO; OTHER_CFLAGS = "-DTI_POST_1_2"; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = Crittercism; diff --git a/iphone/CrittercismSDK/CRFilter.h b/iphone/CrittercismSDK/CRFilter.h new file mode 100644 index 0000000..55b6a89 --- /dev/null +++ b/iphone/CrittercismSDK/CRFilter.h @@ -0,0 +1,138 @@ +// +// CRFilter.h +// Crittercism iOS Library +// +// Created by Sean Hermany on 7/16/13. +// Copyright (c) 2013 Crittercism, Inc. All rights reserved. +// + +#import + +// Filters can be supplied to Crittercism to adjust the behavior of how URLs are +// captured and reported on for performance monitoring purposes. +// +// By default, all URLs captured by Crittercism will be reported on when +// performance monitoring is enabled. +// +// The query portion of URLs will be stripped by default. That is, a request +// for the URL: +// +// https://store.acmecorp.com/purchase?user=wcoyote&ccnum=4444555566667777 +// +// will be reported as: +// +// https://store.acmecorp.com/purchase +// +// This behavior can be altered with two types of filters: +// +// * Blacklist filters +// +// Blacklist filters cause Crittercism to discard data pertaining to any +// matching URLs. +// +// * Query preserving filters +// +// If you wish to report the full requested URL for certain endpoints, including +// the query portion, you can create and supply a query preserving filter to the +// library. +// +// Examples: +// +// Filters can either be supplied when Crittercism is enabled, as an array of +// CRFilter objects, or added dynamically at any time. +// +// The preferred method for creating filters is with the supplied convenience +// constructors, although the normal initializers, as well as the filtering +// function +[CRFillter applyFilter:ToURL] are left public so that developers +// can test the filtering behavior. +// +// * Creating a blacklist filter: +// +// [CRFilter filterWithString:@"purchase.php"] +// +// * Creating a query preserving filter: +// +// [CRFilter queryPreservingFilterWithString:@"lookupMovie"] +// +// * Initializing Crittercism with the above filters: +// +// [Crittercism enableWithAppID:@"YOURAPPID" +// andURLFilters:@[[CRFilter filterWithString:@"purchase.php"], +// [CRFilter queryPreservingFilterWithString:@"lookupMovie"]]]; +// +// Notes: +// +// * Filters match URLs via CASE SENSITIVE substring matching +// * Blacklist filters always take precedence. If a captured URL matches both a +// blacklist filter, and a query preserving filter, it will NOT be reported +// on. +// * Older versions of the agent did not scrub query parameters by default, and +// so a "queryOnlyFilter" existed. To avoid compile time errors for existing +// Crittercism users, this filter type can still be created, but it will be +// ignored by the library. This filter type is deprecated, and will be removed +// in a future version of the agent. + + +// Support NS_ENUM macro if building against iOS SDK < 6.0 + +#ifndef NS_ENUM + +#if (__cplusplus && __cplusplus >= 201103L && (__has_extension(cxx_strong_enums) || __has_feature(objc_fixed_enum))) || (!__cplusplus && __has_feature(objc_fixed_enum)) +#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type +#if (__cplusplus) +#define NS_OPTIONS(_type, _name) _type _name; enum : _type +#else +#define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type +#endif +#else +#define NS_ENUM(_type, _name) _type _name; enum +#define NS_OPTIONS(_type, _name) _type _name; enum +#endif + +#endif + +typedef NS_ENUM(NSUInteger, CRFilterType) { + CRFilterTypeScrubQuery, // Default + CRFilterTypeBlacklist, + CRFilterTypePreserveQuery +}; + +@interface CRFilter : NSObject + +@property (readonly, assign) CRFilterType filterType; + +#pragma mark - Class Methods + +// Convenience method to create a blacklisting filter ++ (CRFilter *)filterWithString:(NSString *)matchToken; + +// Convenience method to create a filter which preserves the query portion of +// URLs (as opposed to the default of scrubbing the query) ++ (CRFilter *)queryPreservingFilterWithString:(NSString *)matchToken; + +// Filter a URL, specifying which type of filter to use. +// Returns nil when a blacklist filter is specified. ++ (NSString *)applyFilter:(CRFilterType)filterType ToURL:(NSString *)url; + +#pragma mark - Instance Methods + +// Initialize a filter that blacklists all URLs that match the specified token +- (id)initWithString:(NSString *)matchToken; + +// (designated initializer) +- (id)initWithString:(NSString *)matchToken + andFilterType:(CRFilterType)filterType; + +// Does specified URL match this filter? +- (BOOL)doesMatch:(NSString *)url; + +#pragma mark - Deprecated + +// Convenience method to create a filter which only scrubs the query portion +// of URLs +// +// Note - This is now a no-op, as query strings will be scrubbed by default. ++ (CRFilter *)queryOnlyFilterWithString:(NSString *)matchToken +__attribute__((deprecated)); + +@end diff --git a/iphone/CrittercismSDK/Crittercism.h b/iphone/CrittercismSDK/Crittercism.h new file mode 100755 index 0000000..538e39f --- /dev/null +++ b/iphone/CrittercismSDK/Crittercism.h @@ -0,0 +1,217 @@ +// +// Crittercism.h +// Crittercism iOS Library +// +// Copyright 2010-2013 Crittercism, Inc. All rights reserved. +// +#import +#import "CrittercismDelegate.h" +#import "CRFilter.h" + +// Operating System Support +// +// The Crittercism iOS library supports iOS v5.0+ + +// Additional Requirements: +// +// Crittercism requires that you link to the SystemConfiguration framework. + +// Basic Integration +// +// In your Application Delegate's application:didFinishLaunchingWithOptions: +// method, add a call to +[Crittercism enableWithAppID:], supplying the app ID +// of an app you created via the Crittercism Web Portal. +// +// Example: +// +// [Crittercism enableWithAppID:@"YOURAPPIDGOESHERE"]; + +@class CLLocation; + +@interface Crittercism : NSObject + +// Enabling Crittercism +// +// !! You must call one of these methods before using any other Crittercism +// functionality. !! +// +// You can pass in a delegate that conforms to the CrittercismDelegate protocol +// if you wish to be notified that your app crashed on the previous load. +// This protocol currently has only one method: +// +// - (void)crittercismDidCrashOnLastLoad; +// +// Alternatively, you can check the didCrashOnLastLoad BOOL property. +// +// The filters parameter can be used to prevent sensitive URLs from being +// captured by the network instrumentation. To use this, pass in an +// NSArray of CRFilter objects that will be matched against URLs captured by the +// library. +// +// (Note - the filtering will take place off of your application's main thread.) + ++ (void)enableWithAppID:(NSString *)appId; + ++ (void)enableWithAppID:(NSString *)appId + andDelegate:(id )critterDelegate; + ++ (void)enableWithAppID:(NSString *)appId + andDelegate:(id )critterDelegate + andURLFilters:(NSArray *)filters; + ++ (void)enableWithAppID:(NSString *)appId + andURLFilters:(NSArray *)filters; + +// Designated "initializer" ++ (void)enableWithAppID:(NSString *)appId + andDelegate:(id )critterDelegate + andURLFilters:(NSArray *)filters + disableInstrumentation:(BOOL)disableInstrumentation; + +// Adds an additional filter for network instrumentation. +// See CRFilter.h for additional details. ++ (void)addFilter:(CRFilter *)filter; + +// Breadcrumbs provide the ability to track activity within your app. +// +// A breadcrumb is a free form string you supply, which will be timestamped, +// and stored in case a crash occurs. Crash reports will contain the breadcrumb +// trail from the run of your app that crashed, as well as that of the prior +// run. +// +// Breadcrumbs are limited to 140 characters, and only the most recent 100 are +// kept. Crittercism will automatically insert a breadcrumb marked +// "session_start" +// on each initial launch, or foreground of your app. +// +// Note - Breadcrumbs are an Enterprise level feature. + ++ (void)leaveBreadcrumb:(NSString *)breadcrumb; + +// By default, breadcrumbs are flushed to disk immediately when written. +// This is by design - in order to provide an accurate record of everything +// that happened up until the point your app crashed. +// +// If you are concerned about the performance costs of writing the file, you can +// instruct the library to perform all breadcrumb writes on a background thread. + ++ (void)setAsyncBreadcrumbMode:(BOOL)writeAsync; + +// Inform Crittercism of the device's most recent location for use with +// performance monitoring. ++ (void)updateLocation:(CLLocation *)location; + +// Handled exceptions are a way of reporting exceptions your app intentionally +// caught. If the passed in NSException object was @thrown, the stack trace +// of the thread that threw the exception will be displayed on the Crittercism +// web portal. + +// Reporting of handled exceptions is throttled to once per minute. During +// that minute period, up to 5 handled exceptions will be buffered. + +// Note - Handled exceptions are a Premium level feature. + ++ (BOOL)logHandledException:(NSException *)exception; + +// Logging errors is a way of reporting errors your app has received. If +// the method is passed an NSError *error, the stack trace of the thread that +// is logging the error will be displayed on the Crittercism web portal. + ++ (BOOL)logError:(NSError *)error; + +// Logging endpoints is a way of manually logging custom network library +// network access to URL's which fall outside Crittercism's monitoring +// of NSURLConnection and ASIHTTPRequest method calls. + ++ (BOOL)logNetworkRequest:(NSString *)method + url:(NSURL *)url + latency:(NSTimeInterval)latency + bytesRead:(NSUInteger)bytesRead + bytesSent:(NSUInteger)bytesSent + responseCode:(NSInteger)responseCode + error:(NSError *)error; + +// If you wish to offer your users the ability to opt out of Crittercism +// crash reporting, you can set the OptOutStatus to YES. If you do so, any +// pending crash reports will be purged. + ++ (void)setOptOutStatus:(BOOL)status; + +// Retrieve current opt out status. + ++ (BOOL)getOptOutStatus; + +// Set the maximum number of crash reports that will be stored on +// the local device if the device does not have internet connectivity. If +// more than |maxOfflineCrashReports| crashes occur, the oldest crash will be +// overwritten. Decreasing the value of this setting will not delete +// any offline crash reports. Unsent crash reports will be kept until they are +// successfully transmitted to Crittercism, hence there may be more than +// |maxOfflineCrashReports| stored on the device for a short period of time. +// +// The default value is 3, and there is an upper bound of 10. + ++ (void)setMaxOfflineCrashReports:(NSUInteger)max; + +// Get the maximum number of Crittercism crash reports that will be stored on +// the local device if the device does not have internet connectivity. + ++ (NSUInteger)maxOfflineCrashReports; + +// Get the Crittercism generated unique identifier for this device. +// !! This is NOT the device's UDID. +// +// If called before enabling the library, this will return an empty string. +// +// All Crittercism enabled apps on a device will share the UUID created by the +// first installed Crittercism enabled app. +// +// If all Crittercism enabled applications are removed from a device, a new +// UUID will be generated when the next one is installed. + ++ (NSString *)getUserUUID; + +// Associate a username string with the device's Crittercism UUID. This will +// send the association to Crittercism's back end. + ++ (void)setUsername:(NSString *)username; + +// Associate an arbitrary key/value pair with the device's Crittercism UUID. + ++ (void)setValue:(NSString *)value forKey:(NSString *)key; + +// Crittercism delegate property + ++ (id )delegate; + ++ (void)setDelegate:(id )delegate; + +// Did the application crash on the previous load? + ++ (BOOL)didCrashOnLastLoad; + +// Init and begin a transaction with a default value. + ++ (void)beginTransaction:(NSString *)name; + +// Init and begin a transaction with an input value. + ++ (void)beginTransaction:(NSString *)name withValue:(int)value; + +// End an already begun transaction successfully. + ++ (void)endTransaction:(NSString *)name; + +// End an already begun transaction as a failure. + ++ (void)failTransaction:(NSString *)name; + +// Get the currency cents value of a transaction. + ++ (int)valueForTransaction:(NSString*)name; + +// Set the currency cents value of a transaction. + ++ (void)setValue:(int)value forTransaction:(NSString*)name; + +@end diff --git a/iphone/CrittercismSDK/CrittercismDelegate.h b/iphone/CrittercismSDK/CrittercismDelegate.h new file mode 100644 index 0000000..bc920db --- /dev/null +++ b/iphone/CrittercismSDK/CrittercismDelegate.h @@ -0,0 +1,18 @@ +// +// CrittercismDelegate.h +// Crittercism-iOS +// +// Created by Sean Hermany on 10/19/12. +// Copyright (c) 2012 Crittercism. All rights reserved. +// + +#import + +@protocol CrittercismDelegate + +@optional + +// Will be called if your app crashed the last time it was running. +- (void)crittercismDidCrashOnLastLoad; + +@end diff --git a/iphone/CrittercismSDK/dsym_upload.sh b/iphone/CrittercismSDK/dsym_upload.sh new file mode 100755 index 0000000..4010df6 --- /dev/null +++ b/iphone/CrittercismSDK/dsym_upload.sh @@ -0,0 +1,119 @@ +#!/bin/sh +# Copyright 2013 Crittercism, Inc. All rights reserved. +# +# Usage: +# * (These instructions assume you have dragged the "CrittercismSDK" folder +# into your project in XCode) +# * In the project editor, select your target. +# * Click "Build Phases" at the top of the project editor. +# * Click "Add Build Phase" in the lower right corner. +# * Choose "Add Run Script." +# * Paste the following script into the dark text box. You will have to +# uncomment the lines (remove the #s) of course. +# +# --- SCRIPT BEGINS ON NEXT LINE, COPY AND EDIT FROM THERE --- +# APP_ID="" +# API_KEY="" +# source ${SRCROOT}/CrittercismSDK/dsym_upload.sh +# --- END OF SCRIPT --- + +################################################################################ +# Advanced Settings +# +# You can over-ride these directly in XCode in your Run Script Build Phase, or +# change the defaults below. + +# Should simulator builds cause symbols to be uploaded? +UPLOAD_SIMULATOR_SYMBOLS=${UPLOAD_SIMULATOR_SYMBOLS:=1} + +# This setting determines whether or not your build will fail if the dSYM was +# not uploaded properly to Crittercism's servers. +# +# You may wish to change this setting if you are building without internet +# access, or otherwise are having difficulty connecting to Crittercism's +# servers. +REQUIRE_UPLOAD_SUCCESS=${REQUIRE_UPLOAD_SUCCESS:=1} + +################################################################################ +# You should not need to edit anything past this point. + +DSYM_UPLOAD_ENDPOINT="https://api.crittercism.com/api_beta/dsym/" +exitWithMessageAndCode() { + echo "${1}" + exit ${2} +} + +echo "Uploading dSYM to Crittercism" +echo "" + +# Check to make sure the necessary parameters are defined +if [ ! "${APP_ID}" ]; then + exitWithMessageAndCode "err: Crittercism App ID not defined." 1 +fi + +if [ ! "${API_KEY}" ]; then + exitWithMessageAndCode "err: Crittercism API Key not defined." 1 +fi + +# Display build info +BUNDLE_VERSION=$(/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' ${INFOPLIST_FILE}) +BUNDLE_SHORT_VERSION=$(/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' ${INFOPLIST_FILE}) + +echo "Product Name: ${PRODUCT_NAME}" +echo "Version: ${BUNDLE_SHORT_VERSION}" +echo "Build: ${BUNDLE_VERSION}" +echo "Crittercism App ID: ${APP_ID}" +echo "Crittercism API key: ${API_KEY}" + +# Possibly bail if this is a simulator build +if [ "$EFFECTIVE_PLATFORM_NAME" == "-iphonesimulator" ]; then + if [ $UPLOAD_SIMULATOR_SYMBOLS -eq 0 ]; then + exitWithMessageAndCode "skipping simulator build" 0 + fi +fi + +DSYM_SRC=${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME} +DSYM_ZIP_FPATH="/tmp/$DWARF_DSYM_FILE_NAME.zip" + +# create dSYM .zip file +echo "dSYM location: ${DSYM_SRC}" +if [ ! -d "$DSYM_SRC" ]; then + exitWithMessageAndCode "dSYM not found: ${DSYM_SRC}" 1 +fi + +echo "compressing dSYM to: ${DSYM_ZIP_FPATH} ..." +(/usr/bin/zip --recurse-paths --quiet "${DSYM_ZIP_FPATH}" "${DSYM_SRC}") || exitWithMessageAndCode "err: failed creating zip" 1 +echo "" +echo "Archive created." + +# Upload dSYM to Crittercism +URL=${DSYM_UPLOAD_ENDPOINT}${APP_ID} +echo "Uploading dSYM to Crittercism: ${URL}" + +#curl "${URL}" --write-out %{http_code} --silent --output /dev/null -F dsym=@"${DSYM_ZIP_FPATH}" -F key="${API_KEY}" 2>&1 +STATUS=$(curl "${URL}" --write-out %{http_code} --silent --output /dev/null -F dsym=@"${DSYM_ZIP_FPATH}" -F key="${API_KEY}") + +echo Crittercism API server response: ${STATUS} +if [ $STATUS -ne 200 ]; then + if [ $REQUIRE_UPLOAD_SUCCESS -eq 1 ]; then + echo "err: dSYM archive not succesfully uploaded." + echo "To ignore this condition and build succesfully, add:" + echo "REQUIRE_UPLOAD_SUCCESS=0" + echo "to the Run Script Build Phase invoking this script." + exit 1 + else + echo "err: dSYM archive not succesfully uploaded" + echo "ignoring due to REQUIRE_UPLOAD_SUCCESS=0" + fi +fi + + +# Remove temp dSYM archive +echo "Cleaning up temporary dSYM archive..." +/bin/rm -f "${DSYM_ZIP_FPATH}" + +echo "Crittercism dSYM upload complete." + +if [ "$?" -ne 0 ]; then + exitWithMessageAndCode "an error was encountered uploading dSYM" 1 +fi diff --git a/iphone/CrittercismSDK/libCrittercism_v5_0_7.a b/iphone/CrittercismSDK/libCrittercism_v5_0_7.a new file mode 100644 index 0000000..a8b547b Binary files /dev/null and b/iphone/CrittercismSDK/libCrittercism_v5_0_7.a differ diff --git a/iphone/crittercism-iphone-1.0.0.zip b/iphone/dist/crittercism-iphone-1.0.0.zip similarity index 100% rename from iphone/crittercism-iphone-1.0.0.zip rename to iphone/dist/crittercism-iphone-1.0.0.zip diff --git a/iphone/dist/crittercism-iphone-1.1.0.zip b/iphone/dist/crittercism-iphone-1.1.0.zip new file mode 100644 index 0000000..7521980 Binary files /dev/null and b/iphone/dist/crittercism-iphone-1.1.0.zip differ diff --git a/iphone/manifest b/iphone/manifest index c3a8ffc..45fb30f 100644 --- a/iphone/manifest +++ b/iphone/manifest @@ -2,7 +2,7 @@ # this is your module manifest and used by Titanium # during compilation, packaging, distribution, etc. # -version: 1.0.0 +version: 1.1.0 apiversion: 2 description: CrittercismModule author: Mike Fogg @@ -14,4 +14,4 @@ name: CrittercismModule moduleid: crittercism guid: 1d150bda-33b2-4489-84f1-4630affc1b05 platform: iphone -minsdk: 3.0.0 +minsdk: 3.4.1 diff --git a/iphone/titanium.xcconfig b/iphone/titanium.xcconfig index 3b84e9f..8a5eb62 100644 --- a/iphone/titanium.xcconfig +++ b/iphone/titanium.xcconfig @@ -4,13 +4,13 @@ // OF YOUR TITANIUM SDK YOU'RE BUILDING FOR // // -TITANIUM_SDK_VERSION = 3.3.1 +TITANIUM_SDK_VERSION = 3.5.0.RC // // THESE SHOULD BE OK GENERALLY AS-IS // -TITANIUM_SDK = ~/Library/Application Support/Titanium/mobilesdk/osx/3.3.1 +TITANIUM_SDK = ~/Library/Application Support/Titanium/mobilesdk/osx/$(TITANIUM_SDK_VERSION) TITANIUM_BASE_SDK = "$(TITANIUM_SDK)/iphone/include" TITANIUM_BASE_SDK2 = "$(TITANIUM_SDK)/iphone/include/TiCore" -HEADER_SEARCH_PATHS= $(TITANIUM_BASE_SDK) $(TITANIUM_BASE_SDK2) \ No newline at end of file +HEADER_SEARCH_PATHS= $(TITANIUM_BASE_SDK) $(TITANIUM_BASE_SDK2) ~$(TITANIUM_BASE_SDK) ~$(TITANIUM_BASE_SDK2) \ No newline at end of file