Redeem Now
Read More
Read now

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

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.

 

 

 

 

 

 

 

 

 

 

. . .

Comments (2)

Add Your Comment

  • rey
    thank you for your share, this article is very useful for me. thanks again.
    • anchit
      Your Welcome
  • css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close