0

I am creating an SDK(static library) which would be used by the clients in their apps.

What this SDK helps them achieve is, open a set of pages, do some activity and come back to the app with the response from the webpages. How I am doing this is, opening the URL in SFSafariWebViewController and sending a returnTo URL as part of the parameters. This returnTo URL is registered with the app using CFBundleURLSchemes. The final page redirects back to the returnTo URL with the response parameters.

As per the developers.app website I need to implement the below method in AppDelegate to handle to callback to the returnTo URL.

application:(UIApplication *)application
          openURL:(NSURL *)url 
sourceApplication:(NSString *)sourceApplication
          annotation:(id)annotation`

But I want to handle the URL in the library code(SDK) and not in the AppDelegate of the client's app.

I neither want to create a custom AppDelegate and force the SDK's client to use it in their app nor I want him to call one of my SDK's methods inside the openURL implementation of app's AppDelegate.m.

I appreciate the help, thanks.

SiHa
  • 7,830
  • 13
  • 34
  • 43
  • Why you are not asking client's app to handle open URL with your library code in Client appDelegate Class ? any specific reason ? – CodeChanger Jan 16 '17 at 12:49
  • Famous SDK's like FacebookMessenger SDK for iOS handle it through `AppDelegate` only. I believe that it's not a bad practice to give a method and ask the user to implement in `AppDelegate` – KrishnaCA Jan 16 '17 at 12:49
  • @CodeChanger - I did not want the client's app to get handle of the URL which includes Query parameters he might temper with, but it seems the only way so I went ahead with the same. – Ankit Srivastava Apr 17 '17 at 22:11
  • @KrishnaCA Yeah I realized that, hence used the same. Thanks! – Ankit Srivastava Apr 17 '17 at 22:12

0 Answers0