yuhua-chen / MCLog

Xcode plugin for filtering the console area.
MIT License
584 stars 55 forks source link

Dissapearing logs and enum values change #15

Closed cojoj closed 8 years ago

cojoj commented 9 years ago

For a couple of weeks I was struggling that ther's some kind of bug in Xcode because some of my NSLog() statements were missing, some of them were show after performing another action (with delay) and it seemed like something was wrong with Xcode 6.3 because on my friends Mac with 6.2 everything worked like charm. I don't know why this was happening and still can't tell the exact execution steps to recreate this bug - it was totally random!

The other thing which came after this missing logs was when I've tried to use reachability to check for internet connection. So first I've tried the Reachability library but my observer logged opposite values, so the simple statement:

if ([self.reachability isReachable]) {
    NSLog(@"Reachable");
} else {
    NSLog(@"Unreachable");
};

was logging Reachable when device was in airplane mode and Unreachable when in 3G or WiFi. I thought that this lib is broke so I've decided to move to AFNetworkReachabilityManager and similiar if statement also produced opposite output, what's more:

[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
    NSLog(@"Reachability: %@", AFStringFromNetworkReachabilityStatus(status));
}];

logged totally different enum values but there was a pattern - a chain of reachability changes like Airplane mode ➡️ WiFi ➡️ Airplane mode ➡️ 3G ➡️ WiFi was logged as: WiFi ➡️ Unreachable ➡️ WiFi ➡️ Unreachable ➡️ 3G (WWAN) so it's somthing like logging previous log, not the current. I know there's a bug in AFNetworkReachabilityManager but it was fixed and I'm using :head or the previous release o avoid this bug.


For now I had to remove MCLog as it's causing me a lot of problems and I've wasted a lot of time before I came to the solution that this plugin was responsible for all of my troubles.

yuhua-chen commented 9 years ago

Fixed this issue with latest version. Please try it.