Pergunta

I am using the WeChat SDK to share some of my app's content to WeChat. From my observation, the sharing feature launches the WeChat app with UIApplication openURL. A corner case that the WeChat developers did not handle was to show a warning when the WeChat app is not installed at all. I want to handle this case myself by first checking canOpenUrl with the same URL passed into openURL. Unfortunately, I do not know the WeChat URL scheme because I only have their header and compiled files. Is there any way to intercept any openURL calls to figure out what URL is being opened?

Foi útil?

Solução

Subclass UIApplication and have the app use your subclass. In your subclass, override openURL: and add your logic. When you're happy to continue with the open operation, call [super openURL:...];.

Teach the app to use your custom subclass by editing the main.m file:

return UIApplicationMain(argc, argv, NSStringFromClass([XXApplication class]), NSStringFromClass([XXAppDelegate class])); 

(Assuming XXApplication is your app subclass and XXAppDelegate is your app delegate class, and remembering to import the appropriate headers)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top