Skip to content

Commit aef5af9

Browse files
authored
Merge pull request #13 from CrashOps/v0.0.822
v0.0.822
2 parents f89efcf + fbafad3 commit aef5af9

File tree

3 files changed

+34
-29
lines changed

3 files changed

+34
-29
lines changed

CrashOps.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ Pod::Spec.new do |s|
1616
#
1717

1818
s.name = "CrashOps"
19-
s.version = "0.0.821"
19+
s.version = "0.0.822"
2020
s.summary = "CrashOps helps you monitor your app's stability."
2121

2222
# This description is used to generate tags and improve search results.
2323
# * Think: What does it do? Why did you write it? What is the focus?
2424
# * Try to keep it short, snappy and to the point.
2525
# * Write the description between the DESC delimiters below.
2626
# * Finally, don't worry about the indent, CocoaPods strips it!
27-
s.description = "CrashOps lets you monitor your app's errors and crashes."
27+
s.description = "CrashOps lets you monitor your app's stability and vulnerability, by giving you error and crash reports, with a supporting platform by CrashOps servers."
2828

2929
s.homepage = "https://github.com/CrashOps/iOS-SDK"
3030
# s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"

CrashOps/CrashOps.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ +(void)initialize {
138138
@end
139139

140140
//! Project version number for CrashOps.
141-
//double CrashOpsVersionNumber = 0.00821;
141+
//double CrashOpsVersionNumber = 0.00822;
142142

143143
//! Project version string for CrashOps.
144-
//const unsigned char CrashOpsVersionString[] = "0.0.821";
144+
//const unsigned char CrashOpsVersionString[] = "0.0.822";

CrashOps/CrashOpsController.m

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,7 @@ @implementation CrashOpsController
7070
@synthesize clientId;
7171
@synthesize userDefaults;
7272

73-
+ (void) initialize {
74-
g_dateFormatter = [[NSDateFormatter alloc] init];
75-
[g_dateFormatter setLocale:[NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]];
76-
}
77-
78-
NSUncaughtExceptionHandler *oldHandler;
73+
NSUncaughtExceptionHandler *co_oldHandler;
7974

8075
// Singleton implementation in Objective-C
8176
__strong static CrashOpsController *_shared;
@@ -187,7 +182,7 @@ - (void) setIsEnabled:(BOOL)isOn {
187182
if (crashMonitorAPI == nil) {
188183
crashMonitorAPI = kscm_nsexception_getAPI();
189184
if (NSGetUncaughtExceptionHandler() != exceptionHandlerPtr) {
190-
oldHandler = NSGetUncaughtExceptionHandler();
185+
co_oldHandler = NSGetUncaughtExceptionHandler();
191186
NSSetUncaughtExceptionHandler(exceptionHandlerPtr);
192187
}
193188

@@ -198,15 +193,13 @@ - (void) setIsEnabled:(BOOL)isOn {
198193
[installation install];
199194
}
200195

201-
/* Perry's additions to help with tests */
202196
crashMonitorAPI->setEnabled(YES);
203-
/* Perry's additions to help with tests */
204197
}
205198

206199
[self uploadLogs];
207200
} else {
208-
if (oldHandler != nil) {
209-
NSSetUncaughtExceptionHandler(oldHandler);
201+
if (co_oldHandler != nil) {
202+
NSSetUncaughtExceptionHandler(co_oldHandler);
210203
}
211204

212205
if (crashMonitorAPI != nil) {
@@ -224,13 +217,26 @@ - (void)reportInternalError:(NSString *) sdkError {
224217
DebugLogArgs(@"%@", sdkError);
225218
}
226219

227-
-(void) onAppLoaded {
220+
-(void) onAppIsLoading {
228221
// Wait for app to finish launch and then...
229222
appFinishedLaunchObserver = [[NSNotificationCenter defaultCenter] addObserverForName: UIApplicationDidFinishLaunchingNotification object: nil queue: nil usingBlock:^(NSNotification * _Nonnull note) {
230223
[CrashOpsController shared].didAppFinishLaunching = YES;
231224
[[CrashOpsController shared] onAppLaunched];
232225
}];
226+
}
227+
228+
- (void) onAppLaunched {
229+
[[NSNotificationCenter defaultCenter] removeObserver: [[CrashOpsController shared] appFinishedLaunchObserver]];
230+
231+
[self setupFromInfoPlist];
232+
//DebugLogArgs(@"App loaded, isJailbroken = %d", CrashOpsController.isJailbroken);
233+
234+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
235+
[[CrashOpsController shared] uploadLogs];
236+
});
237+
}
233238

239+
-(void) setupFromInfoPlist {
234240
NSString *infoPlistPath = [[NSBundle mainBundle] pathForResource:@"CrashOpsConfig-info" ofType:@"plist"];
235241
NSDictionary* infoPlist = [NSDictionary dictionaryWithContentsOfFile: infoPlistPath];
236242

@@ -271,16 +277,6 @@ -(void) onAppLoaded {
271277
[CrashOps shared].clientId = clientId;
272278
}
273279

274-
- (void) onAppLaunched {
275-
[[NSNotificationCenter defaultCenter] removeObserver: [[CrashOpsController shared] appFinishedLaunchObserver]];
276-
277-
//DebugLogArgs(@"App loaded, isJailbroken = %d", CrashOpsController.isJailbroken);
278-
279-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
280-
[[CrashOpsController shared] uploadLogs];
281-
});
282-
}
283-
284280
- (NSArray *) errorLogFilesList {
285281
NSString *clientId = CrashOps.shared.clientId;
286282
if (!(clientId && [clientId length] > 0 && [clientId length] < 100)) {
@@ -645,6 +641,8 @@ - (void) uploadLogs {
645641
// Retry and see if there are leftovers...
646642
[[CrashOpsController shared] uploadLogs];
647643
}
644+
} else {
645+
[CrashOpsController shared].isUploading = false;
648646
}
649647
};
650648

@@ -747,8 +745,8 @@ - (void) configureAdvancedSettings {
747745
}
748746

749747
-(void) handleException:(NSException *) exception {
750-
if (oldHandler) {
751-
oldHandler(exception);
748+
if (co_oldHandler) {
749+
co_oldHandler(exception);
752750
}
753751

754752
if ([CrashOps shared].isEnabled) {
@@ -918,8 +916,15 @@ +(NSDictionary *) toJsonDictionary:(NSString *) jsonString {
918916

919917
NSUncaughtExceptionHandler *exceptionHandlerPtr = &ourExceptionHandler;
920918

919+
+(void) initialize {
920+
DebugLog(@"App is loading...");
921+
g_dateFormatter = [[NSDateFormatter alloc] init];
922+
[g_dateFormatter setLocale:[NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]];
923+
}
924+
921925
+ (void)load {
922-
[[CrashOpsController shared] onAppLoaded];
926+
[[CrashOpsController shared] onAppIsLoading];
927+
DebugLog(@"CrashOps library is being loaded");
923928
}
924929

925930
+ (NSDictionary *) getDeviceInfo {

0 commit comments

Comments
 (0)