SFSafariViewController throws an uncatchable exception when passed a URL without a scheme
Originator: | mikeg | ||
Number: | rdar://28916844 | Date Originated: | 24-Oct-2016 12:33 PM |
Status: | Duplicate | Resolved: | 26-Oct-2016 03:22 AM |
Product: | iOS SDK | Product Version: | |
Classification: | Reproducible: |
Summary: When creating a SFSafariViewController object, giving it a valid URL that has a blank scheme (or any scheme other that http or https), it will crash the app with a 'NSInvalidArgumentException' exception. This exception can not be caught (at least in Swift, I haven't tested it in ObjC). Steps to Reproduce: 1. Open example playground 2. Press play Expected Results: The log should print "Caught an exception!" Actual Results: The execution crashes with the following log: 2016-10-24 12:21:04.695 SafariVC[2072:141013] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'The specified URL has an unsupported scheme. Only HTTP and HTTPS URLs are supported.' *** First throw call stack: ( 0 CoreFoundation 0x000000010391d34b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x000000010337e21e objc_exception_throw + 48 2 CoreFoundation 0x0000000103986265 +[NSException raise:format:] + 197 3 SafariServices 0x0000000111869a1b -[SFSafariViewController initWithURL:entersReaderIfAvailable:] + 465 4 ??? 0x000000010fba932e 0x0 + 4558852910 5 ??? 0x000000010fba92d6 0x0 + 4558852822 6 ??? 0x000000010fba9187 0x0 + 4558852487 7 SafariVC 0x0000000102da7620 main + 0 8 CoreFoundation 0x00000001038c225c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12 9 CoreFoundation 0x00000001038a7304 __CFRunLoopDoBlocks + 356 10 CoreFoundation 0x00000001038a6a75 __CFRunLoopRun + 901 11 CoreFoundation 0x00000001038a6494 CFRunLoopRunSpecific + 420 12 GraphicsServices 0x0000000108cb1a6f GSEventRunModal + 161 13 UIKit 0x0000000104450f34 UIApplicationMain + 159 14 SafariVC 0x0000000102da76e9 main + 201 15 libdyld.dylib 0x0000000106dfe68d start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException Version: Xcode 8, Swift 3 Notes: Configuration: Xcode 8, Swift 3 Attachments: 'SafariVC.playground.zip' was successfully uploaded. Linked Playground code: https://gist.github.com/pocketsevens/2c415ad792e5e21a042f9d2555d60c84
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Marked as Duplicate of 26328052.