Posts

Post not yet marked as solved
0 Replies
2.3k Views
Hi, I updated device to iOS 13 beta 3 and facing issue with saveToPreferencesWithCompletionHandler.I have multiple VPN profiles and when I enable one of the profile it failed with error "Failed to save configuration: Error Domain=NEVPNErrorDomain Code=4 "configuration is stale" UserInfo={NSLocalizedDescription=configuration is stale}"Also i saw below error in console logs few times."Last disconnect error for x.x.x.x changed from "none" to "The VPN session failed because an internal error occurred."As mentioned in this link https://forums.developer.apple.com/thread/25928 I have tried following suggestionsCall saveToPreferencesWithCompletionHandler twiceCalling loadFromPreferences again right after saveToPreferencesCalling loadFromPreferences before saveToPreferencesDisable all configs and saveToPreference then enable required config and saveToPreferenceStill i'm seeing the same issue.Also when the profile is not saved properly, VPN is stuck at connecting for the first attempt. But VPN will connect successfully for the next attempts.Observed same behaviour in iPadOS as well.This is how i'm saving profile.[m_configurations enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { BOOL isManagerEnabled = (m_enabledIdx == idx); NEVPNManager *manager = (NEVPNManager *)m_configurations[idx]; [manager loadFromPreferencesWithCompletionHandler:^(NSError * _Nullable error) { if (!error) { manager.enabled = isManagerEnabled; [manager saveToPreferencesWithCompletionHandler:^(NSError * _Nullable error) { if (isManagerEnabled) { if (error) { NSLog(@"Error while enabling the configuration at index %ld %@", (long)m_enabledIdx, error); } else { NSLog(@"Index of enabled configuration is %ld", (long)m_enabledIdx); } } else { if (error) { NSLog(@"Error while disabling the configuration at index %d", idx); } } }]; } }]; }];Thanks in advance
Posted Last updated
.