diff --git a/.gitignore b/.gitignore index 25e32f1..4c587d8 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ DerivedData Podfile.lock Pods/* demo/pods/* +TBOOMDetector.xcodeproj/project.xcworkspace diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..f69e9b0 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,13 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.3.0 + hooks: + - id: end-of-file-fixer + - id: check-yaml + - id: check-merge-conflict + - id: no-commit-to-branch + args: [--branch, master] + - repo: https://github.com/doublify/pre-commit-clang-format + sha: 62302476d0da01515660132d76902359bed0f782 + hooks: + - id: clang-format diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..1b1ca20 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,12 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.0.0] - 2020-10-22 +### Changed +- Dependency on crashlytics has been removed, and TBOOMDetector must now be passed a block that will be called to determine if the last session crashed. +- Minimum iOS version has changed to 10.0. +- Code is now formatted with Clang Format using pre-commit hooks. +- Removed cocoapods from demo app. diff --git a/LICENSE b/LICENSE index 568767b..1c817ab 100644 --- a/LICENSE +++ b/LICENSE @@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/README.md b/README.md index 76b76aa..6e3d943 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,22 @@ # TBOOMDetector + Detect Out Of Memory events in an iOS app by process of elimination. If we can't figure out why the app is relaunching, it must have been the OOM Killer. For a complete explanation read [this excellent blog post from Facebook](https://code.facebook.com/posts/1146930688654547/reducing-fooms-in-the-facebook-ios-app/). Requires crashlytics for detecting crashes. Example: + ```objc -TBOOMDetector *oomDetector = [[TBOOMDetector alloc] initWithCrashlyticsApiKey:@"..." - directory:directory +TBOOMDetector *oomDetector = [[TBOOMDetector alloc] initWithDirectory:directory + crashCheck:^BOOL{ + // return [[Crashlytics crashlytics] didCrashDuringPreviousExecution] + return NO; + } callback:^(TBTerminationType terminationType) { if(terminationType == TBTerminationTypeBackgroundOom) { DDLogError(@"Detected Background OOM"); - [Answers logCustomEventWithName:@"OOM Background Crash" - customAttributes:nil]; } else if(terminationType == TBTerminationTypeForegroundOom) { DDLogError(@"Detected Foreground OOM"); - [Answers logCustomEventWithName:@"OOM foreground Crash" - customAttributes:nil]; } }]; ``` diff --git a/TBOOMDetector.podspec b/TBOOMDetector.podspec index 2e22f9c..ff42b01 100644 --- a/TBOOMDetector.podspec +++ b/TBOOMDetector.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "TBOOMDetector" - s.version = "0.6" + s.version = "1.0" s.summary = "Detect Out Of Memory events in an iOS app" s.description = <<-DESC @@ -14,12 +14,10 @@ Pod::Spec.new do |s| s.author = { "TrailBehind, Inc." => "Jesse@Gaiagps.com" } s.social_media_url = "http://twitter.com/gaiagps" - s.platform = :ios, "6.0" + s.platform = :ios, "10.0" - s.source = { :git => "https://github.com/trailbehind/TBOOMDetector.git", :tag => "0.6" } + s.source = { :git => "https://github.com/trailbehind/TBOOMDetector.git", :tag => "1.0" } s.source_files = "TBOOMDetector/*.{h,m,c}" - s.dependency 'Crashlytics', '~> 3' - s.static_framework = true end diff --git a/TBOOMDetector/TBDebuggerUtils.h b/TBOOMDetector/TBDebuggerUtils.h index 2505ada..9caa82a 100644 --- a/TBOOMDetector/TBDebuggerUtils.h +++ b/TBOOMDetector/TBDebuggerUtils.h @@ -12,6 +12,6 @@ /** Determine if debugger is attached to application @return true if debugger is attached */ -bool isApplicationAttachedToDebugger(); +bool isApplicationAttachedToDebugger(void); #endif diff --git a/TBOOMDetector/TBOOMDetector.h b/TBOOMDetector/TBOOMDetector.h index bafc442..3d180eb 100644 --- a/TBOOMDetector/TBOOMDetector.h +++ b/TBOOMDetector/TBOOMDetector.h @@ -7,7 +7,6 @@ // #import -#import typedef NS_ENUM(NSInteger, TBTerminationType) { TBTerminationTypeUnknown = -1, @@ -27,9 +26,9 @@ typedef NS_ENUM(NSInteger, TBTerminationType) { @property (nonatomic, readonly) TBTerminationType lastTerminationType; @property (nonatomic, readonly) BOOL appWasBackgroundedOnExit; -- (instancetype)initWithCrashlyticsApiKey:(NSString*)apiKey - directory:(NSString*)directory - callback:(void (^)(TBTerminationType terminationType))callback; +- (instancetype)initWithDirectory:(NSString*)directory + crashCheck:(BOOL (^)(void))crashCheck + callback:(void (^)(TBTerminationType terminationType))callback; - (void)logAbort; - (void)logExit; diff --git a/TBOOMDetector/TBOOMDetector.m b/TBOOMDetector/TBOOMDetector.m index a9a73bb..91c45f8 100644 --- a/TBOOMDetector/TBOOMDetector.m +++ b/TBOOMDetector/TBOOMDetector.m @@ -10,7 +10,7 @@ #import "TBDebuggerUtils.h" #import -@interface TBOOMDetector () { +@interface TBOOMDetector () { NSString *terminationEventFile; NSString *backgroundStateFile; NSString *terminationEventFileContents; @@ -25,13 +25,12 @@ @implementation TBOOMDetector static NSString *AppVersionKey = @"AppVersion"; static NSString *OSVersionKey = @"OSVersion"; -- (instancetype)initWithCrashlyticsApiKey:(NSString*)apiKey - directory:(NSString*)directory - callback:(void (^)(TBTerminationType terminationType))callback { +- (instancetype)initWithDirectory:(NSString*)directory + crashCheck:(BOOL (^)(void))crashCheck + callback:(void (^)(TBTerminationType terminationType))callback { self = [super init]; if(self) { stateDirectory = directory; - [Crashlytics startWithAPIKey:apiKey delegate:self]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleBackgroundNotification) @@ -68,8 +67,8 @@ - (instancetype)initWithCrashlyticsApiKey:(NSString*)apiKey _appWasBackgroundedOnExit = YES; } - //Wait for crashlytics to run, so we know if there was a crash - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + dispatch_async(dispatch_get_main_queue(), ^{ + self->crashWasDetected = crashCheck(); [self runChecks:callback]; }); } @@ -200,13 +199,6 @@ - (void)logTerminationEvent:(NSString*)event { } -#pragma mark - CrashlyticsDelegate -- (void)crashlyticsDidDetectReportForLastExecution:(CLSReport *)report completionHandler:(void (^)(BOOL submit))completionHandler { - crashWasDetected = YES; - completionHandler(YES); -} - - #pragma mark - notifications - (void)handleBackgroundNotification { [@"" writeToFile:backgroundStateFile atomically:NO encoding:NSUTF8StringEncoding error:nil]; diff --git a/demo/Podfile b/demo/Podfile deleted file mode 100644 index dcdd807..0000000 --- a/demo/Podfile +++ /dev/null @@ -1,6 +0,0 @@ -platform :ios, '6.0' - -target 'demo' do - pod 'Fabric' - pod 'Crashlytics' -end diff --git a/demo/demo.xcodeproj/project.pbxproj b/demo/demo.xcodeproj/project.pbxproj index 7845c96..f6265ef 100644 --- a/demo/demo.xcodeproj/project.pbxproj +++ b/demo/demo.xcodeproj/project.pbxproj @@ -15,12 +15,9 @@ 88CC4CE71B966B5A00910C78 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 88CC4CE51B966B5A00910C78 /* LaunchScreen.xib */; }; 88CC4D001B966B6F00910C78 /* TBDebuggerUtils.c in Sources */ = {isa = PBXBuildFile; fileRef = 88CC4CFC1B966B6F00910C78 /* TBDebuggerUtils.c */; }; 88CC4D011B966B6F00910C78 /* TBOOMDetector.m in Sources */ = {isa = PBXBuildFile; fileRef = 88CC4CFF1B966B6F00910C78 /* TBOOMDetector.m */; }; - BDE6C311E045EDABDE5C8915 /* libPods-demo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2EE3A38E0FFEA6F39697F353 /* libPods-demo.a */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 0B25F4BEB8A7B6B0B1A1D328 /* Pods-demo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-demo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-demo/Pods-demo.debug.xcconfig"; sourceTree = ""; }; - 2EE3A38E0FFEA6F39697F353 /* libPods-demo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-demo.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 88CC4CD31B966B5A00910C78 /* demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = demo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 88CC4CD71B966B5A00910C78 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 88CC4CD81B966B5A00910C78 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; @@ -35,7 +32,6 @@ 88CC4CFD1B966B6F00910C78 /* TBDebuggerUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TBDebuggerUtils.h; path = ../../TBOOMDetector/TBDebuggerUtils.h; sourceTree = ""; }; 88CC4CFE1B966B6F00910C78 /* TBOOMDetector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TBOOMDetector.h; path = ../../TBOOMDetector/TBOOMDetector.h; sourceTree = ""; }; 88CC4CFF1B966B6F00910C78 /* TBOOMDetector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TBOOMDetector.m; path = ../../TBOOMDetector/TBOOMDetector.m; sourceTree = ""; }; - E95E03D2E02E98FD6B129E0E /* Pods-demo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-demo.release.xcconfig"; path = "Pods/Target Support Files/Pods-demo/Pods-demo.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -43,28 +39,17 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - BDE6C311E045EDABDE5C8915 /* libPods-demo.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 3F93AFAAAB845A90FC0C8CEF /* Frameworks */ = { - isa = PBXGroup; - children = ( - 2EE3A38E0FFEA6F39697F353 /* libPods-demo.a */, - ); - name = Frameworks; - sourceTree = ""; - }; 88CC4CCA1B966B5A00910C78 = { isa = PBXGroup; children = ( 88CC4CD51B966B5A00910C78 /* demo */, 88CC4CD41B966B5A00910C78 /* Products */, - C8523073638B8A6B9CC55924 /* Pods */, - 3F93AFAAAB845A90FC0C8CEF /* Frameworks */, ); sourceTree = ""; }; @@ -104,15 +89,6 @@ name = "Supporting Files"; sourceTree = ""; }; - C8523073638B8A6B9CC55924 /* Pods */ = { - isa = PBXGroup; - children = ( - 0B25F4BEB8A7B6B0B1A1D328 /* Pods-demo.debug.xcconfig */, - E95E03D2E02E98FD6B129E0E /* Pods-demo.release.xcconfig */, - ); - name = Pods; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -120,12 +96,9 @@ isa = PBXNativeTarget; buildConfigurationList = 88CC4CF61B966B5A00910C78 /* Build configuration list for PBXNativeTarget "demo" */; buildPhases = ( - A70523348EAB9BD05FB01BA4 /* [CP] Check Pods Manifest.lock */, 88CC4CCF1B966B5A00910C78 /* Sources */, 88CC4CD01B966B5A00910C78 /* Frameworks */, 88CC4CD11B966B5A00910C78 /* Resources */, - 6FBEFCEF5390EB2816E048F2 /* [CP] Copy Pods Resources */, - B3F73AC4F744DD5BADA2ADBF /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -142,7 +115,7 @@ 88CC4CCB1B966B5A00910C78 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0640; + LastUpgradeCheck = 1200; ORGANIZATIONNAME = "Trailbehind inc."; TargetAttributes = { 88CC4CD21B966B5A00910C78 = { @@ -155,6 +128,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -181,57 +155,6 @@ }; /* End PBXResourcesBuildPhase section */ -/* Begin PBXShellScriptBuildPhase section */ - 6FBEFCEF5390EB2816E048F2 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-demo/Pods-demo-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - A70523348EAB9BD05FB01BA4 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-demo-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - B3F73AC4F744DD5BADA2ADBF /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-demo/Pods-demo-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - /* Begin PBXSourcesBuildPhase section */ 88CC4CCF1B966B5A00910C78 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -271,23 +194,36 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -303,7 +239,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.4; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -315,17 +251,29 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -341,7 +289,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.4; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -351,22 +299,22 @@ }; 88CC4CF71B966B5A00910C78 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 0B25F4BEB8A7B6B0B1A1D328 /* Pods-demo.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = demo/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.trailbehind.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; 88CC4CF81B966B5A00910C78 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = E95E03D2E02E98FD6B129E0E /* Pods-demo.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = demo/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.trailbehind.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; diff --git a/demo/demo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/demo/demo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/demo/demo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/demo/demo.xcworkspace/contents.xcworkspacedata b/demo/demo.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index b72a852..0000000 --- a/demo/demo.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/demo/demo/AppDelegate.h b/demo/demo/AppDelegate.h index 0ff38eb..b945689 100644 --- a/demo/demo/AppDelegate.h +++ b/demo/demo/AppDelegate.h @@ -14,4 +14,3 @@ @end - diff --git a/demo/demo/AppDelegate.m b/demo/demo/AppDelegate.m index 1d6b0e7..d7ace3f 100644 --- a/demo/demo/AppDelegate.m +++ b/demo/demo/AppDelegate.m @@ -10,17 +10,20 @@ #import "TBOOMDetector.h" @interface AppDelegate () -@property (nonatomic, retain) TBOOMDetector *oomDetector; +@property (nonatomic, strong) TBOOMDetector *oomDetector; @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSArray *paths = NSSearchPathForDirectoriesInDomains (NSLibraryDirectory, NSUserDomainMask, YES); - self.oomDetector = [[TBOOMDetector alloc] initWithCrashlyticsApiKey:@"" - directory:paths[0] + self.oomDetector = [[TBOOMDetector alloc] initWithDirectory:paths[0] + crashCheck:^BOOL{ + // return [[Crashlytics crashlytics] didCrashDuringPreviousExecution]; + return NO; + } callback:^(TBTerminationType terminationType) { - NSLog(@"Termination type %li", (long)terminationType); + NSLog(@"Termination type %li - %@", (long)terminationType, [TBOOMDetector stringFromTBTerminationType:terminationType]); }]; return YES; } diff --git a/demo/demo/Images.xcassets/AppIcon.appiconset/Contents.json b/demo/demo/Images.xcassets/AppIcon.appiconset/Contents.json index 36d2c80..c1dc209 100644 --- a/demo/demo/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/demo/demo/Images.xcassets/AppIcon.appiconset/Contents.json @@ -65,4 +65,4 @@ "version" : 1, "author" : "xcode" } -} \ No newline at end of file +} diff --git a/demo/demo/Info.plist b/demo/demo/Info.plist index 325a9f8..40c6215 100644 --- a/demo/demo/Info.plist +++ b/demo/demo/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - com.trailbehind.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/demo/demo/ViewController.h b/demo/demo/ViewController.h index c3090de..cfddcf5 100644 --- a/demo/demo/ViewController.h +++ b/demo/demo/ViewController.h @@ -12,4 +12,3 @@ @end -