Skip to content

Commit 8a5aec2

Browse files
authored
Remove logs (#422)
* Remove Unnecessary Logs • Ran a codebase search for usage of NSLog and switched these log statements to use our own log functionality (with different log levels) * Change Target Name • Recently added a new target (OneSignal-Dynamic-Framework). We had an older target called OneSignal-Dynamic, but it actually produced a static framework. • This commit changes the name OneSignal-Dynamic to OneSignal-Static-Framework to be more accurate/descriptive * Remove Additional Log Statement * Fix Travis Config • Changed name of a target which the travis script relied on • Removed the command entirely since it should not even be necessary
1 parent ea2ce83 commit 8a5aec2

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ before_install:
44
- cd iOS_SDK/OneSignalSDK
55
script:
66
- xcodebuild -list
7-
- xcodebuild build -scheme OneSignal-Dynamic
87
- xcodebuild -scheme UnitTests -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 8 Plus,OS=11.0' test

iOS_SDK/OneSignalSDK/Source/OneSignal.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ + (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId
398398
// NOTE: Wrapper SDKs such as Unity3D will call this method with appId set to nil so open events are not lost.
399399
// Ensure a 2nd call can be made later with the appId from the developer's code.
400400
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotificationReceived:(OSHandleNotificationReceivedBlock)receivedCallback handleNotificationAction:(OSHandleNotificationActionBlock)actionCallback settings:(NSDictionary*)settings {
401-
NSLog(@"Called init with app ID: %@", appId);
401+
[self onesignal_Log:ONE_S_LL_VERBOSE message:[NSString stringWithFormat:@"Called init with app ID: %@", appId]];
402402

403403
initializationTime = [NSDate date];
404404

iOS_SDK/OneSignalSDK/Source/OneSignalClient.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ - (BOOL)willReattemptRequest:(int)statusCode withRequest:(OneSignalRequest *)req
209209
if (async) {
210210
//retry again in 15 seconds
211211
[OneSignal onesignal_Log:ONE_S_LL_DEBUG message:[NSString stringWithFormat:@"Re-scheduling request (%@) to be re-attempted in %.3f seconds due to failed HTTP request with status code %i", NSStringFromClass([request class]), REATTEMPT_DELAY, (int)statusCode]];
212-
NSLog(@"Delay: %f", REATTEMPT_DELAY);
213212

214213
[OneSignalHelper performSelector:@selector(reattemptRequest:) onMainThreadOnObject:self withObject:reattempt afterDelay:REATTEMPT_DELAY];
215214
} else {

iOS_SDK/OneSignalSDK/Source/OneSignalMobileProvision.m

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,16 @@ + (NSDictionary*) getMobileProvision {
5151

5252
NSScanner *scanner = [NSScanner scannerWithString:binaryString];
5353
BOOL ok = [scanner scanUpToString:@"<plist" intoString:nil];
54-
if (!ok) { NSLog(@"unable to find beginning of plist"); return UIApplicationReleaseUnknown; }
54+
if (!ok) {
55+
[self logInvalidMobileProvisionError:@"unable to find beginning of plist"];
56+
return UIApplicationReleaseUnknown;
57+
}
5558
NSString *plistString;
5659
ok = [scanner scanUpToString:@"</plist>" intoString:&plistString];
57-
if (!ok) { NSLog(@"unable to find end of plist"); return UIApplicationReleaseUnknown; }
60+
if (!ok) {
61+
[self logInvalidMobileProvisionError:@"unable to find end of plist"];
62+
return UIApplicationReleaseUnknown;
63+
}
5864
plistString = [NSString stringWithFormat:@"%@</plist>",plistString];
5965
// juggle latin1 back to utf-8!
6066
NSData *plistdata_latin1 = [plistString dataUsingEncoding:NSISOLatin1StringEncoding];
@@ -63,13 +69,17 @@ + (NSDictionary*) getMobileProvision {
6369
NSError *error = nil;
6470
mobileProvision = [NSPropertyListSerialization propertyListWithData:plistdata_latin1 options:NSPropertyListImmutable format:NULL error:&error];
6571
if (error) {
66-
NSLog(@"error parsing extracted plist - %@",error);
72+
[self logInvalidMobileProvisionError:[NSString stringWithFormat:@"error parsing extracted plist - %@",error]];
6773
return nil;
6874
}
6975
}
7076
return mobileProvision;
7177
}
7278

79+
+ (void)logInvalidMobileProvisionError:(NSString *)message {
80+
[OneSignal onesignal_Log:ONE_S_LL_ERROR message:message];
81+
}
82+
7383
+ (UIApplicationReleaseMode) releaseMode {
7484
NSDictionary *entitlements = nil;
7585
NSDictionary *mobileProvision = [self getMobileProvision];

0 commit comments

Comments
 (0)