0 Replies
      Latest reply on Jul 5, 2019 2:47 AM by Kavyashree Hegde
      Kavyashree Hegde Level 1 Level 1 (0 points)

        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 suggestions

        1. Call saveToPreferencesWithCompletionHandler twice
        2. Calling loadFromPreferences again right after saveToPreferences
        3. Calling loadFromPreferences before saveToPreferences
        4. Disable all configs and saveToPreference then enable required config and saveToPreference


        Still 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);
                                            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