Post

Replies

Boosts

Views

Activity

Get SSID of current network for iOS 15.5
Below snippet is used to fetch SSID of current network. __block NSString *ssid = nil; dispatch_semaphore_t sem = dispatch_semaphore_create(0); [NEHotspotNetwork fetchCurrentWithCompletionHandler:^(NEHotspotNetwork * _Nullable currentNetwork) {       if( currentNetwork != nil) {         ssid = [currentNetwork SSID];       }       dispatch_semaphore_signal(sem); }]; We are getting proper currentNetwork information in the block. But when ssid is fetched from outside the block, it is getting invalid after the block exits. We are getting bad NSString object. This issue occurs only on iOS 15.5 beta version or later. Same code snippet worked perfectly for earlier versions of iOS. Can you help why it occurs only on iOS 15.5 or later versions? Note: Requirement according to https://developer.apple.com/forums/thread/679038 is fulfilled
3
0
806
Apr ’22
[NSString1 isEqualToString: NSString2] and [NSString UTF8String] crashes when it contains special characters ("_", "-", " ' ") only on iOS 15.5 or later
A framework is used in iOS application. In framework network change status is observed and callback code segment is something like this: NSString *initialAPName = nil; NSString* getSSID() { __block NSString *ssid = nil;     dispatch_semaphore_t sem = dispatch_semaphore_create(0);     [NEHotspotNetwork fetchCurrentWithCompletionHandler:^(NEHotspotNetwork * _Nullable currentNetwork) {       if( currentNetwork != nil) {         ssid = [currentNetwork SSID];       }       dispatch_semaphore_signal(sem);     }];     dispatch_time_t timeout = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC));     dispatch_semaphore_wait(sem, timeout);     return ssid; } static void onNotifyCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) { NSString *apName = getSSID(); if([apName isEqualToString:initialAPName]) { //Crashes here initialAPName = apName; } } Using of [NSString UTF8String] also crashes. The crash occurs only when apName contains special characters like (_, -, ') and it only occurs in iOS 15.5 or later.
3
0
877
Apr ’22
Get SSID of current network for iOS 15.5
Below snippet is used to fetch SSID of current network. __block NSString *ssid = nil; dispatch_semaphore_t sem = dispatch_semaphore_create(0); [NEHotspotNetwork fetchCurrentWithCompletionHandler:^(NEHotspotNetwork * _Nullable currentNetwork) {       if( currentNetwork != nil) {         ssid = [currentNetwork SSID];       }       dispatch_semaphore_signal(sem); }]; We are getting proper currentNetwork information in the block. But when ssid is fetched from outside the block, it is getting invalid after the block exits. We are getting bad NSString object. This issue occurs only on iOS 15.5 beta version or later. Same code snippet worked perfectly for earlier versions of iOS. Can you help why it occurs only on iOS 15.5 or later versions? Note: Requirement according to https://developer.apple.com/forums/thread/679038 is fulfilled
Replies
3
Boosts
0
Views
806
Activity
Apr ’22
[NSString1 isEqualToString: NSString2] and [NSString UTF8String] crashes when it contains special characters ("_", "-", " ' ") only on iOS 15.5 or later
A framework is used in iOS application. In framework network change status is observed and callback code segment is something like this: NSString *initialAPName = nil; NSString* getSSID() { __block NSString *ssid = nil;     dispatch_semaphore_t sem = dispatch_semaphore_create(0);     [NEHotspotNetwork fetchCurrentWithCompletionHandler:^(NEHotspotNetwork * _Nullable currentNetwork) {       if( currentNetwork != nil) {         ssid = [currentNetwork SSID];       }       dispatch_semaphore_signal(sem);     }];     dispatch_time_t timeout = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC));     dispatch_semaphore_wait(sem, timeout);     return ssid; } static void onNotifyCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) { NSString *apName = getSSID(); if([apName isEqualToString:initialAPName]) { //Crashes here initialAPName = apName; } } Using of [NSString UTF8String] also crashes. The crash occurs only when apName contains special characters like (_, -, ') and it only occurs in iOS 15.5 or later.
Replies
3
Boosts
0
Views
877
Activity
Apr ’22