diff --git a/ios/RNNetworkInfo.m b/ios/RNNetworkInfo.m index 775b75c..a32e23d 100644 --- a/ios/RNNetworkInfo.m +++ b/ios/RNNetworkInfo.m @@ -20,19 +20,19 @@ @implementation RNNetworkInfo RCT_EXPORT_METHOD(getSSID:(RCTResponseSenderBlock)callback) { NSArray *interfaceNames = CFBridgingRelease(CNCopySupportedInterfaces()); - + NSDictionary *SSIDInfo; NSString *SSID = @"error"; - + for (NSString *interfaceName in interfaceNames) { SSIDInfo = CFBridgingRelease(CNCopyCurrentNetworkInfo((__bridge CFStringRef)interfaceName)); - + if (SSIDInfo.count > 0) { SSID = SSIDInfo[@"SSID"]; break; } } - + callback(@[SSID]); } @@ -57,13 +57,13 @@ @implementation RNNetworkInfo RCT_EXPORT_METHOD(getIPAddress:(RCTResponseSenderBlock)callback) { NSString *address = @"error"; - + struct ifaddrs *interfaces = NULL; struct ifaddrs *temp_addr = NULL; int success = 0; - + success = getifaddrs(&interfaces); - + if (success == 0) { temp_addr = interfaces; while(temp_addr != NULL) { @@ -75,7 +75,7 @@ @implementation RNNetworkInfo temp_addr = temp_addr->ifa_next; } } - + freeifaddrs(interfaces); callback(@[address]); }