From 9de1e646ccd434b79778c3a11fc29a7577f86ecc Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Mon, 5 Dec 2011 23:58:31 +0100 Subject: [PATCH 01/17] Removing returning shared instance before dispatch_once is invoked Might rather harm things and is not required anyway. --- Classes/BWHockeyManager.m | 2 -- Classes/CNSHockeyManager.m | 4 ---- 2 files changed, 6 deletions(-) diff --git a/Classes/BWHockeyManager.m b/Classes/BWHockeyManager.m index c2899a76b7..4802c89d7e 100644 --- a/Classes/BWHockeyManager.m +++ b/Classes/BWHockeyManager.m @@ -123,8 +123,6 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain"; static BWHockeyManager *sharedInstance = nil; static dispatch_once_t pred; - if (sharedInstance) return sharedInstance; - dispatch_once(&pred, ^{ sharedInstance = [BWHockeyManager alloc]; sharedInstance = [sharedInstance init]; diff --git a/Classes/CNSHockeyManager.m b/Classes/CNSHockeyManager.m index 7e92615dab..693f1aeff4 100644 --- a/Classes/CNSHockeyManager.m +++ b/Classes/CNSHockeyManager.m @@ -42,10 +42,6 @@ static CNSHockeyManager *sharedInstance = nil; static dispatch_once_t pred; - if (sharedInstance) { - return sharedInstance; - } - dispatch_once(&pred, ^{ sharedInstance = [CNSHockeyManager alloc]; sharedInstance = [sharedInstance init]; From 4e39526364a1787a61a22d361d994db6691e4443 Mon Sep 17 00:00:00 2001 From: Stephan Diederich Date: Mon, 5 Dec 2011 23:29:14 +0100 Subject: [PATCH 02/17] add default xcodeproj minor adjustments for paths and such --- Support/HockeySDK.xcodeproj/project.pbxproj | 532 ++++++++++++++++++ .../HockeySDKTests/HockeySDKTests-Info.plist | 22 + Support/HockeySDKTests/HockeySDKTests.h | 13 + Support/HockeySDKTests/HockeySDKTests.m | 32 ++ .../HockeySDKTests/en.lproj/InfoPlist.strings | 2 + 5 files changed, 601 insertions(+) create mode 100644 Support/HockeySDK.xcodeproj/project.pbxproj create mode 100644 Support/HockeySDKTests/HockeySDKTests-Info.plist create mode 100644 Support/HockeySDKTests/HockeySDKTests.h create mode 100644 Support/HockeySDKTests/HockeySDKTests.m create mode 100644 Support/HockeySDKTests/en.lproj/InfoPlist.strings diff --git a/Support/HockeySDK.xcodeproj/project.pbxproj b/Support/HockeySDK.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..512f50c811 --- /dev/null +++ b/Support/HockeySDK.xcodeproj/project.pbxproj @@ -0,0 +1,532 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + E400561E148D79B500EB22B9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E400561D148D79B500EB22B9 /* Foundation.framework */; }; + E400562C148D79B500EB22B9 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E400562B148D79B500EB22B9 /* SenTestingKit.framework */; }; + E400562E148D79B500EB22B9 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E400562D148D79B500EB22B9 /* UIKit.framework */; }; + E400562F148D79B500EB22B9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E400561D148D79B500EB22B9 /* Foundation.framework */; }; + E4005632148D79B500EB22B9 /* libHockeySDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E400561A148D79B500EB22B9 /* libHockeySDK.a */; }; + E4005638148D79B500EB22B9 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = E4005636148D79B500EB22B9 /* InfoPlist.strings */; }; + E400563B148D79B500EB22B9 /* HockeySDKTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E400563A148D79B500EB22B9 /* HockeySDKTests.m */; }; + E400564B148D7A3000EB22B9 /* Hockey.bundle in Resources */ = {isa = PBXBuildFile; fileRef = E4005649148D7A3000EB22B9 /* Hockey.bundle */; }; + E400564C148D7A3000EB22B9 /* Quincy.bundle in Resources */ = {isa = PBXBuildFile; fileRef = E400564A148D7A3000EB22B9 /* Quincy.bundle */; }; + E41EB471148D7BF50015DEDC /* BWApp.h in Headers */ = {isa = PBXBuildFile; fileRef = E41EB459148D7BF50015DEDC /* BWApp.h */; }; + E41EB472148D7BF50015DEDC /* BWApp.m in Sources */ = {isa = PBXBuildFile; fileRef = E41EB45A148D7BF50015DEDC /* BWApp.m */; }; + E41EB473148D7BF50015DEDC /* BWGlobal.h in Headers */ = {isa = PBXBuildFile; fileRef = E41EB45B148D7BF50015DEDC /* BWGlobal.h */; }; + E41EB474148D7BF50015DEDC /* BWGlobal.m in Sources */ = {isa = PBXBuildFile; fileRef = E41EB45C148D7BF50015DEDC /* BWGlobal.m */; }; + E41EB475148D7BF50015DEDC /* BWHockeyManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E41EB45D148D7BF50015DEDC /* BWHockeyManager.h */; }; + E41EB476148D7BF50015DEDC /* BWHockeyManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E41EB45E148D7BF50015DEDC /* BWHockeyManager.m */; }; + E41EB477148D7BF50015DEDC /* BWHockeySettingsViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = E41EB45F148D7BF50015DEDC /* BWHockeySettingsViewController.h */; }; + E41EB478148D7BF50015DEDC /* BWHockeySettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E41EB460148D7BF50015DEDC /* BWHockeySettingsViewController.m */; }; + E41EB479148D7BF50015DEDC /* BWHockeyViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = E41EB461148D7BF50015DEDC /* BWHockeyViewController.h */; }; + E41EB47A148D7BF50015DEDC /* BWHockeyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E41EB462148D7BF50015DEDC /* BWHockeyViewController.m */; }; + E41EB47B148D7BF50015DEDC /* BWQuincyManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E41EB463148D7BF50015DEDC /* BWQuincyManager.h */; }; + E41EB47C148D7BF50015DEDC /* BWQuincyManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E41EB464148D7BF50015DEDC /* BWQuincyManager.m */; }; + E41EB47D148D7BF50015DEDC /* CNSHockeyManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E41EB465148D7BF50015DEDC /* CNSHockeyManager.h */; }; + E41EB47E148D7BF50015DEDC /* CNSHockeyManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E41EB466148D7BF50015DEDC /* CNSHockeyManager.m */; }; + E41EB47F148D7BF50015DEDC /* NSString+HockeyAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = E41EB467148D7BF50015DEDC /* NSString+HockeyAdditions.h */; }; + E41EB480148D7BF50015DEDC /* NSString+HockeyAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = E41EB468148D7BF50015DEDC /* NSString+HockeyAdditions.m */; }; + E41EB481148D7BF50015DEDC /* PSAppStoreHeader.h in Headers */ = {isa = PBXBuildFile; fileRef = E41EB469148D7BF50015DEDC /* PSAppStoreHeader.h */; }; + E41EB482148D7BF50015DEDC /* PSAppStoreHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = E41EB46A148D7BF50015DEDC /* PSAppStoreHeader.m */; }; + E41EB483148D7BF50015DEDC /* PSStoreButton.h in Headers */ = {isa = PBXBuildFile; fileRef = E41EB46B148D7BF50015DEDC /* PSStoreButton.h */; }; + E41EB484148D7BF50015DEDC /* PSStoreButton.m in Sources */ = {isa = PBXBuildFile; fileRef = E41EB46C148D7BF50015DEDC /* PSStoreButton.m */; }; + E41EB485148D7BF50015DEDC /* PSWebTableViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = E41EB46D148D7BF50015DEDC /* PSWebTableViewCell.h */; }; + E41EB486148D7BF50015DEDC /* PSWebTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E41EB46E148D7BF50015DEDC /* PSWebTableViewCell.m */; }; + E41EB487148D7BF50015DEDC /* UIImage+HockeyAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = E41EB46F148D7BF50015DEDC /* UIImage+HockeyAdditions.h */; }; + E41EB488148D7BF50015DEDC /* UIImage+HockeyAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = E41EB470148D7BF50015DEDC /* UIImage+HockeyAdditions.m */; }; + E41EB48C148D7C4E0015DEDC /* CrashReporter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E41EB48B148D7C4E0015DEDC /* CrashReporter.framework */; }; + E41EB48D148D7C4E0015DEDC /* CrashReporter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E41EB48B148D7C4E0015DEDC /* CrashReporter.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + E4005630148D79B500EB22B9 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = E4005611148D79B500EB22B9 /* Project object */; + proxyType = 1; + remoteGlobalIDString = E4005619148D79B500EB22B9; + remoteInfo = HockeySDK; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + E400561A148D79B500EB22B9 /* libHockeySDK.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libHockeySDK.a; sourceTree = BUILT_PRODUCTS_DIR; }; + E400561D148D79B500EB22B9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + E400562A148D79B500EB22B9 /* HockeySDKTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HockeySDKTests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; + E400562B148D79B500EB22B9 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; }; + E400562D148D79B500EB22B9 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; + E4005635148D79B500EB22B9 /* HockeySDKTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "HockeySDKTests-Info.plist"; sourceTree = ""; }; + E4005637148D79B500EB22B9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + E4005639148D79B500EB22B9 /* HockeySDKTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HockeySDKTests.h; sourceTree = ""; }; + E400563A148D79B500EB22B9 /* HockeySDKTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HockeySDKTests.m; sourceTree = ""; }; + E4005649148D7A3000EB22B9 /* Hockey.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Hockey.bundle; sourceTree = ""; }; + E400564A148D7A3000EB22B9 /* Quincy.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Quincy.bundle; sourceTree = ""; }; + E41EB459148D7BF50015DEDC /* BWApp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BWApp.h; sourceTree = ""; }; + E41EB45A148D7BF50015DEDC /* BWApp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BWApp.m; sourceTree = ""; }; + E41EB45B148D7BF50015DEDC /* BWGlobal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BWGlobal.h; sourceTree = ""; }; + E41EB45C148D7BF50015DEDC /* BWGlobal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BWGlobal.m; sourceTree = ""; }; + E41EB45D148D7BF50015DEDC /* BWHockeyManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BWHockeyManager.h; sourceTree = ""; }; + E41EB45E148D7BF50015DEDC /* BWHockeyManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BWHockeyManager.m; sourceTree = ""; }; + E41EB45F148D7BF50015DEDC /* BWHockeySettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BWHockeySettingsViewController.h; sourceTree = ""; }; + E41EB460148D7BF50015DEDC /* BWHockeySettingsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BWHockeySettingsViewController.m; sourceTree = ""; }; + E41EB461148D7BF50015DEDC /* BWHockeyViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BWHockeyViewController.h; sourceTree = ""; }; + E41EB462148D7BF50015DEDC /* BWHockeyViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BWHockeyViewController.m; sourceTree = ""; }; + E41EB463148D7BF50015DEDC /* BWQuincyManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BWQuincyManager.h; sourceTree = ""; }; + E41EB464148D7BF50015DEDC /* BWQuincyManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BWQuincyManager.m; sourceTree = ""; }; + E41EB465148D7BF50015DEDC /* CNSHockeyManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNSHockeyManager.h; sourceTree = ""; }; + E41EB466148D7BF50015DEDC /* CNSHockeyManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNSHockeyManager.m; sourceTree = ""; }; + E41EB467148D7BF50015DEDC /* NSString+HockeyAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+HockeyAdditions.h"; sourceTree = ""; }; + E41EB468148D7BF50015DEDC /* NSString+HockeyAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+HockeyAdditions.m"; sourceTree = ""; }; + E41EB469148D7BF50015DEDC /* PSAppStoreHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSAppStoreHeader.h; sourceTree = ""; }; + E41EB46A148D7BF50015DEDC /* PSAppStoreHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSAppStoreHeader.m; sourceTree = ""; }; + E41EB46B148D7BF50015DEDC /* PSStoreButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSStoreButton.h; sourceTree = ""; }; + E41EB46C148D7BF50015DEDC /* PSStoreButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSStoreButton.m; sourceTree = ""; }; + E41EB46D148D7BF50015DEDC /* PSWebTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PSWebTableViewCell.h; sourceTree = ""; }; + E41EB46E148D7BF50015DEDC /* PSWebTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSWebTableViewCell.m; sourceTree = ""; }; + E41EB46F148D7BF50015DEDC /* UIImage+HockeyAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+HockeyAdditions.h"; sourceTree = ""; }; + E41EB470148D7BF50015DEDC /* UIImage+HockeyAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+HockeyAdditions.m"; sourceTree = ""; }; + E41EB48B148D7C4E0015DEDC /* CrashReporter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CrashReporter.framework; path = ../Vendor/CrashReporter.framework; sourceTree = ""; }; + E4E7335A148D7A5A00763A39 /* LICENSE.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = LICENSE.txt; path = ../LICENSE.txt; sourceTree = ""; }; + E4E7335B148D7A5A00763A39 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = text; name = README.md; path = ../README.md; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + E4005617148D79B500EB22B9 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + E400561E148D79B500EB22B9 /* Foundation.framework in Frameworks */, + E41EB48C148D7C4E0015DEDC /* CrashReporter.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E4005626148D79B500EB22B9 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + E400562C148D79B500EB22B9 /* SenTestingKit.framework in Frameworks */, + E400562E148D79B500EB22B9 /* UIKit.framework in Frameworks */, + E400562F148D79B500EB22B9 /* Foundation.framework in Frameworks */, + E4005632148D79B500EB22B9 /* libHockeySDK.a in Frameworks */, + E41EB48D148D7C4E0015DEDC /* CrashReporter.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + E400560F148D79B500EB22B9 = { + isa = PBXGroup; + children = ( + E41EB489148D7BF90015DEDC /* HockeySDK */, + E4005633148D79B500EB22B9 /* HockeySDKTests */, + E400561C148D79B500EB22B9 /* Frameworks */, + E4005648148D7A3000EB22B9 /* Resources */, + E400561B148D79B500EB22B9 /* Products */, + E4E7335A148D7A5A00763A39 /* LICENSE.txt */, + E4E7335B148D7A5A00763A39 /* README.md */, + ); + sourceTree = ""; + }; + E400561B148D79B500EB22B9 /* Products */ = { + isa = PBXGroup; + children = ( + E400561A148D79B500EB22B9 /* libHockeySDK.a */, + E400562A148D79B500EB22B9 /* HockeySDKTests.octest */, + ); + name = Products; + sourceTree = ""; + }; + E400561C148D79B500EB22B9 /* Frameworks */ = { + isa = PBXGroup; + children = ( + E41EB48B148D7C4E0015DEDC /* CrashReporter.framework */, + E400561D148D79B500EB22B9 /* Foundation.framework */, + E400562B148D79B500EB22B9 /* SenTestingKit.framework */, + E400562D148D79B500EB22B9 /* UIKit.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + E4005633148D79B500EB22B9 /* HockeySDKTests */ = { + isa = PBXGroup; + children = ( + E4005639148D79B500EB22B9 /* HockeySDKTests.h */, + E400563A148D79B500EB22B9 /* HockeySDKTests.m */, + E4005634148D79B500EB22B9 /* Supporting Files */, + ); + path = HockeySDKTests; + sourceTree = ""; + }; + E4005634148D79B500EB22B9 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + E4005635148D79B500EB22B9 /* HockeySDKTests-Info.plist */, + E4005636148D79B500EB22B9 /* InfoPlist.strings */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + E4005648148D7A3000EB22B9 /* Resources */ = { + isa = PBXGroup; + children = ( + E4005649148D7A3000EB22B9 /* Hockey.bundle */, + E400564A148D7A3000EB22B9 /* Quincy.bundle */, + ); + name = Resources; + path = ../Resources; + sourceTree = ""; + }; + E41EB458148D7BF50015DEDC /* Classes */ = { + isa = PBXGroup; + children = ( + E41EB48A148D7C150015DEDC /* Helper */, + E41EB459148D7BF50015DEDC /* BWApp.h */, + E41EB45A148D7BF50015DEDC /* BWApp.m */, + E41EB45B148D7BF50015DEDC /* BWGlobal.h */, + E41EB45C148D7BF50015DEDC /* BWGlobal.m */, + E41EB45D148D7BF50015DEDC /* BWHockeyManager.h */, + E41EB45E148D7BF50015DEDC /* BWHockeyManager.m */, + E41EB45F148D7BF50015DEDC /* BWHockeySettingsViewController.h */, + E41EB460148D7BF50015DEDC /* BWHockeySettingsViewController.m */, + E41EB461148D7BF50015DEDC /* BWHockeyViewController.h */, + E41EB462148D7BF50015DEDC /* BWHockeyViewController.m */, + E41EB463148D7BF50015DEDC /* BWQuincyManager.h */, + E41EB464148D7BF50015DEDC /* BWQuincyManager.m */, + E41EB465148D7BF50015DEDC /* CNSHockeyManager.h */, + E41EB466148D7BF50015DEDC /* CNSHockeyManager.m */, + ); + name = Classes; + path = ../Classes; + sourceTree = ""; + }; + E41EB489148D7BF90015DEDC /* HockeySDK */ = { + isa = PBXGroup; + children = ( + E41EB458148D7BF50015DEDC /* Classes */, + ); + name = HockeySDK; + sourceTree = ""; + }; + E41EB48A148D7C150015DEDC /* Helper */ = { + isa = PBXGroup; + children = ( + E41EB467148D7BF50015DEDC /* NSString+HockeyAdditions.h */, + E41EB468148D7BF50015DEDC /* NSString+HockeyAdditions.m */, + E41EB469148D7BF50015DEDC /* PSAppStoreHeader.h */, + E41EB46A148D7BF50015DEDC /* PSAppStoreHeader.m */, + E41EB46B148D7BF50015DEDC /* PSStoreButton.h */, + E41EB46C148D7BF50015DEDC /* PSStoreButton.m */, + E41EB46D148D7BF50015DEDC /* PSWebTableViewCell.h */, + E41EB46E148D7BF50015DEDC /* PSWebTableViewCell.m */, + E41EB46F148D7BF50015DEDC /* UIImage+HockeyAdditions.h */, + E41EB470148D7BF50015DEDC /* UIImage+HockeyAdditions.m */, + ); + name = Helper; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + E4005618148D79B500EB22B9 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + E41EB471148D7BF50015DEDC /* BWApp.h in Headers */, + E41EB473148D7BF50015DEDC /* BWGlobal.h in Headers */, + E41EB475148D7BF50015DEDC /* BWHockeyManager.h in Headers */, + E41EB477148D7BF50015DEDC /* BWHockeySettingsViewController.h in Headers */, + E41EB479148D7BF50015DEDC /* BWHockeyViewController.h in Headers */, + E41EB47B148D7BF50015DEDC /* BWQuincyManager.h in Headers */, + E41EB47D148D7BF50015DEDC /* CNSHockeyManager.h in Headers */, + E41EB47F148D7BF50015DEDC /* NSString+HockeyAdditions.h in Headers */, + E41EB481148D7BF50015DEDC /* PSAppStoreHeader.h in Headers */, + E41EB483148D7BF50015DEDC /* PSStoreButton.h in Headers */, + E41EB485148D7BF50015DEDC /* PSWebTableViewCell.h in Headers */, + E41EB487148D7BF50015DEDC /* UIImage+HockeyAdditions.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + E4005619148D79B500EB22B9 /* HockeySDK */ = { + isa = PBXNativeTarget; + buildConfigurationList = E400563E148D79B500EB22B9 /* Build configuration list for PBXNativeTarget "HockeySDK" */; + buildPhases = ( + E4005616148D79B500EB22B9 /* Sources */, + E4005617148D79B500EB22B9 /* Frameworks */, + E4005618148D79B500EB22B9 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = HockeySDK; + productName = HockeySDK; + productReference = E400561A148D79B500EB22B9 /* libHockeySDK.a */; + productType = "com.apple.product-type.library.static"; + }; + E4005629148D79B500EB22B9 /* HockeySDKTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = E4005641148D79B500EB22B9 /* Build configuration list for PBXNativeTarget "HockeySDKTests" */; + buildPhases = ( + E4005625148D79B500EB22B9 /* Sources */, + E4005626148D79B500EB22B9 /* Frameworks */, + E4005627148D79B500EB22B9 /* Resources */, + E4005628148D79B500EB22B9 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + E4005631148D79B500EB22B9 /* PBXTargetDependency */, + ); + name = HockeySDKTests; + productName = HockeySDKTests; + productReference = E400562A148D79B500EB22B9 /* HockeySDKTests.octest */; + productType = "com.apple.product-type.bundle"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + E4005611148D79B500EB22B9 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = E4005614148D79B500EB22B9 /* Build configuration list for PBXProject "HockeySDK" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = E400560F148D79B500EB22B9; + productRefGroup = E400561B148D79B500EB22B9 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + E4005619148D79B500EB22B9 /* HockeySDK */, + E4005629148D79B500EB22B9 /* HockeySDKTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + E4005627148D79B500EB22B9 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E4005638148D79B500EB22B9 /* InfoPlist.strings in Resources */, + E400564B148D7A3000EB22B9 /* Hockey.bundle in Resources */, + E400564C148D7A3000EB22B9 /* Quincy.bundle in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + E4005628148D79B500EB22B9 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + E4005616148D79B500EB22B9 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E41EB472148D7BF50015DEDC /* BWApp.m in Sources */, + E41EB474148D7BF50015DEDC /* BWGlobal.m in Sources */, + E41EB476148D7BF50015DEDC /* BWHockeyManager.m in Sources */, + E41EB478148D7BF50015DEDC /* BWHockeySettingsViewController.m in Sources */, + E41EB47A148D7BF50015DEDC /* BWHockeyViewController.m in Sources */, + E41EB47C148D7BF50015DEDC /* BWQuincyManager.m in Sources */, + E41EB47E148D7BF50015DEDC /* CNSHockeyManager.m in Sources */, + E41EB480148D7BF50015DEDC /* NSString+HockeyAdditions.m in Sources */, + E41EB482148D7BF50015DEDC /* PSAppStoreHeader.m in Sources */, + E41EB484148D7BF50015DEDC /* PSStoreButton.m in Sources */, + E41EB486148D7BF50015DEDC /* PSWebTableViewCell.m in Sources */, + E41EB488148D7BF50015DEDC /* UIImage+HockeyAdditions.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E4005625148D79B500EB22B9 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E400563B148D79B500EB22B9 /* HockeySDKTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + E4005631148D79B500EB22B9 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = E4005619148D79B500EB22B9 /* HockeySDK */; + targetProxy = E4005630148D79B500EB22B9 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + E4005636148D79B500EB22B9 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + E4005637148D79B500EB22B9 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + E400563C148D79B500EB22B9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; + SDKROOT = iphoneos; + }; + name = Debug; + }; + E400563D148D79B500EB22B9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + COPY_PHASE_STRIP = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + E400563F148D79B500EB22B9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + DSTROOT = /tmp/HockeySDK.dst; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../Vendor\"", + ); + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + E4005640148D79B500EB22B9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + DSTROOT = /tmp/HockeySDK.dst; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../Vendor\"", + ); + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; + E4005642148D79B500EB22B9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(DEVELOPER_LIBRARY_DIR)/Frameworks", + "\"$(SRCROOT)/../Vendor\"", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "HockeySDK/HockeySDK-Prefix.pch"; + INFOPLIST_FILE = "HockeySDKTests/HockeySDKTests-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = octest; + }; + name = Debug; + }; + E4005643148D79B500EB22B9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(DEVELOPER_LIBRARY_DIR)/Frameworks", + "\"$(SRCROOT)/../Vendor\"", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "HockeySDK/HockeySDK-Prefix.pch"; + INFOPLIST_FILE = "HockeySDKTests/HockeySDKTests-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = octest; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + E4005614148D79B500EB22B9 /* Build configuration list for PBXProject "HockeySDK" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E400563C148D79B500EB22B9 /* Debug */, + E400563D148D79B500EB22B9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E400563E148D79B500EB22B9 /* Build configuration list for PBXNativeTarget "HockeySDK" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E400563F148D79B500EB22B9 /* Debug */, + E4005640148D79B500EB22B9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E4005641148D79B500EB22B9 /* Build configuration list for PBXNativeTarget "HockeySDKTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E4005642148D79B500EB22B9 /* Debug */, + E4005643148D79B500EB22B9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = E4005611148D79B500EB22B9 /* Project object */; +} diff --git a/Support/HockeySDKTests/HockeySDKTests-Info.plist b/Support/HockeySDKTests/HockeySDKTests-Info.plist new file mode 100644 index 0000000000..62059186ab --- /dev/null +++ b/Support/HockeySDKTests/HockeySDKTests-Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + de.codenauts.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/Support/HockeySDKTests/HockeySDKTests.h b/Support/HockeySDKTests/HockeySDKTests.h new file mode 100644 index 0000000000..c39a2a3f64 --- /dev/null +++ b/Support/HockeySDKTests/HockeySDKTests.h @@ -0,0 +1,13 @@ +// +// HockeySDKTests.h +// HockeySDKTests +// +// Created by Stephan Diederich on 05.12.11. +// Copyright (c) 2011 __MyCompanyName__. All rights reserved. +// + +#import + +@interface HockeySDKTests : SenTestCase + +@end diff --git a/Support/HockeySDKTests/HockeySDKTests.m b/Support/HockeySDKTests/HockeySDKTests.m new file mode 100644 index 0000000000..ba0efe8d33 --- /dev/null +++ b/Support/HockeySDKTests/HockeySDKTests.m @@ -0,0 +1,32 @@ +// +// HockeySDKTests.m +// HockeySDKTests +// +// Created by Stephan Diederich on 05.12.11. +// Copyright (c) 2011 __MyCompanyName__. All rights reserved. +// + +#import "HockeySDKTests.h" + +@implementation HockeySDKTests + +- (void)setUp +{ + [super setUp]; + + // Set-up code here. +} + +- (void)tearDown +{ + // Tear-down code here. + + [super tearDown]; +} + +- (void)testExample +{ + STFail(@"Unit tests are not implemented yet in HockeySDKTests"); +} + +@end diff --git a/Support/HockeySDKTests/en.lproj/InfoPlist.strings b/Support/HockeySDKTests/en.lproj/InfoPlist.strings new file mode 100644 index 0000000000..477b28ff8f --- /dev/null +++ b/Support/HockeySDKTests/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + From 2d0ec40be1cda4c088b9713b7cda70e4b888a2a4 Mon Sep 17 00:00:00 2001 From: Stephan Diederich Date: Mon, 5 Dec 2011 23:31:45 +0100 Subject: [PATCH 03/17] add xcworkspacedata and remove it from .gitignore --- .gitignore | 1 - .../project.xcworkspace/contents.xcworkspacedata | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 Support/HockeySDK.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/.gitignore b/.gitignore index 06d0c52ff5..52afc0ee32 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ build/* *.perspective *.perspectivev3 !default.perspectivev3 -*.xcworkspace !default.xcworkspace xcuserdata profile diff --git a/Support/HockeySDK.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Support/HockeySDK.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000..7aed921abb --- /dev/null +++ b/Support/HockeySDK.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + From 5f18fc26c56a25acb759d097dbc3874a4b004eca Mon Sep 17 00:00:00 2001 From: Stephan Diederich Date: Tue, 6 Dec 2011 00:05:54 +0100 Subject: [PATCH 04/17] as a library, build for armv6 & armv7 --- Support/HockeySDK.xcodeproj/project.pbxproj | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Support/HockeySDK.xcodeproj/project.pbxproj b/Support/HockeySDK.xcodeproj/project.pbxproj index 512f50c811..d258775bf5 100644 --- a/Support/HockeySDK.xcodeproj/project.pbxproj +++ b/Support/HockeySDK.xcodeproj/project.pbxproj @@ -400,7 +400,10 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + ARCHS = ( + armv7, + armv6, + ); COPY_PHASE_STRIP = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; @@ -423,7 +426,10 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + ARCHS = ( + armv7, + armv6, + ); COPY_PHASE_STRIP = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; From 7395b5ffb180eb61a923a059b6a19f423240b71a Mon Sep 17 00:00:00 2001 From: Stephan Diederich Date: Tue, 6 Dec 2011 00:06:10 +0100 Subject: [PATCH 05/17] set HOCKEYLIB_STATIC_LIBRARY define --- Support/HockeySDK.xcodeproj/project.pbxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Support/HockeySDK.xcodeproj/project.pbxproj b/Support/HockeySDK.xcodeproj/project.pbxproj index d258775bf5..94f27928f0 100644 --- a/Support/HockeySDK.xcodeproj/project.pbxproj +++ b/Support/HockeySDK.xcodeproj/project.pbxproj @@ -409,6 +409,7 @@ GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( + HOCKEYLIB_STATIC_LIBRARY, "DEBUG=1", "$(inherited)", ); @@ -432,6 +433,7 @@ ); COPY_PHASE_STRIP = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PREPROCESSOR_DEFINITIONS = HOCKEYLIB_STATIC_LIBRARY; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; From 6c0f91937a452646f16fe2ea4fd74ee51127e180 Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Wed, 7 Dec 2011 15:46:43 +0100 Subject: [PATCH 06/17] Added optional logging for debugging help Activate using [[BWQuincyManager sharedQuincyManager] setLoggingEnabled:YES]; --- Classes/BWQuincyManager.h | 7 +++ Classes/BWQuincyManager.m | 89 ++++++++++++++++++++++++--------------- 2 files changed, 62 insertions(+), 34 deletions(-) diff --git a/Classes/BWQuincyManager.h b/Classes/BWQuincyManager.h index 9b18128cba..8e946a22ac 100644 --- a/Classes/BWQuincyManager.h +++ b/Classes/BWQuincyManager.h @@ -29,6 +29,8 @@ #import +#define BWQuincyLog(fmt, ...) do { if([BWQuincyManager sharedQuincyManager].isLoggingEnabled) { NSLog((@"[QuincyLib] %s/%d " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); }} while(0) + #define kQuincyBundleName @"Quincy.bundle" NSBundle *quincyBundle(void); @@ -144,6 +146,7 @@ typedef enum CrashReportStatus { id _delegate; + BOOL _loggingEnabled; BOOL _showAlwaysButton; BOOL _feedbackActivated; BOOL _autoSubmitCrashReport; @@ -189,6 +192,10 @@ typedef enum CrashReportStatus { /////////////////////////////////////////////////////////////////////////////////////////////////// // settings +// if YES, states will be logged using NSLog. Only enable this for debugging! +// if NO, nothing will be logged. (default) +@property (nonatomic, assign, getter=isLoggingEnabled) BOOL loggingEnabled; + // nil, using the default localization files (Default) // set to another string which will be appended to the Quincy localization file name, "Alternate" is another provided text set @property (nonatomic, retain) NSString *languageStyle; diff --git a/Classes/BWQuincyManager.m b/Classes/BWQuincyManager.m index 094ebaf06e..f99577dd7e 100644 --- a/Classes/BWQuincyManager.m +++ b/Classes/BWQuincyManager.m @@ -87,6 +87,7 @@ NSString *BWQuincyLocalize(NSString *stringToken) { @synthesize autoSubmitDeviceUDID = _autoSubmitDeviceUDID; @synthesize languageStyle = _languageStyle; @synthesize didCrashInLastSession = _didCrashInLastSession; +@synthesize loggingEnabled = _loggingEnabled; @synthesize appIdentifier = _appIdentifier; @@ -127,6 +128,7 @@ NSString *BWQuincyLocalize(NSString *stringToken) { _sendingInProgress = NO; _languageStyle = nil; _didCrashInLastSession = NO; + _loggingEnabled = NO; self.delegate = nil; self.feedbackActivated = NO; @@ -175,13 +177,13 @@ NSString *BWQuincyLocalize(NSString *stringToken) { // Enable the Crash Reporter if (![crashReporter enableCrashReporterAndReturnError: &error]) - NSLog(@"Warning: Could not enable crash reporter: %@", error); + NSLog(@"WARNING: Could not enable crash reporter: %@", error); [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(startManager) name:BWQuincyNetworkBecomeReachable object:nil]; } if (!quincyBundle()) { - NSLog(@"WARNING: Quincy.bundle is missing in the app bundle!"); + NSLog(@"WARNING: Quincy.bundle is missing, will send reports automatically!"); } } return self; @@ -256,7 +258,7 @@ NSString *BWQuincyLocalize(NSString *stringToken) { if (!_sendingInProgress && [self hasPendingCrashReport]) { _sendingInProgress = YES; if (!quincyBundle()) { - NSLog(@"Quincy.bundle is missing, sending report automatically!"); + NSLog(@"WARNING: Quincy.bundle is missing, sending reports automatically!"); [self _sendCrashReports]; } else if (!self.autoSubmitCrashReport && [self hasNonApprovedCrashReports]) { @@ -300,29 +302,30 @@ NSString *BWQuincyLocalize(NSString *stringToken) { } - (BOOL)hasPendingCrashReport { - if (_crashReportActivated) { - NSFileManager *fm = [NSFileManager defaultManager]; + if (_crashReportActivated) { + NSFileManager *fm = [NSFileManager defaultManager]; - if ([_crashFiles count] == 0 && [fm fileExistsAtPath:_crashesDir]) { - NSString *file = nil; + if ([_crashFiles count] == 0 && [fm fileExistsAtPath:_crashesDir]) { + NSString *file = nil; NSError *error = NULL; - NSDirectoryEnumerator *dirEnum = [fm enumeratorAtPath: _crashesDir]; + NSDirectoryEnumerator *dirEnum = [fm enumeratorAtPath: _crashesDir]; - while ((file = [dirEnum nextObject])) { - NSDictionary *fileAttributes = [fm attributesOfItemAtPath:[_crashesDir stringByAppendingPathComponent:file] error:&error]; - if ([[fileAttributes objectForKey:NSFileSize] intValue] > 0) { - [_crashFiles addObject:file]; - } - } - } - - if ([_crashFiles count] > 0) { - return YES; - } else - return NO; - } else - return NO; + while ((file = [dirEnum nextObject])) { + NSDictionary *fileAttributes = [fm attributesOfItemAtPath:[_crashesDir stringByAppendingPathComponent:file] error:&error]; + if ([[fileAttributes objectForKey:NSFileSize] intValue] > 0) { + [_crashFiles addObject:file]; + } + } + } + + if ([_crashFiles count] > 0) { + BWQuincyLog(@"Pending crash reports found."); + return YES; + } else + return NO; + } else + return NO; } @@ -531,6 +534,7 @@ NSString *BWQuincyLocalize(NSString *stringToken) { [[NSUserDefaults standardUserDefaults] synchronize]; if (crashes != nil) { + BWQuincyLog(@"Sending crash reports:\n%@", crashes); [self _postXML:[NSString stringWithFormat:@"%@", crashes] toURL:[NSURL URLWithString:self.submissionURL]]; @@ -583,6 +587,8 @@ NSString *BWQuincyLocalize(NSString *stringToken) { } _urlConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; + + BWQuincyLog(@"Requesting feedback status."); } - (void)_postXML:(NSString*)xml toURL:(NSURL*)url { @@ -633,7 +639,10 @@ NSString *BWQuincyLocalize(NSString *stringToken) { _urlConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; if (!_urlConnection) { + BWQuincyLog(@"Sending crash reports could not start!"); _sendingInProgress = NO; + } else { + BWQuincyLog(@"Sending crash reports started."); } } @@ -650,19 +659,21 @@ NSString *BWQuincyLocalize(NSString *stringToken) { } - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { - [_responseData release]; - _responseData = nil; + [_responseData release]; + _responseData = nil; _urlConnection = nil; - if (self.delegate != nil && [self.delegate respondsToSelector:@selector(connectionClosed)]) { - [self.delegate connectionClosed]; - } + if (self.delegate != nil && [self.delegate respondsToSelector:@selector(connectionClosed)]) { + [self.delegate connectionClosed]; + } + + BWQuincyLog(@"ERROR: %@", [error localizedDescription]); _sendingInProgress = NO; } - (void)connectionDidFinishLoading:(NSURLConnection *)connection { - if (_statusCode >= 200 && _statusCode < 400) { + if (_statusCode >= 200 && _statusCode < 400 && _responseData != nil && [_responseData length] > 0) { [self _cleanCrashReports]; _feedbackRequestID = nil; @@ -672,6 +683,8 @@ NSString *BWQuincyLocalize(NSString *stringToken) { mutabilityOption:NSPropertyListMutableContainersAndLeaves format:nil errorDescription:NULL]; + BWQuincyLog(@"Received API response: %@", response); + _serverResult = (CrashReportStatus)[[response objectForKey:@"status"] intValue]; if ([response objectForKey:@"id"]) { _feedbackRequestID = [[NSString alloc] initWithString:[response objectForKey:@"id"]]; @@ -680,6 +693,8 @@ NSString *BWQuincyLocalize(NSString *stringToken) { _feedbackDelayInterval *= 0.01; } } else { + BWQuincyLog(@"Received API response: %@", [[[NSString alloc] initWithBytes:[_responseData bytes] length:[_responseData length] encoding: NSUTF8StringEncoding] autorelease]); + NSXMLParser *parser = [[NSXMLParser alloc] initWithData:_responseData]; // Set self as the delegate of the parser so that it will receive the parser delegate methods callbacks. [parser setDelegate:self]; @@ -705,15 +720,21 @@ NSString *BWQuincyLocalize(NSString *stringToken) { [self showCrashStatusMessage]; } } - } + } else { + if (_responseData == nil || [_responseData length] == 0) { + BWQuincyLog(@"ERROR: Sending failed with an empty response!"); + } else { + BWQuincyLog(@"ERROR: Sending failed with status code: %i", _statusCode); + } + } - [_responseData release]; - _responseData = nil; + [_responseData release]; + _responseData = nil; _urlConnection = nil; - if (self.delegate != nil && [self.delegate respondsToSelector:@selector(connectionClosed)]) { - [self.delegate connectionClosed]; - } + if (self.delegate != nil && [self.delegate respondsToSelector:@selector(connectionClosed)]) { + [self.delegate connectionClosed]; + } _sendingInProgress = NO; } From 58f68d48178b1b46a8f5c97fc6fa9b93dd65eb68 Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Wed, 7 Dec 2011 15:47:02 +0100 Subject: [PATCH 07/17] Don't treat empty server responses as success --- Classes/BWQuincyManager.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/BWQuincyManager.m b/Classes/BWQuincyManager.m index f99577dd7e..c9ec61eb87 100644 --- a/Classes/BWQuincyManager.m +++ b/Classes/BWQuincyManager.m @@ -673,7 +673,7 @@ NSString *BWQuincyLocalize(NSString *stringToken) { } - (void)connectionDidFinishLoading:(NSURLConnection *)connection { - if (_statusCode >= 200 && _statusCode < 400 && _responseData != nil && [_responseData length] > 0) { + if (_statusCode >= 200 && _statusCode < 400 && _responseData != nil && [_responseData length] > 0) { [self _cleanCrashReports]; _feedbackRequestID = nil; From e975ce9e859d14f5bd0a76e0415b26d88702d95b Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Wed, 7 Dec 2011 15:48:24 +0100 Subject: [PATCH 08/17] Fix for an older commit in QuincyKit being only half complete Even if the user did select to auto send, the dialog appeared again, because the new check if this was the case and if auto send is currently allowed wasn't actually used --- Classes/BWQuincyManager.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/BWQuincyManager.m b/Classes/BWQuincyManager.m index c9ec61eb87..7753489b10 100644 --- a/Classes/BWQuincyManager.m +++ b/Classes/BWQuincyManager.m @@ -260,7 +260,7 @@ NSString *BWQuincyLocalize(NSString *stringToken) { if (!quincyBundle()) { NSLog(@"WARNING: Quincy.bundle is missing, sending reports automatically!"); [self _sendCrashReports]; - } else if (!self.autoSubmitCrashReport && [self hasNonApprovedCrashReports]) { + } else if (![self autoSendCrashReports] && [self hasNonApprovedCrashReports]) { if (self.delegate != nil && [self.delegate respondsToSelector:@selector(willShowSubmitCrashReportAlert)]) { [self.delegate willShowSubmitCrashReportAlert]; From 20dc818137fe318b836a657c166b77b4ba3780c2 Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Wed, 7 Dec 2011 15:49:30 +0100 Subject: [PATCH 09/17] Add new delegate which fires when the user selected "Send Always" in the alert --- Classes/BWQuincyManager.h | 3 +++ Classes/BWQuincyManager.m | 39 ++++++++++++++++++++++++--------------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/Classes/BWQuincyManager.h b/Classes/BWQuincyManager.h index 8e946a22ac..23d9fa0230 100644 --- a/Classes/BWQuincyManager.h +++ b/Classes/BWQuincyManager.h @@ -139,6 +139,9 @@ typedef enum CrashReportStatus { // Invoked before the user is asked to send a crash report, so you can do additional actions. E.g. to make sure not to ask the user for an app rating :) -(void) willShowSubmitCrashReportAlert; +// Invoked after the user did choose to send crashes always in the alert +-(void) userDidChooseSendAlways; + @end @interface BWQuincyManager : NSObject { diff --git a/Classes/BWQuincyManager.m b/Classes/BWQuincyManager.m index 7753489b10..4f05211fed 100644 --- a/Classes/BWQuincyManager.m +++ b/Classes/BWQuincyManager.m @@ -377,22 +377,31 @@ NSString *BWQuincyLocalize(NSString *stringToken) { #pragma mark UIAlertView Delegate - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { - if ([alertView tag] == QuincyKitAlertTypeSend) { - switch (buttonIndex) { - case 0: + if ([alertView tag] == QuincyKitAlertTypeSend) { + switch (buttonIndex) { + case 0: _sendingInProgress = NO; - [self _cleanCrashReports]; - break; - case 1: - [self _sendCrashReports]; - break; - case 2: - [[NSUserDefaults standardUserDefaults] setBool:YES forKey:kAutomaticallySendCrashReports]; - - [self _sendCrashReports]; - break; - } - } + [self _cleanCrashReports]; + break; + case 1: + [self _sendCrashReports]; + break; + case 2: { + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:kAutomaticallySendCrashReports]; + [[NSUserDefaults standardUserDefaults] synchronize]; + if (self.delegate != nil && [self.delegate respondsToSelector:@selector(userDidChooseSendAlways)]) { + [self.delegate userDidChooseSendAlways]; + } + + [self _sendCrashReports]; + break; + } + default: + _sendingInProgress = NO; + [self _cleanCrashReports]; + break; + } + } } #pragma mark - From f20b89168d11a4030abadf29f627b020155af953 Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Wed, 7 Dec 2011 15:51:48 +0100 Subject: [PATCH 10/17] One more 2 space indentation fixes --- Classes/BWQuincyManager.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/BWQuincyManager.m b/Classes/BWQuincyManager.m index 4f05211fed..40c4f59636 100644 --- a/Classes/BWQuincyManager.m +++ b/Classes/BWQuincyManager.m @@ -392,7 +392,7 @@ NSString *BWQuincyLocalize(NSString *stringToken) { if (self.delegate != nil && [self.delegate respondsToSelector:@selector(userDidChooseSendAlways)]) { [self.delegate userDidChooseSendAlways]; } - + [self _sendCrashReports]; break; } From b3e7239ed1f42473d5e9c603b09162f3a6a4e4cc Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Wed, 7 Dec 2011 16:03:40 +0100 Subject: [PATCH 11/17] Updated manager for quincy logging and new delegate --- Classes/CNSHockeyManager.h | 3 +++ Classes/CNSHockeyManager.m | 2 ++ 2 files changed, 5 insertions(+) diff --git a/Classes/CNSHockeyManager.h b/Classes/CNSHockeyManager.h index 0f476af4e9..e3a26c8050 100644 --- a/Classes/CNSHockeyManager.h +++ b/Classes/CNSHockeyManager.h @@ -80,6 +80,9 @@ // user for an app rating :) - (void)willShowSubmitCrashReportAlert; +// Invoked after the user did choose to send crashes always in the alert +-(void) userDidChooseSendAlways; + @end @interface CNSHockeyManager : NSObject { diff --git a/Classes/CNSHockeyManager.m b/Classes/CNSHockeyManager.m index 693f1aeff4..2dae47bc84 100644 --- a/Classes/CNSHockeyManager.m +++ b/Classes/CNSHockeyManager.m @@ -145,10 +145,12 @@ - (BOOL)isLoggingEnabled { return [[BWHockeyManager sharedHockeyManager] isLoggingEnabled]; + return [[BWQuincyManager sharedQuincyManager] isLoggingEnabled]; } - (void)setLoggingEnabled:(BOOL)loggingEnabled { return [[BWHockeyManager sharedHockeyManager] setLoggingEnabled:loggingEnabled]; + return [[BWQuincyManager sharedQuincyManager] setLoggingEnabled:loggingEnabled]; } #pragma mark - Public Instance Methods (Crash Reporting) From a61bba1d1fc468b77d642810c0629a2e45401383 Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Wed, 7 Dec 2011 20:18:14 +0100 Subject: [PATCH 12/17] Add workaround for not requiring -all_load linker flag and some Xcode project adjustments --- Classes/CNSFixCategoryBug.h | 25 +++++++++++++++++++++ Classes/NSString+HockeyAdditions.m | 4 ++++ Classes/UIImage+HockeyAdditions.m | 5 +++++ Support/HockeySDK.xcodeproj/project.pbxproj | 18 ++++++++++----- 4 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 Classes/CNSFixCategoryBug.h diff --git a/Classes/CNSFixCategoryBug.h b/Classes/CNSFixCategoryBug.h new file mode 100644 index 0000000000..b680612c44 --- /dev/null +++ b/Classes/CNSFixCategoryBug.h @@ -0,0 +1,25 @@ +// +// CNSFixCategoryBug.h +// HockeySDK +// +// Created by Andreas Linde on 12/7/11. +// Copyright (c) 2011 Andreas Linde. All rights reserved. +// + +#ifndef HockeySDK_CNSFixCategoryBug_h +#define HockeySDK_CNSFixCategoryBug_h + +/** + Add this macro before each category implementation, so we don't have to use + -all_load or -force_load to load object files from static libraries that only contain + categories and no classes. + See http://developer.apple.com/library/mac/#qa/qa2006/qa1490.html for more info. + + Shamelessly borrowed from Three20 + */ + +#define CNS_FIX_CATEGORY_BUG(name) @interface CNS_FIX_CATEGORY_BUG##name @end \ +@implementation CNS_FIX_CATEGORY_BUG##name @end + + +#endif diff --git a/Classes/NSString+HockeyAdditions.m b/Classes/NSString+HockeyAdditions.m index 6bd0600d09..a6483d4a07 100755 --- a/Classes/NSString+HockeyAdditions.m +++ b/Classes/NSString+HockeyAdditions.m @@ -25,6 +25,10 @@ #import "NSString+HockeyAdditions.h" +#ifdef HOCKEYLIB_STATIC_LIBRARY +#import "CNSFixCategoryBug.h" +CNS_FIX_CATEGORY_BUG(NSString_HockeyAdditions) +#endif @implementation NSString (HockeyAdditions) diff --git a/Classes/UIImage+HockeyAdditions.m b/Classes/UIImage+HockeyAdditions.m index ee531fece4..d0cdf2b26c 100644 --- a/Classes/UIImage+HockeyAdditions.m +++ b/Classes/UIImage+HockeyAdditions.m @@ -26,6 +26,11 @@ #import "UIImage+HockeyAdditions.h" #import "BWGlobal.h" +#ifdef HOCKEYLIB_STATIC_LIBRARY +#import "CNSFixCategoryBug.h" +CNS_FIX_CATEGORY_BUG(UIImage_HockeyAdditionsPrivate) +#endif + // Private helper methods @interface UIImage (HockeyAdditionsPrivate) - (void)addRoundedRectToPath:(CGRect)rect context:(CGContextRef)context ovalWidth:(CGFloat)ovalWidth ovalHeight:(CGFloat)ovalHeight; diff --git a/Support/HockeySDK.xcodeproj/project.pbxproj b/Support/HockeySDK.xcodeproj/project.pbxproj index 94f27928f0..477265146f 100644 --- a/Support/HockeySDK.xcodeproj/project.pbxproj +++ b/Support/HockeySDK.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 1E322DAD148FCE2100077977 /* CNSFixCategoryBug.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E322DAC148FCE2100077977 /* CNSFixCategoryBug.h */; }; E400561E148D79B500EB22B9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E400561D148D79B500EB22B9 /* Foundation.framework */; }; E400562C148D79B500EB22B9 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E400562B148D79B500EB22B9 /* SenTestingKit.framework */; }; E400562E148D79B500EB22B9 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E400562D148D79B500EB22B9 /* UIKit.framework */; }; @@ -55,6 +56,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 1E322DAC148FCE2100077977 /* CNSFixCategoryBug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNSFixCategoryBug.h; sourceTree = ""; }; E400561A148D79B500EB22B9 /* libHockeySDK.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libHockeySDK.a; sourceTree = BUILT_PRODUCTS_DIR; }; E400561D148D79B500EB22B9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; E400562A148D79B500EB22B9 /* HockeySDKTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HockeySDKTests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -226,6 +228,7 @@ E41EB46E148D7BF50015DEDC /* PSWebTableViewCell.m */, E41EB46F148D7BF50015DEDC /* UIImage+HockeyAdditions.h */, E41EB470148D7BF50015DEDC /* UIImage+HockeyAdditions.m */, + 1E322DAC148FCE2100077977 /* CNSFixCategoryBug.h */, ); name = Helper; sourceTree = ""; @@ -249,6 +252,7 @@ E41EB483148D7BF50015DEDC /* PSStoreButton.h in Headers */, E41EB485148D7BF50015DEDC /* PSWebTableViewCell.h in Headers */, E41EB487148D7BF50015DEDC /* UIImage+HockeyAdditions.h in Headers */, + 1E322DAD148FCE2100077977 /* CNSFixCategoryBug.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -414,11 +418,12 @@ "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_VERSION = ""; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 5.0; + IPHONEOS_DEPLOYMENT_TARGET = 3.0; + OTHER_CFLAGS = ""; SDKROOT = iphoneos; }; name = Debug; @@ -434,11 +439,12 @@ COPY_PHASE_STRIP = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_PREPROCESSOR_DEFINITIONS = HOCKEYLIB_STATIC_LIBRARY; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_VERSION = ""; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 5.0; + IPHONEOS_DEPLOYMENT_TARGET = 3.0; + OTHER_CFLAGS = ""; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; @@ -452,7 +458,7 @@ "$(inherited)", "\"$(SRCROOT)/../Vendor\"", ); - OTHER_LDFLAGS = "-ObjC"; + OTHER_LDFLAGS = ""; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; }; @@ -466,7 +472,7 @@ "$(inherited)", "\"$(SRCROOT)/../Vendor\"", ); - OTHER_LDFLAGS = "-ObjC"; + OTHER_LDFLAGS = ""; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; }; From e7da6943e28ae92d0b6a6614b9916430c15b9ca2 Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Thu, 8 Dec 2011 13:47:21 +0100 Subject: [PATCH 13/17] Add appstore detection property --- Classes/CNSHockeyManager.h | 4 ++++ Classes/CNSHockeyManager.m | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Classes/CNSHockeyManager.h b/Classes/CNSHockeyManager.h index e3a26c8050..ffb73d4b08 100644 --- a/Classes/CNSHockeyManager.h +++ b/Classes/CNSHockeyManager.h @@ -204,6 +204,10 @@ // Default: HockeyComparisonResultGreater @property (nonatomic, assign) HockeyComparisonResult compareVersionType; +// if YES the app is installed from the app store +// if NO the app is installed via ad-hoc or enterprise distribution +@property (nonatomic, readonly) BOOL isAppStoreEnvironment; + #pragma mark - Public Methods // Returns the shared manager object diff --git a/Classes/CNSHockeyManager.m b/Classes/CNSHockeyManager.m index 2dae47bc84..fb6fc962d1 100644 --- a/Classes/CNSHockeyManager.m +++ b/Classes/CNSHockeyManager.m @@ -297,6 +297,10 @@ [[BWHockeyManager sharedHockeyManager] setCompareVersionType:compareVersionType]; } +- (BOOL)isAppStoreEnvironment { + return [[BWHockeyManager sharedHockeyManager] isAppStoreEnvironment]; +} + - (BOOL)isUpdateAvailable { return [[BWHockeyManager sharedHockeyManager] isUpdateAvailable]; } From 344bbddb1c320633a29daa1c98cd16f4fb6817db Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Thu, 8 Dec 2011 14:53:39 +0100 Subject: [PATCH 14/17] Remove unit test files and target They are not used right now and require to delete them when including the sdk without the library but the files only --- Support/HockeySDK.xcodeproj/project.pbxproj | 174 ------------------ .../HockeySDKTests/HockeySDKTests-Info.plist | 22 --- Support/HockeySDKTests/HockeySDKTests.h | 13 -- Support/HockeySDKTests/HockeySDKTests.m | 32 ---- .../HockeySDKTests/en.lproj/InfoPlist.strings | 2 - 5 files changed, 243 deletions(-) delete mode 100644 Support/HockeySDKTests/HockeySDKTests-Info.plist delete mode 100644 Support/HockeySDKTests/HockeySDKTests.h delete mode 100644 Support/HockeySDKTests/HockeySDKTests.m delete mode 100644 Support/HockeySDKTests/en.lproj/InfoPlist.strings diff --git a/Support/HockeySDK.xcodeproj/project.pbxproj b/Support/HockeySDK.xcodeproj/project.pbxproj index 477265146f..a15e5bc1e1 100644 --- a/Support/HockeySDK.xcodeproj/project.pbxproj +++ b/Support/HockeySDK.xcodeproj/project.pbxproj @@ -9,14 +9,6 @@ /* Begin PBXBuildFile section */ 1E322DAD148FCE2100077977 /* CNSFixCategoryBug.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E322DAC148FCE2100077977 /* CNSFixCategoryBug.h */; }; E400561E148D79B500EB22B9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E400561D148D79B500EB22B9 /* Foundation.framework */; }; - E400562C148D79B500EB22B9 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E400562B148D79B500EB22B9 /* SenTestingKit.framework */; }; - E400562E148D79B500EB22B9 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E400562D148D79B500EB22B9 /* UIKit.framework */; }; - E400562F148D79B500EB22B9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E400561D148D79B500EB22B9 /* Foundation.framework */; }; - E4005632148D79B500EB22B9 /* libHockeySDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E400561A148D79B500EB22B9 /* libHockeySDK.a */; }; - E4005638148D79B500EB22B9 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = E4005636148D79B500EB22B9 /* InfoPlist.strings */; }; - E400563B148D79B500EB22B9 /* HockeySDKTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E400563A148D79B500EB22B9 /* HockeySDKTests.m */; }; - E400564B148D7A3000EB22B9 /* Hockey.bundle in Resources */ = {isa = PBXBuildFile; fileRef = E4005649148D7A3000EB22B9 /* Hockey.bundle */; }; - E400564C148D7A3000EB22B9 /* Quincy.bundle in Resources */ = {isa = PBXBuildFile; fileRef = E400564A148D7A3000EB22B9 /* Quincy.bundle */; }; E41EB471148D7BF50015DEDC /* BWApp.h in Headers */ = {isa = PBXBuildFile; fileRef = E41EB459148D7BF50015DEDC /* BWApp.h */; }; E41EB472148D7BF50015DEDC /* BWApp.m in Sources */ = {isa = PBXBuildFile; fileRef = E41EB45A148D7BF50015DEDC /* BWApp.m */; }; E41EB473148D7BF50015DEDC /* BWGlobal.h in Headers */ = {isa = PBXBuildFile; fileRef = E41EB45B148D7BF50015DEDC /* BWGlobal.h */; }; @@ -42,30 +34,14 @@ E41EB487148D7BF50015DEDC /* UIImage+HockeyAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = E41EB46F148D7BF50015DEDC /* UIImage+HockeyAdditions.h */; }; E41EB488148D7BF50015DEDC /* UIImage+HockeyAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = E41EB470148D7BF50015DEDC /* UIImage+HockeyAdditions.m */; }; E41EB48C148D7C4E0015DEDC /* CrashReporter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E41EB48B148D7C4E0015DEDC /* CrashReporter.framework */; }; - E41EB48D148D7C4E0015DEDC /* CrashReporter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E41EB48B148D7C4E0015DEDC /* CrashReporter.framework */; }; /* End PBXBuildFile section */ -/* Begin PBXContainerItemProxy section */ - E4005630148D79B500EB22B9 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = E4005611148D79B500EB22B9 /* Project object */; - proxyType = 1; - remoteGlobalIDString = E4005619148D79B500EB22B9; - remoteInfo = HockeySDK; - }; -/* End PBXContainerItemProxy section */ - /* Begin PBXFileReference section */ 1E322DAC148FCE2100077977 /* CNSFixCategoryBug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNSFixCategoryBug.h; sourceTree = ""; }; E400561A148D79B500EB22B9 /* libHockeySDK.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libHockeySDK.a; sourceTree = BUILT_PRODUCTS_DIR; }; E400561D148D79B500EB22B9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - E400562A148D79B500EB22B9 /* HockeySDKTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HockeySDKTests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; E400562B148D79B500EB22B9 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; }; E400562D148D79B500EB22B9 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; - E4005635148D79B500EB22B9 /* HockeySDKTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "HockeySDKTests-Info.plist"; sourceTree = ""; }; - E4005637148D79B500EB22B9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - E4005639148D79B500EB22B9 /* HockeySDKTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HockeySDKTests.h; sourceTree = ""; }; - E400563A148D79B500EB22B9 /* HockeySDKTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HockeySDKTests.m; sourceTree = ""; }; E4005649148D7A3000EB22B9 /* Hockey.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Hockey.bundle; sourceTree = ""; }; E400564A148D7A3000EB22B9 /* Quincy.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Quincy.bundle; sourceTree = ""; }; E41EB459148D7BF50015DEDC /* BWApp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BWApp.h; sourceTree = ""; }; @@ -107,18 +83,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - E4005626148D79B500EB22B9 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - E400562C148D79B500EB22B9 /* SenTestingKit.framework in Frameworks */, - E400562E148D79B500EB22B9 /* UIKit.framework in Frameworks */, - E400562F148D79B500EB22B9 /* Foundation.framework in Frameworks */, - E4005632148D79B500EB22B9 /* libHockeySDK.a in Frameworks */, - E41EB48D148D7C4E0015DEDC /* CrashReporter.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -126,7 +90,6 @@ isa = PBXGroup; children = ( E41EB489148D7BF90015DEDC /* HockeySDK */, - E4005633148D79B500EB22B9 /* HockeySDKTests */, E400561C148D79B500EB22B9 /* Frameworks */, E4005648148D7A3000EB22B9 /* Resources */, E400561B148D79B500EB22B9 /* Products */, @@ -139,7 +102,6 @@ isa = PBXGroup; children = ( E400561A148D79B500EB22B9 /* libHockeySDK.a */, - E400562A148D79B500EB22B9 /* HockeySDKTests.octest */, ); name = Products; sourceTree = ""; @@ -155,25 +117,6 @@ name = Frameworks; sourceTree = ""; }; - E4005633148D79B500EB22B9 /* HockeySDKTests */ = { - isa = PBXGroup; - children = ( - E4005639148D79B500EB22B9 /* HockeySDKTests.h */, - E400563A148D79B500EB22B9 /* HockeySDKTests.m */, - E4005634148D79B500EB22B9 /* Supporting Files */, - ); - path = HockeySDKTests; - sourceTree = ""; - }; - E4005634148D79B500EB22B9 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - E4005635148D79B500EB22B9 /* HockeySDKTests-Info.plist */, - E4005636148D79B500EB22B9 /* InfoPlist.strings */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; E4005648148D7A3000EB22B9 /* Resources */ = { isa = PBXGroup; children = ( @@ -276,25 +219,6 @@ productReference = E400561A148D79B500EB22B9 /* libHockeySDK.a */; productType = "com.apple.product-type.library.static"; }; - E4005629148D79B500EB22B9 /* HockeySDKTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = E4005641148D79B500EB22B9 /* Build configuration list for PBXNativeTarget "HockeySDKTests" */; - buildPhases = ( - E4005625148D79B500EB22B9 /* Sources */, - E4005626148D79B500EB22B9 /* Frameworks */, - E4005627148D79B500EB22B9 /* Resources */, - E4005628148D79B500EB22B9 /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - E4005631148D79B500EB22B9 /* PBXTargetDependency */, - ); - name = HockeySDKTests; - productName = HockeySDKTests; - productReference = E400562A148D79B500EB22B9 /* HockeySDKTests.octest */; - productType = "com.apple.product-type.bundle"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -316,40 +240,10 @@ projectRoot = ""; targets = ( E4005619148D79B500EB22B9 /* HockeySDK */, - E4005629148D79B500EB22B9 /* HockeySDKTests */, ); }; /* End PBXProject section */ -/* Begin PBXResourcesBuildPhase section */ - E4005627148D79B500EB22B9 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - E4005638148D79B500EB22B9 /* InfoPlist.strings in Resources */, - E400564B148D7A3000EB22B9 /* Hockey.bundle in Resources */, - E400564C148D7A3000EB22B9 /* Quincy.bundle in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - E4005628148D79B500EB22B9 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; - }; -/* End PBXShellScriptBuildPhase section */ - /* Begin PBXSourcesBuildPhase section */ E4005616148D79B500EB22B9 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -370,35 +264,8 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - E4005625148D79B500EB22B9 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - E400563B148D79B500EB22B9 /* HockeySDKTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXSourcesBuildPhase section */ -/* Begin PBXTargetDependency section */ - E4005631148D79B500EB22B9 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = E4005619148D79B500EB22B9 /* HockeySDK */; - targetProxy = E4005630148D79B500EB22B9 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - E4005636148D79B500EB22B9 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - E4005637148D79B500EB22B9 /* en */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - /* Begin XCBuildConfiguration section */ E400563C148D79B500EB22B9 /* Debug */ = { isa = XCBuildConfiguration; @@ -478,38 +345,6 @@ }; name = Release; }; - E4005642148D79B500EB22B9 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(DEVELOPER_LIBRARY_DIR)/Frameworks", - "\"$(SRCROOT)/../Vendor\"", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "HockeySDK/HockeySDK-Prefix.pch"; - INFOPLIST_FILE = "HockeySDKTests/HockeySDKTests-Info.plist"; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = octest; - }; - name = Debug; - }; - E4005643148D79B500EB22B9 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(DEVELOPER_LIBRARY_DIR)/Frameworks", - "\"$(SRCROOT)/../Vendor\"", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "HockeySDK/HockeySDK-Prefix.pch"; - INFOPLIST_FILE = "HockeySDKTests/HockeySDKTests-Info.plist"; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = octest; - }; - name = Release; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -531,15 +366,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - E4005641148D79B500EB22B9 /* Build configuration list for PBXNativeTarget "HockeySDKTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - E4005642148D79B500EB22B9 /* Debug */, - E4005643148D79B500EB22B9 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; /* End XCConfigurationList section */ }; rootObject = E4005611148D79B500EB22B9 /* Project object */; diff --git a/Support/HockeySDKTests/HockeySDKTests-Info.plist b/Support/HockeySDKTests/HockeySDKTests-Info.plist deleted file mode 100644 index 62059186ab..0000000000 --- a/Support/HockeySDKTests/HockeySDKTests-Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - de.codenauts.${PRODUCT_NAME:rfc1034identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/Support/HockeySDKTests/HockeySDKTests.h b/Support/HockeySDKTests/HockeySDKTests.h deleted file mode 100644 index c39a2a3f64..0000000000 --- a/Support/HockeySDKTests/HockeySDKTests.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// HockeySDKTests.h -// HockeySDKTests -// -// Created by Stephan Diederich on 05.12.11. -// Copyright (c) 2011 __MyCompanyName__. All rights reserved. -// - -#import - -@interface HockeySDKTests : SenTestCase - -@end diff --git a/Support/HockeySDKTests/HockeySDKTests.m b/Support/HockeySDKTests/HockeySDKTests.m deleted file mode 100644 index ba0efe8d33..0000000000 --- a/Support/HockeySDKTests/HockeySDKTests.m +++ /dev/null @@ -1,32 +0,0 @@ -// -// HockeySDKTests.m -// HockeySDKTests -// -// Created by Stephan Diederich on 05.12.11. -// Copyright (c) 2011 __MyCompanyName__. All rights reserved. -// - -#import "HockeySDKTests.h" - -@implementation HockeySDKTests - -- (void)setUp -{ - [super setUp]; - - // Set-up code here. -} - -- (void)tearDown -{ - // Tear-down code here. - - [super tearDown]; -} - -- (void)testExample -{ - STFail(@"Unit tests are not implemented yet in HockeySDKTests"); -} - -@end diff --git a/Support/HockeySDKTests/en.lproj/InfoPlist.strings b/Support/HockeySDKTests/en.lproj/InfoPlist.strings deleted file mode 100644 index 477b28ff8f..0000000000 --- a/Support/HockeySDKTests/en.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - From bd38778253152224f1f0f40922cbdf09496c2473 Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Thu, 8 Dec 2011 18:13:52 +0100 Subject: [PATCH 15/17] Set the delegate for Hockey and Quincy --- Classes/CNSHockeyManager.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Classes/CNSHockeyManager.m b/Classes/CNSHockeyManager.m index fb6fc962d1..94c0007c59 100644 --- a/Classes/CNSHockeyManager.m +++ b/Classes/CNSHockeyManager.m @@ -350,12 +350,14 @@ - (void)configureQuincyManager { [[BWQuincyManager sharedQuincyManager] setAppIdentifier:appIdentifier]; + [[BWQuincyManager sharedQuincyManager] setDelegate:delegate]; } - (void)configureHockeyManager { [[BWHockeyManager sharedHockeyManager] setAppIdentifier:appIdentifier]; [[BWHockeyManager sharedHockeyManager] setCheckForTracker:YES]; - + [[BWHockeyManager sharedHockeyManager] setDelegate:delegate]; + // Only if JMC is part of the project if ([[self class] isJMCPresent]) { [[BWHockeyManager sharedHockeyManager] addObserver:self forKeyPath:@"trackerConfig" options:0 context:nil]; From d7b69df404ceba10da3039370efc5e4b2aa7b394 Mon Sep 17 00:00:00 2001 From: Symvaro GmbH Date: Sat, 10 Dec 2011 13:28:37 +0100 Subject: [PATCH 16/17] fix example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 71f19b96fa..51d855084b 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Drag & drop the HockeySDK folder from your project directory to your Xcode proje 1. Open your AppDelegate.m file. -2. Add the following line at the top of the file below your own #import statements:
#import "BWHockeyManager.h"
+2. Add the following line at the top of the file below your own #import statements:
#import "CNSHockeyManager.h"
3. Search for the method application:didFinishLaunchingWithOptions: From ac1ac0941183dda04588ffa9be40ed67e53c4bc3 Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Tue, 13 Dec 2011 18:27:58 +0100 Subject: [PATCH 17/17] Some more 2 space indentation fixes --- Classes/BWGlobal.m | 8 +- Classes/BWHockeySettingsViewController.m | 2 +- Classes/BWHockeyViewController.m | 30 +- Classes/BWQuincyManager.h | 34 +- Classes/BWQuincyManager.m | 391 ++++++++++++----------- Classes/CNSHockeyManager.m | 10 +- Classes/NSString+HockeyAdditions.m | 37 ++- Classes/PSStoreButton.m | 6 +- Classes/PSWebTableViewCell.m | 50 +-- Classes/UIImage+HockeyAdditions.m | 113 +++---- 10 files changed, 341 insertions(+), 340 deletions(-) diff --git a/Classes/BWGlobal.m b/Classes/BWGlobal.m index 7f9e8e45d5..d967d5a9b7 100644 --- a/Classes/BWGlobal.m +++ b/Classes/BWGlobal.m @@ -36,10 +36,10 @@ NSBundle *hockeyBundle(void) { } NSString *BWmd5(NSString *str) { - const char *cStr = [str UTF8String]; - unsigned char result[CC_MD5_DIGEST_LENGTH]; - CC_MD5( cStr, strlen(cStr), result ); - return [NSString + const char *cStr = [str UTF8String]; + unsigned char result[CC_MD5_DIGEST_LENGTH]; + CC_MD5( cStr, strlen(cStr), result ); + return [NSString stringWithFormat: @"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", result[0], result[1], result[2], result[3], diff --git a/Classes/BWHockeySettingsViewController.m b/Classes/BWHockeySettingsViewController.m index 34d94591e2..8ceddb3513 100644 --- a/Classes/BWHockeySettingsViewController.m +++ b/Classes/BWHockeySettingsViewController.m @@ -62,7 +62,7 @@ } - (id)init { - return [self init:[BWHockeyManager sharedHockeyManager]]; + return [self init:[BWHockeyManager sharedHockeyManager]]; } #pragma mark - diff --git a/Classes/BWHockeyViewController.m b/Classes/BWHockeyViewController.m index 2ac45cc329..92ad3dafd3 100644 --- a/Classes/BWHockeyViewController.m +++ b/Classes/BWHockeyViewController.m @@ -295,26 +295,26 @@ } - (CAGradientLayer *)backgroundLayer { - UIColor *colorOne = [UIColor colorWithWhite:0.9 alpha:1.0]; - UIColor *colorTwo = [UIColor colorWithHue:0.625 saturation:0.0 brightness:0.85 alpha:1.0]; - UIColor *colorThree = [UIColor colorWithHue:0.625 saturation:0.0 brightness:0.7 alpha:1.0]; - UIColor *colorFour = [UIColor colorWithHue:0.625 saturation:0.0 brightness:0.4 alpha:1.0]; + UIColor *colorOne = [UIColor colorWithWhite:0.9 alpha:1.0]; + UIColor *colorTwo = [UIColor colorWithHue:0.625 saturation:0.0 brightness:0.85 alpha:1.0]; + UIColor *colorThree = [UIColor colorWithHue:0.625 saturation:0.0 brightness:0.7 alpha:1.0]; + UIColor *colorFour = [UIColor colorWithHue:0.625 saturation:0.0 brightness:0.4 alpha:1.0]; - NSArray *colors = [NSArray arrayWithObjects:(id)colorOne.CGColor, colorTwo.CGColor, colorThree.CGColor, colorFour.CGColor, nil]; + NSArray *colors = [NSArray arrayWithObjects:(id)colorOne.CGColor, colorTwo.CGColor, colorThree.CGColor, colorFour.CGColor, nil]; - NSNumber *stopOne = [NSNumber numberWithFloat:0.0]; - NSNumber *stopTwo = [NSNumber numberWithFloat:0.02]; - NSNumber *stopThree = [NSNumber numberWithFloat:0.99]; - NSNumber *stopFour = [NSNumber numberWithFloat:1.0]; + NSNumber *stopOne = [NSNumber numberWithFloat:0.0]; + NSNumber *stopTwo = [NSNumber numberWithFloat:0.02]; + NSNumber *stopThree = [NSNumber numberWithFloat:0.99]; + NSNumber *stopFour = [NSNumber numberWithFloat:1.0]; - NSArray *locations = [NSArray arrayWithObjects:stopOne, stopTwo, stopThree, stopFour, nil]; + NSArray *locations = [NSArray arrayWithObjects:stopOne, stopTwo, stopThree, stopFour, nil]; - CAGradientLayer *headerLayer = [CAGradientLayer layer]; - //headerLayer.frame = CGRectMake(0.0, 0.0, 320.0, 77.0); - headerLayer.colors = colors; - headerLayer.locations = locations; + CAGradientLayer *headerLayer = [CAGradientLayer layer]; + //headerLayer.frame = CGRectMake(0.0, 0.0, 320.0, 77.0); + headerLayer.colors = colors; + headerLayer.locations = locations; - return headerLayer; + return headerLayer; } - (void)viewDidLoad { diff --git a/Classes/BWQuincyManager.h b/Classes/BWQuincyManager.h index 23d9fa0230..e4accd4068 100644 --- a/Classes/BWQuincyManager.h +++ b/Classes/BWQuincyManager.h @@ -54,31 +54,31 @@ NSString *BWQuincyLocalize(NSString *stringToken); #define BWQuincyNetworkBecomeReachable @"NetworkDidBecomeReachable" typedef enum QuincyKitAlertType { - QuincyKitAlertTypeSend = 0, - QuincyKitAlertTypeFeedback = 1, + QuincyKitAlertTypeSend = 0, + QuincyKitAlertTypeFeedback = 1, } CrashAlertType; typedef enum CrashReportStatus { // The status of the crash is queued, need to check later (HockeyApp) - CrashReportStatusQueued = -80, + CrashReportStatusQueued = -80, // This app version is set to discontinued, no new crash reports accepted by the server - CrashReportStatusFailureVersionDiscontinued = -30, + CrashReportStatusFailureVersionDiscontinued = -30, // XML: Sender version string contains not allowed characters, only alphanumberical including space and . are allowed - CrashReportStatusFailureXMLSenderVersionNotAllowed = -21, + CrashReportStatusFailureXMLSenderVersionNotAllowed = -21, // XML: Version string contains not allowed characters, only alphanumberical including space and . are allowed - CrashReportStatusFailureXMLVersionNotAllowed = -20, + CrashReportStatusFailureXMLVersionNotAllowed = -20, // SQL for adding a symoblicate todo entry in the database failed - CrashReportStatusFailureSQLAddSymbolicateTodo = -18, + CrashReportStatusFailureSQLAddSymbolicateTodo = -18, // SQL for adding crash log in the database failed - CrashReportStatusFailureSQLAddCrashlog = -17, + CrashReportStatusFailureSQLAddCrashlog = -17, // SQL for adding a new version in the database failed - CrashReportStatusFailureSQLAddVersion = -16, + CrashReportStatusFailureSQLAddVersion = -16, // SQL for checking if the version is already added in the database failed CrashReportStatusFailureSQLCheckVersionExists = -15, @@ -162,19 +162,19 @@ typedef enum CrashReportStatus { NSString *_feedbackRequestID; float _feedbackDelayInterval; - NSMutableString *_contentOfProperty; - CrashReportStatus _serverResult; + NSMutableString *_contentOfProperty; + CrashReportStatus _serverResult; - int _analyzerStarted; - NSString *_crashesDir; + int _analyzerStarted; + NSString *_crashesDir; - BOOL _crashIdenticalCurrentVersion; + BOOL _crashIdenticalCurrentVersion; BOOL _crashReportActivated; - NSMutableArray *_crashFiles; + NSMutableArray *_crashFiles; - NSMutableData *_responseData; - NSInteger _statusCode; + NSMutableData *_responseData; + NSInteger _statusCode; NSURLConnection *_urlConnection; diff --git a/Classes/BWQuincyManager.m b/Classes/BWQuincyManager.m index 40c4f59636..fada70820d 100644 --- a/Classes/BWQuincyManager.m +++ b/Classes/BWQuincyManager.m @@ -92,8 +92,7 @@ NSString *BWQuincyLocalize(NSString *stringToken) { @synthesize appIdentifier = _appIdentifier; #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 40000 -+(BWQuincyManager *)sharedQuincyManager -{ ++(BWQuincyManager *)sharedQuincyManager { static BWQuincyManager *sharedInstance = nil; static dispatch_once_t pred; @@ -106,23 +105,23 @@ NSString *BWQuincyLocalize(NSString *stringToken) { } #else + (BWQuincyManager *)sharedQuincyManager { - static BWQuincyManager *quincyManager = nil; + static BWQuincyManager *quincyManager = nil; - if (quincyManager == nil) { - quincyManager = [[BWQuincyManager alloc] init]; - } + if (quincyManager == nil) { + quincyManager = [[BWQuincyManager alloc] init]; + } - return quincyManager; + return quincyManager; } #endif - (id) init { if ((self = [super init])) { - _serverResult = CrashReportStatusUnknown; - _crashIdenticalCurrentVersion = YES; - _crashData = nil; + _serverResult = CrashReportStatusUnknown; + _crashIdenticalCurrentVersion = YES; + _crashData = nil; _urlConnection = nil; - _submissionURL = nil; + _submissionURL = nil; _responseData = nil; _appIdentifier = nil; _sendingInProgress = NO; @@ -130,63 +129,63 @@ NSString *BWQuincyLocalize(NSString *stringToken) { _didCrashInLastSession = NO; _loggingEnabled = NO; - self.delegate = nil; + self.delegate = nil; self.feedbackActivated = NO; self.showAlwaysButton = NO; self.autoSubmitCrashReport = NO; self.autoSubmitDeviceUDID = NO; - NSString *testValue = [[NSUserDefaults standardUserDefaults] stringForKey:kQuincyKitAnalyzerStarted]; - if (testValue) { - _analyzerStarted = [[NSUserDefaults standardUserDefaults] integerForKey:kQuincyKitAnalyzerStarted]; - } else { - _analyzerStarted = 0; - } + NSString *testValue = [[NSUserDefaults standardUserDefaults] stringForKey:kQuincyKitAnalyzerStarted]; + if (testValue) { + _analyzerStarted = [[NSUserDefaults standardUserDefaults] integerForKey:kQuincyKitAnalyzerStarted]; + } else { + _analyzerStarted = 0; + } - testValue = nil; - testValue = [[NSUserDefaults standardUserDefaults] stringForKey:kQuincyKitActivated]; - if (testValue) { - _crashReportActivated = [[NSUserDefaults standardUserDefaults] boolForKey:kQuincyKitActivated]; - } else { - _crashReportActivated = YES; - [[NSUserDefaults standardUserDefaults] setValue:[NSNumber numberWithBool:YES] forKey:kQuincyKitActivated]; - } + testValue = nil; + testValue = [[NSUserDefaults standardUserDefaults] stringForKey:kQuincyKitActivated]; + if (testValue) { + _crashReportActivated = [[NSUserDefaults standardUserDefaults] boolForKey:kQuincyKitActivated]; + } else { + _crashReportActivated = YES; + [[NSUserDefaults standardUserDefaults] setValue:[NSNumber numberWithBool:YES] forKey:kQuincyKitActivated]; + } - if (_crashReportActivated) { - _crashFiles = [[NSMutableArray alloc] init]; - NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); - _crashesDir = [[NSString stringWithFormat:@"%@", [[paths objectAtIndex:0] stringByAppendingPathComponent:@"/crashes/"]] retain]; + if (_crashReportActivated) { + _crashFiles = [[NSMutableArray alloc] init]; + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); + _crashesDir = [[NSString stringWithFormat:@"%@", [[paths objectAtIndex:0] stringByAppendingPathComponent:@"/crashes/"]] retain]; - NSFileManager *fm = [NSFileManager defaultManager]; + NSFileManager *fm = [NSFileManager defaultManager]; - if (![fm fileExistsAtPath:_crashesDir]) { - NSDictionary *attributes = [NSDictionary dictionaryWithObject: [NSNumber numberWithUnsignedLong: 0755] forKey: NSFilePosixPermissions]; - NSError *theError = NULL; + if (![fm fileExistsAtPath:_crashesDir]) { + NSDictionary *attributes = [NSDictionary dictionaryWithObject: [NSNumber numberWithUnsignedLong: 0755] forKey: NSFilePosixPermissions]; + NSError *theError = NULL; - [fm createDirectoryAtPath:_crashesDir withIntermediateDirectories: YES attributes: attributes error: &theError]; - } - - PLCrashReporter *crashReporter = [PLCrashReporter sharedReporter]; - NSError *error = NULL; - - // Check if we previously crashed - if ([crashReporter hasPendingCrashReport]) { - _didCrashInLastSession = YES; - [self handleCrashReport]; + [fm createDirectoryAtPath:_crashesDir withIntermediateDirectories: YES attributes: attributes error: &theError]; } - // Enable the Crash Reporter - if (![crashReporter enableCrashReporterAndReturnError: &error]) - NSLog(@"WARNING: Could not enable crash reporter: %@", error); + PLCrashReporter *crashReporter = [PLCrashReporter sharedReporter]; + NSError *error = NULL; + + // Check if we previously crashed + if ([crashReporter hasPendingCrashReport]) { + _didCrashInLastSession = YES; + [self handleCrashReport]; + } + + // Enable the Crash Reporter + if (![crashReporter enableCrashReporterAndReturnError: &error]) + NSLog(@"WARNING: Could not enable crash reporter: %@", error); [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(startManager) name:BWQuincyNetworkBecomeReachable object:nil]; - } + } if (!quincyBundle()) { - NSLog(@"WARNING: Quincy.bundle is missing, will send reports automatically!"); + NSLog(@"WARNING: Quincy.bundle is missing, will send reports automatically!"); } - } - return self; + } + return self; } @@ -208,10 +207,10 @@ NSString *BWQuincyLocalize(NSString *stringToken) { [_crashData release]; - [_crashesDir release]; - [_crashFiles release]; + [_crashesDir release]; + [_crashFiles release]; - [super dealloc]; + [super dealloc]; } @@ -292,8 +291,8 @@ NSString *BWQuincyLocalize(NSString *stringToken) { if (!approvedCrashReports || [approvedCrashReports count] == 0) return YES; - for (NSUInteger i=0; i < [_crashFiles count]; i++) { - NSString *filename = [_crashFiles objectAtIndex:i]; + for (NSUInteger i=0; i < [_crashFiles count]; i++) { + NSString *filename = [_crashFiles objectAtIndex:i]; if (![approvedCrashReports objectForKey:filename]) return YES; } @@ -330,46 +329,46 @@ NSString *BWQuincyLocalize(NSString *stringToken) { - (void) showCrashStatusMessage { - UIAlertView *alertView = nil; + UIAlertView *alertView = nil; - if (_serverResult >= CrashReportStatusAssigned && - _crashIdenticalCurrentVersion && - quincyBundle()) { - // show some feedback to the user about the crash status - NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]; - switch (_serverResult) { - case CrashReportStatusAssigned: - alertView = [[UIAlertView alloc] initWithTitle: [NSString stringWithFormat:BWQuincyLocalize(@"CrashResponseTitle"), appName ] + if (_serverResult >= CrashReportStatusAssigned && + _crashIdenticalCurrentVersion && + quincyBundle()) { + // show some feedback to the user about the crash status + NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]; + switch (_serverResult) { + case CrashReportStatusAssigned: + alertView = [[UIAlertView alloc] initWithTitle: [NSString stringWithFormat:BWQuincyLocalize(@"CrashResponseTitle"), appName ] message: [NSString stringWithFormat:BWQuincyLocalize(@"CrashResponseNextRelease"), appName] delegate: self cancelButtonTitle: BWQuincyLocalize(@"CrashResponseTitleOK") otherButtonTitles: nil]; - break; - case CrashReportStatusSubmitted: - alertView = [[UIAlertView alloc] initWithTitle: [NSString stringWithFormat:BWQuincyLocalize(@"CrashResponseTitle"), appName ] + break; + case CrashReportStatusSubmitted: + alertView = [[UIAlertView alloc] initWithTitle: [NSString stringWithFormat:BWQuincyLocalize(@"CrashResponseTitle"), appName ] message: [NSString stringWithFormat:BWQuincyLocalize(@"CrashResponseWaitingApple"), appName] delegate: self cancelButtonTitle: BWQuincyLocalize(@"CrashResponseTitleOK") otherButtonTitles: nil]; - break; - case CrashReportStatusAvailable: - alertView = [[UIAlertView alloc] initWithTitle: [NSString stringWithFormat:BWQuincyLocalize(@"CrashResponseTitle"), appName ] + break; + case CrashReportStatusAvailable: + alertView = [[UIAlertView alloc] initWithTitle: [NSString stringWithFormat:BWQuincyLocalize(@"CrashResponseTitle"), appName ] message: [NSString stringWithFormat:BWQuincyLocalize(@"CrashResponseAvailable"), appName] delegate: self cancelButtonTitle: BWQuincyLocalize(@"CrashResponseTitleOK") otherButtonTitles: nil]; - break; - default: - alertView = nil; - break; - } + break; + default: + alertView = nil; + break; + } - if (alertView) { - [alertView setTag: QuincyKitAlertTypeFeedback]; - [alertView show]; - [alertView release]; - } - } + if (alertView) { + [alertView setTag: QuincyKitAlertTypeFeedback]; + [alertView show]; + [alertView release]; + } + } } @@ -410,40 +409,40 @@ NSString *BWQuincyLocalize(NSString *stringToken) { #pragma mark NSXMLParser - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict { - if (qName) { - elementName = qName; - } + if (qName) { + elementName = qName; + } - if ([elementName isEqualToString:@"result"]) { - _contentOfProperty = [NSMutableString string]; + if ([elementName isEqualToString:@"result"]) { + _contentOfProperty = [NSMutableString string]; } } - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName { - if (qName) { - elementName = qName; - } + if (qName) { + elementName = qName; + } // open source implementation - if ([elementName isEqualToString: @"result"]) { - if ([_contentOfProperty intValue] > _serverResult) { - _serverResult = (CrashReportStatus)[_contentOfProperty intValue]; - } else { + if ([elementName isEqualToString: @"result"]) { + if ([_contentOfProperty intValue] > _serverResult) { + _serverResult = (CrashReportStatus)[_contentOfProperty intValue]; + } else { CrashReportStatus errorcode = (CrashReportStatus)[_contentOfProperty intValue]; - NSLog(@"CrashReporter ended in error code: %i", errorcode); - } - } + NSLog(@"CrashReporter ended in error code: %i", errorcode); + } + } } - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string { - if (_contentOfProperty) { - // If the current element is one whose content we care about, append 'string' - // to the property that holds the content of the current element. - if (string != nil) { - [_contentOfProperty appendString:string]; - } - } + if (_contentOfProperty) { + // If the current element is one whose content we care about, append 'string' + // to the property that holds the content of the current element. + if (string != nil) { + [_contentOfProperty appendString:string]; + } + } } #pragma mark - @@ -451,13 +450,13 @@ NSString *BWQuincyLocalize(NSString *stringToken) { - (NSString *)_getDevicePlatform { - size_t size = 0; - sysctlbyname("hw.machine", NULL, &size, NULL, 0); - char *answer = (char*)malloc(size); - sysctlbyname("hw.machine", answer, &size, NULL, 0); - NSString *platform = [NSString stringWithCString:answer encoding: NSUTF8StringEncoding]; - free(answer); - return platform; + size_t size = 0; + sysctlbyname("hw.machine", NULL, &size, NULL, 0); + char *answer = (char*)malloc(size); + sysctlbyname("hw.machine", answer, &size, NULL, 0); + NSString *platform = [NSString stringWithCString:answer encoding: NSUTF8StringEncoding]; + free(answer); + return platform; } - (NSString *)deviceIdentifier { @@ -473,52 +472,52 @@ NSString *BWQuincyLocalize(NSString *stringToken) { NSMutableDictionary *approvedCrashReports = [NSMutableDictionary dictionaryWithDictionary:[[NSUserDefaults standardUserDefaults] dictionaryForKey: kApprovedCrashReports]]; NSFileManager *fm = [NSFileManager defaultManager]; - NSError *error = NULL; + NSError *error = NULL; - NSString *userid = @""; - NSString *contact = @""; - NSString *description = @""; + NSString *userid = @""; + NSString *contact = @""; + NSString *description = @""; if (self.autoSubmitDeviceUDID && [[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"]) { userid = [self deviceIdentifier]; } else if (self.delegate != nil && [self.delegate respondsToSelector:@selector(crashReportUserID)]) { - userid = [self.delegate crashReportUserID] ?: @""; - } + userid = [self.delegate crashReportUserID] ?: @""; + } - if (self.delegate != nil && [self.delegate respondsToSelector:@selector(crashReportContact)]) { - contact = [self.delegate crashReportContact] ?: @""; - } + if (self.delegate != nil && [self.delegate respondsToSelector:@selector(crashReportContact)]) { + contact = [self.delegate crashReportContact] ?: @""; + } - if (self.delegate != nil && [self.delegate respondsToSelector:@selector(crashReportDescription)]) { - description = [self.delegate crashReportDescription] ?: @""; - } + if (self.delegate != nil && [self.delegate respondsToSelector:@selector(crashReportDescription)]) { + description = [self.delegate crashReportDescription] ?: @""; + } NSMutableString *crashes = nil; _crashIdenticalCurrentVersion = NO; - for (NSUInteger i=0; i < [_crashFiles count]; i++) { - NSString *filename = [_crashesDir stringByAppendingPathComponent:[_crashFiles objectAtIndex:i]]; - NSData *crashData = [NSData dataWithContentsOfFile:filename]; + for (NSUInteger i=0; i < [_crashFiles count]; i++) { + NSString *filename = [_crashesDir stringByAppendingPathComponent:[_crashFiles objectAtIndex:i]]; + NSData *crashData = [NSData dataWithContentsOfFile:filename]; - if ([crashData length] > 0) { - PLCrashReport *report = [[[PLCrashReport alloc] initWithData:crashData error:&error] autorelease]; + if ([crashData length] > 0) { + PLCrashReport *report = [[[PLCrashReport alloc] initWithData:crashData error:&error] autorelease]; if (report == nil) { NSLog(@"Could not parse crash report"); continue; } - NSString *crashLogString = [PLCrashReportTextFormatter stringValueForCrashReport:report withTextFormat:PLCrashReportTextFormatiOS]; + NSString *crashLogString = [PLCrashReportTextFormatter stringValueForCrashReport:report withTextFormat:PLCrashReportTextFormatiOS]; - if ([report.applicationInfo.applicationVersion compare:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]] == NSOrderedSame) { - _crashIdenticalCurrentVersion = YES; - } + if ([report.applicationInfo.applicationVersion compare:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]] == NSOrderedSame) { + _crashIdenticalCurrentVersion = YES; + } if (crashes == nil) { crashes = [NSMutableString string]; } - [crashes appendFormat:@"%s%@%@%@%@%@%@%@", + [crashes appendFormat:@"%s%@%@%@%@%@%@%@", [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleExecutable"] UTF8String], report.applicationInfo.applicationIdentifier, report.systemInfo.operatingSystemVersion, @@ -528,16 +527,16 @@ NSString *BWQuincyLocalize(NSString *stringToken) { [crashLogString stringByReplacingOccurrencesOfString:@"]]>" withString:@"]]" @"]]>" options:NSLiteralSearch range:NSMakeRange(0,crashLogString.length)], userid, contact, - [description stringByReplacingOccurrencesOfString:@"]]>" withString:@"]]" @"]]>" options:NSLiteralSearch range:NSMakeRange(0,description.length)]]; + [description stringByReplacingOccurrencesOfString:@"]]>" withString:@"]]" @"]]>" options:NSLiteralSearch range:NSMakeRange(0,description.length)]]; // store this crash report as user approved, so if it fails it will retry automatically [approvedCrashReports setObject:[NSNumber numberWithBool:YES] forKey:[_crashFiles objectAtIndex:i]]; - } else { + } else { // we cannot do anything with this report, so delete it [fm removeItemAtPath:filename error:&error]; } - } + } [[NSUserDefaults standardUserDefaults] setObject:approvedCrashReports forKey:kApprovedCrashReports]; [[NSUserDefaults standardUserDefaults] synchronize]; @@ -572,58 +571,60 @@ NSString *BWQuincyLocalize(NSString *stringToken) { - (void)_checkForFeedbackStatus { NSMutableURLRequest *request = nil; - request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@api/2/apps/%@/crashes/%@", - self.submissionURL, - [self.appIdentifier stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], - _feedbackRequestID - ] - ]]; + request = [NSMutableURLRequest requestWithURL: + [NSURL URLWithString:[NSString stringWithFormat:@"%@api/2/apps/%@/crashes/%@", + self.submissionURL, + [self.appIdentifier stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], + _feedbackRequestID + ] + ]]; - [request setCachePolicy: NSURLRequestReloadIgnoringLocalCacheData]; - [request setValue:@"Quincy/iOS" forHTTPHeaderField:@"User-Agent"]; + [request setCachePolicy: NSURLRequestReloadIgnoringLocalCacheData]; + [request setValue:@"Quincy/iOS" forHTTPHeaderField:@"User-Agent"]; [request setValue:@"gzip" forHTTPHeaderField:@"Accept-Encoding"]; - [request setTimeoutInterval: 15]; - [request setHTTPMethod:@"GET"]; + [request setTimeoutInterval: 15]; + [request setHTTPMethod:@"GET"]; - _serverResult = CrashReportStatusUnknown; - _statusCode = 200; + _serverResult = CrashReportStatusUnknown; + _statusCode = 200; - // Release when done in the delegate method - _responseData = [[NSMutableData alloc] init]; + // Release when done in the delegate method + _responseData = [[NSMutableData alloc] init]; - if (self.delegate != nil && [self.delegate respondsToSelector:@selector(connectionOpened)]) { - [self.delegate connectionOpened]; - } + if (self.delegate != nil && [self.delegate respondsToSelector:@selector(connectionOpened)]) { + [self.delegate connectionOpened]; + } - _urlConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; + _urlConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; BWQuincyLog(@"Requesting feedback status."); } - (void)_postXML:(NSString*)xml toURL:(NSURL*)url { - NSMutableURLRequest *request = nil; + NSMutableURLRequest *request = nil; NSString *boundary = @"----FOO"; if (self.appIdentifier) { - request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@api/2/apps/%@/crashes", - self.submissionURL, - [self.appIdentifier stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] - ] - ]]; + request = [NSMutableURLRequest requestWithURL: + [NSURL URLWithString:[NSString stringWithFormat:@"%@api/2/apps/%@/crashes", + self.submissionURL, + [self.appIdentifier stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] + ] + ]]; } else { request = [NSMutableURLRequest requestWithURL:url]; } - [request setCachePolicy: NSURLRequestReloadIgnoringLocalCacheData]; - [request setValue:@"Quincy/iOS" forHTTPHeaderField:@"User-Agent"]; + [request setCachePolicy: NSURLRequestReloadIgnoringLocalCacheData]; + [request setValue:@"Quincy/iOS" forHTTPHeaderField:@"User-Agent"]; [request setValue:@"gzip" forHTTPHeaderField:@"Accept-Encoding"]; - [request setTimeoutInterval: 15]; - [request setHTTPMethod:@"POST"]; - NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary]; - [request setValue:contentType forHTTPHeaderField:@"Content-type"]; + [request setTimeoutInterval: 15]; + [request setHTTPMethod:@"POST"]; + NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary]; + [request setValue:contentType forHTTPHeaderField:@"Content-type"]; - NSMutableData *postBody = [NSMutableData data]; - [postBody appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; + NSMutableData *postBody = [NSMutableData data]; + [postBody appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; if (self.appIdentifier) { [postBody appendData:[@"Content-Disposition: form-data; name=\"xml\"; filename=\"crash.xml\"\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithFormat:@"Content-Type: text/xml\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; @@ -635,17 +636,17 @@ NSString *BWQuincyLocalize(NSString *stringToken) { [request setHTTPBody:postBody]; - _serverResult = CrashReportStatusUnknown; - _statusCode = 200; + _serverResult = CrashReportStatusUnknown; + _statusCode = 200; - //Release when done in the delegate method - _responseData = [[NSMutableData alloc] init]; + //Release when done in the delegate method + _responseData = [[NSMutableData alloc] init]; - if (self.delegate != nil && [self.delegate respondsToSelector:@selector(connectionOpened)]) { - [self.delegate connectionOpened]; - } + if (self.delegate != nil && [self.delegate respondsToSelector:@selector(connectionOpened)]) { + [self.delegate connectionOpened]; + } - _urlConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; + _urlConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self]; if (!_urlConnection) { BWQuincyLog(@"Sending crash reports could not start!"); @@ -658,13 +659,13 @@ NSString *BWQuincyLocalize(NSString *stringToken) { #pragma mark NSURLConnection Delegate - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { - if ([response isKindOfClass:[NSHTTPURLResponse class]]) { - _statusCode = [(NSHTTPURLResponse *)response statusCode]; - } + if ([response isKindOfClass:[NSHTTPURLResponse class]]) { + _statusCode = [(NSHTTPURLResponse *)response statusCode]; + } } - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { - [_responseData appendData:data]; + [_responseData appendData:data]; } - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { @@ -754,15 +755,15 @@ NSString *BWQuincyLocalize(NSString *stringToken) { // Called to handle a pending crash report. // - (void) handleCrashReport { - PLCrashReporter *crashReporter = [PLCrashReporter sharedReporter]; - NSError *error = NULL; + PLCrashReporter *crashReporter = [PLCrashReporter sharedReporter]; + NSError *error = NULL; // check if the next call ran successfully the last time - if (_analyzerStarted == 0) { - // mark the start of the routine - _analyzerStarted = 1; - [[NSUserDefaults standardUserDefaults] setValue:[NSNumber numberWithInt:_analyzerStarted] forKey:kQuincyKitAnalyzerStarted]; - [[NSUserDefaults standardUserDefaults] synchronize]; + if (_analyzerStarted == 0) { + // mark the start of the routine + _analyzerStarted = 1; + [[NSUserDefaults standardUserDefaults] setValue:[NSNumber numberWithInt:_analyzerStarted] forKey:kQuincyKitAnalyzerStarted]; + [[NSUserDefaults standardUserDefaults] synchronize]; // Try loading the crash report _crashData = [[NSData alloc] initWithData:[crashReporter loadPendingCrashReportDataAndReturnError: &error]]; @@ -773,17 +774,17 @@ NSString *BWQuincyLocalize(NSString *stringToken) { NSLog(@"Could not load crash report: %@", error); } else { [_crashData writeToFile:[_crashesDir stringByAppendingPathComponent: cacheFilename] atomically:YES]; - } - } + } + } - // Purge the report - // mark the end of the routine - _analyzerStarted = 0; - [[NSUserDefaults standardUserDefaults] setValue:[NSNumber numberWithInt:_analyzerStarted] forKey:kQuincyKitAnalyzerStarted]; + // Purge the report + // mark the end of the routine + _analyzerStarted = 0; + [[NSUserDefaults standardUserDefaults] setValue:[NSNumber numberWithInt:_analyzerStarted] forKey:kQuincyKitAnalyzerStarted]; [[NSUserDefaults standardUserDefaults] synchronize]; - [crashReporter purgePendingCrashReport]; - return; + [crashReporter purgePendingCrashReport]; + return; } diff --git a/Classes/CNSHockeyManager.m b/Classes/CNSHockeyManager.m index 94c0007c59..2c216ebaf6 100644 --- a/Classes/CNSHockeyManager.m +++ b/Classes/CNSHockeyManager.m @@ -51,13 +51,13 @@ } #else + (CNSHockeyManager *)sharedHockeyManager { - static CNSHockeyManager *hockeyManager = nil; + static CNSHockeyManager *hockeyManager = nil; - if (hockeyManager == nil) { - hockeyManager = [[CNSHockeyManager alloc] init]; - } + if (hockeyManager == nil) { + hockeyManager = [[CNSHockeyManager alloc] init]; + } - return hockeyManager; + return hockeyManager; } #endif diff --git a/Classes/NSString+HockeyAdditions.m b/Classes/NSString+HockeyAdditions.m index a6483d4a07..d51776a9bf 100755 --- a/Classes/NSString+HockeyAdditions.m +++ b/Classes/NSString+HockeyAdditions.m @@ -51,29 +51,28 @@ CNS_FIX_CATEGORY_BUG(NSString_HockeyAdditions) return result; } -- (NSComparisonResult)versionCompare:(NSString *)other -{ - // Extract plain version number from self - NSString *plainSelf = self; - NSRange letterRange = [plainSelf rangeOfCharacterFromSet: [NSCharacterSet letterCharacterSet]]; - if (letterRange.length) - plainSelf = [plainSelf substringToIndex: letterRange.location]; +- (NSComparisonResult)versionCompare:(NSString *)other { + // Extract plain version number from self + NSString *plainSelf = self; + NSRange letterRange = [plainSelf rangeOfCharacterFromSet: [NSCharacterSet letterCharacterSet]]; + if (letterRange.length) + plainSelf = [plainSelf substringToIndex: letterRange.location]; - // Extract plain version number from other - NSString *plainOther = other; - letterRange = [plainOther rangeOfCharacterFromSet: [NSCharacterSet letterCharacterSet]]; - if (letterRange.length) - plainOther = [plainOther substringToIndex: letterRange.location]; + // Extract plain version number from other + NSString *plainOther = other; + letterRange = [plainOther rangeOfCharacterFromSet: [NSCharacterSet letterCharacterSet]]; + if (letterRange.length) + plainOther = [plainOther substringToIndex: letterRange.location]; - // Compare plain versions - NSComparisonResult result = [plainSelf compare:plainOther options:NSNumericSearch]; + // Compare plain versions + NSComparisonResult result = [plainSelf compare:plainOther options:NSNumericSearch]; - // If plain versions are equal, compare full versions - if (result == NSOrderedSame) - result = [self compare:other options:NSNumericSearch]; + // If plain versions are equal, compare full versions + if (result == NSOrderedSame) + result = [self compare:other options:NSNumericSearch]; - // Done - return result; + // Done + return result; } @end diff --git a/Classes/PSStoreButton.m b/Classes/PSStoreButton.m index 629d74b3ce..2ffe73fee8 100644 --- a/Classes/PSStoreButton.m +++ b/Classes/PSStoreButton.m @@ -232,8 +232,8 @@ - (CGSize)sizeThatFits:(CGSize)size { CGSize constr = (CGSize){.height = self.frame.size.height, .width = PS_MAX_WIDTH}; - CGSize newSize = [self.buttonData.label sizeWithFont:self.titleLabel.font constrainedToSize:constr lineBreakMode:UILineBreakModeMiddleTruncation]; - CGFloat newWidth = newSize.width + (PS_PADDING * 2); + CGSize newSize = [self.buttonData.label sizeWithFont:self.titleLabel.font constrainedToSize:constr lineBreakMode:UILineBreakModeMiddleTruncation]; + CGFloat newWidth = newSize.width + (PS_PADDING * 2); CGFloat newHeight = PS_MIN_HEIGHT > newSize.height ? PS_MIN_HEIGHT : newSize.height; CGSize sizeThatFits = CGSizeMake(newWidth, newHeight); @@ -250,7 +250,7 @@ rect.size.height = self.frame.size.height; aLayer.frame = rect; [aLayer layoutIfNeeded]; - } + } } /////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Classes/PSWebTableViewCell.m b/Classes/PSWebTableViewCell.m index a6dfc475a9..98f730f25e 100644 --- a/Classes/PSWebTableViewCell.m +++ b/Classes/PSWebTableViewCell.m @@ -52,15 +52,15 @@ body { font: 13px 'Helvetica Neue', Helvetica; word-wrap:break-word; padding:8px #pragma mark private - (void)addWebView { - if(webViewContent_) { + if(webViewContent_) { CGRect webViewRect = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height); - if(!webView_) { - webView_ = [[[UIWebView alloc] initWithFrame:webViewRect] retain]; - [self addSubview:webView_]; - webView_.hidden = YES; - webView_.backgroundColor = self.cellBackgroundColor; - webView_.opaque = NO; - webView_.delegate = self; + if(!webView_) { + webView_ = [[[UIWebView alloc] initWithFrame:webViewRect] retain]; + [self addSubview:webView_]; + webView_.hidden = YES; + webView_.backgroundColor = self.cellBackgroundColor; + webView_.opaque = NO; + webView_.delegate = self; webView_.autoresizingMask = UIViewAutoresizingFlexibleWidth; for(UIView* subView in webView_.subviews){ @@ -79,32 +79,32 @@ body { font: 13px 'Helvetica Neue', Helvetica; word-wrap:break-word; padding:8px } } } - else - webView_.frame = webViewRect; + else + webView_.frame = webViewRect; NSString *deviceWidth = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? [NSString stringWithFormat:@"%d", CGRectGetWidth(self.bounds)] : @"device-width"; //BWHockeyLog(@"%@\n%@\%@", PSWebTableViewCellHtmlTemplate, deviceWidth, self.webViewContent); NSString *contentHtml = [NSString stringWithFormat:PSWebTableViewCellHtmlTemplate, deviceWidth, self.webViewContent]; - [webView_ loadHTMLString:contentHtml baseURL:nil]; - } + [webView_ loadHTMLString:contentHtml baseURL:nil]; + } } - (void)showWebView { - webView_.hidden = NO; + webView_.hidden = NO; self.textLabel.text = @""; - [self setNeedsDisplay]; + [self setNeedsDisplay]; } - (void)removeWebView { - if(webView_) { - webView_.delegate = nil; - [webView_ resignFirstResponder]; - [webView_ removeFromSuperview]; - [webView_ release]; - } - webView_ = nil; - [self setNeedsDisplay]; + if(webView_) { + webView_.delegate = nil; + [webView_ resignFirstResponder]; + [webView_ removeFromSuperview]; + [webView_ release]; + } + webView_ = nil; + [self setNeedsDisplay]; } @@ -163,15 +163,15 @@ body { font: 13px 'Helvetica Neue', Helvetica; word-wrap:break-word; padding:8px #pragma mark UIWebView - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { - if(navigationType == UIWebViewNavigationTypeOther) - return YES; + if(navigationType == UIWebViewNavigationTypeOther) + return YES; return NO; } - (void)webViewDidFinishLoad:(UIWebView *)webView { - if(webViewContent_) + if(webViewContent_) [self showWebView]; CGRect frame = webView_.frame; diff --git a/Classes/UIImage+HockeyAdditions.m b/Classes/UIImage+HockeyAdditions.m index d0cdf2b26c..57ef986d5e 100644 --- a/Classes/UIImage+HockeyAdditions.m +++ b/Classes/UIImage+HockeyAdditions.m @@ -87,9 +87,9 @@ CGImageRef CreateGradientImage(int pixelsWide, int pixelsHigh, float fromAlpha, - (UIImage *)bw_roundedCornerImage:(NSInteger)cornerSize borderSize:(NSInteger)borderSize { // If the image does not have an alpha layer, add one - UIImage *roundedImage = nil; + UIImage *roundedImage = nil; #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 40000 - BW_IF_IOS4_OR_GREATER( + BW_IF_IOS4_OR_GREATER( UIGraphicsBeginImageContextWithOptions(self.size, NO, 0.0); // 0.0 for scale means "correct scale for device's main screen". CGImageRef sourceImg = CGImageCreateWithImageInRect([self CGImage], CGRectMake(0, 0, self.size.width * self.scale, self.size.height * self.scale)); // cropping happens here. @@ -224,20 +224,21 @@ CGImageRef CreateGradientImage(int pixelsWide, int pixelsHigh, float fromAlpha, image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); ) + if (!image) { - // Try older method. - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGContextRef context = CGBitmapContextCreate(NULL, scaledWidth, scaledHeight, 8, (fitSize.width * 4), - colorSpace, kCGImageAlphaPremultipliedLast); - CGImageRef sourceImg = CGImageCreateWithImageInRect([self CGImage], sourceRect); - CGContextDrawImage(context, destRect, sourceImg); - CGImageRelease(sourceImg); - CGImageRef finalImage = CGBitmapContextCreateImage(context); - CGContextRelease(context); - CGColorSpaceRelease(colorSpace); - image = [UIImage imageWithCGImage:finalImage]; - CGImageRelease(finalImage); - } + // Try older method. + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + CGContextRef context = CGBitmapContextCreate(NULL, scaledWidth, scaledHeight, 8, (fitSize.width * 4), + colorSpace, kCGImageAlphaPremultipliedLast); + CGImageRef sourceImg = CGImageCreateWithImageInRect([self CGImage], sourceRect); + CGContextDrawImage(context, destRect, sourceImg); + CGImageRelease(sourceImg); + CGImageRef finalImage = CGBitmapContextCreateImage(context); + CGContextRelease(context); + CGColorSpaceRelease(colorSpace); + image = [UIImage imageWithCGImage:finalImage]; + CGImageRelease(finalImage); + } return image; } @@ -245,37 +246,37 @@ CGImageRef CreateGradientImage(int pixelsWide, int pixelsHigh, float fromAlpha, CGImageRef CreateGradientImage(int pixelsWide, int pixelsHigh, float fromAlpha, float toAlpha) { - CGImageRef theCGImage = NULL; + CGImageRef theCGImage = NULL; - // gradient is always black-white and the mask must be in the gray colorspace + // gradient is always black-white and the mask must be in the gray colorspace CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); - // create the bitmap context - CGContextRef gradientBitmapContext = CGBitmapContextCreate(NULL, pixelsWide, pixelsHigh, - 8, 0, colorSpace, kCGImageAlphaNone); + // create the bitmap context + CGContextRef gradientBitmapContext = CGBitmapContextCreate(NULL, pixelsWide, pixelsHigh, + 8, 0, colorSpace, kCGImageAlphaNone); - // define the start and end grayscale values (with the alpha, even though - // our bitmap context doesn't support alpha the gradient requires it) - CGFloat colors[] = {toAlpha, 1.0, fromAlpha, 1.0}; + // define the start and end grayscale values (with the alpha, even though + // our bitmap context doesn't support alpha the gradient requires it) + CGFloat colors[] = {toAlpha, 1.0, fromAlpha, 1.0}; - // create the CGGradient and then release the gray color space - CGGradientRef grayScaleGradient = CGGradientCreateWithColorComponents(colorSpace, colors, NULL, 2); - CGColorSpaceRelease(colorSpace); + // create the CGGradient and then release the gray color space + CGGradientRef grayScaleGradient = CGGradientCreateWithColorComponents(colorSpace, colors, NULL, 2); + CGColorSpaceRelease(colorSpace); - // create the start and end points for the gradient vector (straight down) - CGPoint gradientEndPoint = CGPointZero; - CGPoint gradientStartPoint = CGPointMake(0, pixelsHigh); + // create the start and end points for the gradient vector (straight down) + CGPoint gradientEndPoint = CGPointZero; + CGPoint gradientStartPoint = CGPointMake(0, pixelsHigh); - // draw the gradient into the gray bitmap context - CGContextDrawLinearGradient(gradientBitmapContext, grayScaleGradient, gradientStartPoint, + // draw the gradient into the gray bitmap context + CGContextDrawLinearGradient(gradientBitmapContext, grayScaleGradient, gradientStartPoint, gradientEndPoint, kCGGradientDrawsAfterEndLocation); - CGGradientRelease(grayScaleGradient); + CGGradientRelease(grayScaleGradient); - // convert the context into a CGImageRef and release the context - theCGImage = CGBitmapContextCreateImage(gradientBitmapContext); - CGContextRelease(gradientBitmapContext); + // convert the context into a CGImageRef and release the context + theCGImage = CGBitmapContextCreateImage(gradientBitmapContext); + CGContextRelease(gradientBitmapContext); - // return the imageref containing the gradient + // return the imageref containing the gradient return theCGImage; } @@ -293,29 +294,29 @@ CGContextRef MyOpenBitmapContext(int pixelsWide, int pixelsHigh) { - (UIImage *)bw_reflectedImageWithHeight:(NSUInteger)height fromAlpha:(float)fromAlpha toAlpha:(float)toAlpha { if(height == 0) - return nil; + return nil; - // create a bitmap graphics context the size of the image - CGContextRef mainViewContentContext = MyOpenBitmapContext(self.size.width, height); + // create a bitmap graphics context the size of the image + CGContextRef mainViewContentContext = MyOpenBitmapContext(self.size.width, height); - // create a 2 bit CGImage containing a gradient that will be used for masking the - // main view content to create the 'fade' of the reflection. The CGImageCreateWithMask - // function will stretch the bitmap image as required, so we can create a 1 pixel wide gradient - CGImageRef gradientMaskImage = CreateGradientImage(1, height, fromAlpha, toAlpha); + // create a 2 bit CGImage containing a gradient that will be used for masking the + // main view content to create the 'fade' of the reflection. The CGImageCreateWithMask + // function will stretch the bitmap image as required, so we can create a 1 pixel wide gradient + CGImageRef gradientMaskImage = CreateGradientImage(1, height, fromAlpha, toAlpha); - // create an image by masking the bitmap of the mainView content with the gradient view - // then release the pre-masked content bitmap and the gradient bitmap - CGContextClipToMask(mainViewContentContext, CGRectMake(0.0, 0.0, self.size.width, height), gradientMaskImage); - CGImageRelease(gradientMaskImage); + // create an image by masking the bitmap of the mainView content with the gradient view + // then release the pre-masked content bitmap and the gradient bitmap + CGContextClipToMask(mainViewContentContext, CGRectMake(0.0, 0.0, self.size.width, height), gradientMaskImage); + CGImageRelease(gradientMaskImage); - // draw the image into the bitmap context - CGContextDrawImage(mainViewContentContext, CGRectMake(0, 0, self.size.width, self.size.height), self.CGImage); + // draw the image into the bitmap context + CGContextDrawImage(mainViewContentContext, CGRectMake(0, 0, self.size.width, self.size.height), self.CGImage); - // convert the finished reflection image to a UIImage - UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext(); // returns autoreleased + // convert the finished reflection image to a UIImage + UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext(); // returns autoreleased UIGraphicsEndImageContext(); - return theImage; + return theImage; } - (id)bw_initWithContentsOfResolutionIndependentFile:(NSString *)path { @@ -342,10 +343,10 @@ CGContextRef MyOpenBitmapContext(int pixelsWide, int pixelsHigh) { + (UIImage *)bw_imageNamed:(NSString *)imageName bundle:(NSString *)bundleName { - NSString *resourcePath = [[NSBundle mainBundle] resourcePath]; - NSString *bundlePath = [resourcePath stringByAppendingPathComponent:bundleName]; - NSString *imagePath = [bundlePath stringByAppendingPathComponent:imageName]; - return [UIImage bw_imageWithContentsOfResolutionIndependentFile:imagePath]; + NSString *resourcePath = [[NSBundle mainBundle] resourcePath]; + NSString *bundlePath = [resourcePath stringByAppendingPathComponent:bundleName]; + NSString *imagePath = [bundlePath stringByAppendingPathComponent:imageName]; + return [UIImage bw_imageWithContentsOfResolutionIndependentFile:imagePath]; } @end