Call to canOpenURL always prints an error message even when URL scheme properly registered

Number:rdar://22384079 Date Originated:08/21/2015
Status:Closed Resolved:Won't Fix
Product:iOS Product Version:iOS 9 beta 5
Classification:Performance Reproducible:Always
Previously I opened up bug #21360800 to report the increased amount of time it takes to call canOpenURL in iOS 9. It was closed saying that it was intentional.

The other thing that I mentioned in that bug that wasn't addressed was the unnecessary error message that is output on the console when you call canOpenURL. 

In iOS 9 when you call canOpenURL on a URL (even one that is properly registered in the app's Info.plist under LSApplicationQueriesSchemes), it will always print out the following error message if they app is not installed:

-canOpenURL: failed for URL: "whatsapp://" - error: "(null)"

The fact that canOpenURL returns false because the app isn't installed is not an error and printing a message out on the console is not needed and in certain circumstances can impact the performance of apps.

I have an app launching app which checks about 4,000 different custom URL schemes on startup to see which apps the user has installed in order to allow the user to easily set up launchers for their apps. Every time my app starts, it spends over 2 minutes printing out over 4,000 of these error messages on the console as the custom URL schemes are checked in the background. This makes debugging the app extremely difficult since I need to wait 2 minutes to see any valid console output every time I am testing something on my app. In addition, if these error messages are still printed out when iOS 9 is out, there is an actual impact on performance and unnecessary CPU cycles spent on printing out 4,000 error messages every time my app is started.

I'm hoping that this error message is only going to be in the iOS 9 betas and will be removed before the iOS 9 GM release.

Steps to Reproduce:
1. Register 10 custom URL schemes in Info.plist under LSApplicationQueriesSchemes.
2. Write code in an app to call canOpenURL on those 10 custom URL schemes.
3. Note that you get an error message for each call.

Expected Results:
canOpenURL returning false lets you know that the app is not installed and there is no need to also print out a message to the console.

Actual Results:
Calling canOpenURL when it returns false prints out an unnecessary error message


Apple closed this with no comment

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at 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!