How to use SafariViewcontroller as Callback on some URL in Objective C

Updated 1 December 2017

Save

Callback on some URL

Sometimes we need to use the browser for open authentication process like payment or sign in or other things for this we provide the response URL on success or failure through which identify when we have to close the safari.

Here I have taken a basic example where we are are creating the “test.html” file  and we are returning the custom URL look like:

Here  “freedomofkeima” is a URL Schemes.

After that you can set the response data to depend upon your need:

2: Now test.html file put into your MAMP’s htdocs folder.

3 :Now your local URL is:

“http://localhost:8888/test.html

4: Now start the Objective C code:

5: Here first create NSNOtification when it will throw the response:

6: Now launch the Safari:

 

 

Now Define the callback method:

 

 

7: Now go to Appdelegate.m file and write this one:

8: Now when you run this app this track your custom URL.

 

 

 

 

 

 

 

 

 

 

author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


2 comments

  • rey
    • anchit (Moderator)
  • Start a Project


      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home