8 Replies
      Latest reply: May 3, 2017 10:05 AM by TheCD RSS
      manMV Level 1 Level 1 (0 points)

        In iOS 10, do not open settings:

        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];

        What is the problem?

        • Re: UIApplicationOpenSettingsURLString
          Nandu_MD Level 1 Level 1 (0 points)

          I am facing the same problem opening the Settings app with below code, my app simply crashes while it is trying to open Settings app.

           

          [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:nil];

            • Re: UIApplicationOpenSettingsURLString
              pdm Apple Staff Apple Staff (1,680 points)

              What exactly is the crash you see?  I just tried this in a test app and it seemed to work fine. 

                • Re: UIApplicationOpenSettingsURLString
                  Nandu_MD Level 1 Level 1 (0 points)

                  Thanks for the reply.

                   

                  In my app I was trying to launch Apple "Settings" app with above-mentioned code it works fine on iOS 9.x.x and earlier, however on iOS 10.1.1 and 10.2, my app tries to launch and Apple "Settings" app in that process it goes into background and while Apple "Settings" app is about to launch it crashes

                   

                  Process:               Preferences [5389]

                  Path:                  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/Applications/Preferences.app/Preferences

                  Identifier:            Preferences

                  Version:               1 (1.0)

                  Code Type:             X86-64 (Native)

                  Parent Process:        launchd_sim [5302]

                  Responsible:           Preferences [5389]

                  User ID:               501

                   

                  Date/Time:             2016-12-13 15:42:39.413 -0800

                  OS Version:            Mac OS X 10.12.1 (16B2555)

                  Report Version:        12

                  Anonymous UUID:        76E9BE6A-ACFC-5C32-D0AC-D0534FCE4A40

                   

                  Sleep/Wake UUID:       06CAF827-9781-41E2-AD07-B7E6EF075396

                   

                  Time Awake Since Boot: 19000 seconds

                  Time Since Wake:       9600 seconds

                   

                  System Integrity Protection: enabled

                   

                  Crashed Thread:        0  Dispatch queue: com.apple.main-thread

                   

                  Exception Type:        EXC_CRASH (SIGABRT)

                  Exception Codes:       0x0000000000000000, 0x0000000000000000

                  Exception Note:        EXC_CORPSE_NOTIFY

                   

                  Application Specific Information:

                  *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSBundle initWithURL:]: nil URL argument'

                  terminating with uncaught exception of type NSException

                  abort() called

                  CoreSimulator 338.16 - Device: iPad Air 2 - Runtime: iOS 10.2 (14C89) - DeviceType: iPad Air 2

                   

                   

                  Application Specific Backtrace 1:

                  0   CoreFoundation                      0x0000000108738d4b __exceptionPreprocess + 171

                  1   libobjc.A.dylib                     0x0000000108b3a21e objc_exception_throw + 48

                  2   CoreFoundation                      0x00000001087a22b5 +[NSException raise:format:] + 197

                  3   Foundation                          0x000000010bd0221d -[NSBundle initWithURL:] + 87

                  4   Foundation                          0x000000010bd021b3 +[NSBundle bundleWithURL:] + 45

                  5   PreferencesUI                       0x000000010902263b -[PSUIPrefsListController _reallyLoadThirdPartySpecifiersForApps:withCompletion:] + 821

                  6   PreferencesUI                       0x00000001090221e2 -[PSUIPrefsListController loadThirdPartySpecifierIfNeededForBundleID:] + 452

                  7   Preferences                         0x00000001085bd17d Preferences + 37245

                  8   Preferences                         0x00000001085ba9b5 Preferences + 27061

                  9   UIKit                               0x000000010cdb9898 __45-[UIApplication _applicationOpenURL:payload:]_block_invoke + 1005

                  10  UIKit                               0x000000010cdb91e6 -[UIApplication _applicationOpenURL:payload:] + 757

                  11  UIKit                               0x000000010cda70cc -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 5137

                  12  UIKit                               0x000000010cdad0ed -[UIApplication _runWithMainScene:transitionContext:completion:] + 1731

                  13  UIKit                               0x000000010cdaa26d -[UIApplication workspaceDidEndTransaction:] + 188

                  14  FrontBoardServices                  0x000000010911f6cb __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24

                  15  FrontBoardServices                  0x000000010911f544 -[FBSSerialQueue _performNext] + 189

                  16  FrontBoardServices                  0x000000010911f8cd -[FBSSerialQueue _performNextFromRunLoopSource] + 45

                  17  CoreFoundation                      0x00000001086dd761 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17

                  18  CoreFoundation                      0x00000001086c298c __CFRunLoopDoSources0 + 556

                  19  CoreFoundation                      0x00000001086c1e76 __CFRunLoopRun + 918

                  20  CoreFoundation                      0x00000001086c1884 CFRunLoopRunSpecific + 420

                  21  UIKit                               0x000000010cda8aea -[UIApplication _run] + 434

                  22  UIKit                               0x000000010cdaec68 UIApplicationMain + 159

                  23  Preferences                         0x00000001085b694f Preferences + 10575

                  24  libdyld.dylib                       0x000000010f09368d start + 1

                   

                   

                  Thread 0 Crashed:: Dispatch queue: com.apple.main-thread

                  0   libsystem_kernel.dylib         0x000000010f3bcdda __pthread_kill + 10

                  1   libsystem_pthread.dylib       0x000000010f3f4787 pthread_kill + 90

                  2   libsystem_c.dylib             0x000000010f136fd7 abort + 129

                  3   libc++abi.dylib               0x000000010ef0f95a abort_message + 266

                  4   libc++abi.dylib               0x000000010ef34cff default_terminate_handler() + 267

                  5   libobjc.A.dylib               0x0000000108b3a49f _objc_terminate() + 103

                  6   libc++abi.dylib               0x000000010ef31e69 std::__terminate(void (*)()) + 8

                  7   libc++abi.dylib               0x000000010ef31af4 __cxa_rethrow + 99

                  8   libobjc.A.dylib               0x0000000108b3a3b7 objc_exception_rethrow + 40

                  9   com.apple.CoreFoundation       0x00000001086c190b CFRunLoopRunSpecific + 555

                  10  com.apple.UIKit               0x000000010cda8aea -[UIApplication _run] + 434

                  11  com.apple.UIKit               0x000000010cdaec68 UIApplicationMain + 159

                  12  com.apple.Preferences         0x00000001085b694f 0x1085b4000 + 10575

                  13  libdyld.dylib                 0x000000010f09368d start + 1

                  • Re: UIApplicationOpenSettingsURLString
                    vkore Level 1 Level 1 (0 points)

                    I am also facing same issue in iOS 10, when I try to open settings app from my app it will crash. here is the crash logs

                     

                    Code:

                     

                                                        NSURL *url1 = [NSURL URLWithString:UIApplicationOpenSettingsURLString];

                                                          [application openURL:url options:@{} completionHandler:nil];

                     

                    BSMachError: port 7f03; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND"

                    _BSMachError: port 7f03; (os/kern) invalid name (0xf) "Unable to deallocate send right"

                     

                     

                     

                    but if I use     NSURL *url = [NSURL URLWithString:@"App-Prefs::root=Settings"];

                                                                UIApplication *application = [UIApplication sharedApplication];

                                                                [application openURL:url options:@{} completionHandler:nil];


                    It works in iOS10

                • Re: UIApplicationOpenSettingsURLString
                  KiranSalke333 Level 1 Level 1 (0 points)

                  Do we have any resolution for this ? I am facing the same issue

                   

                  Is there any bug logged with apple for the same ?