Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you debug your application if they got started using a custom URL scheme?

I'm developing an app for the iPhone, but I guess the question is the same on the Mac. What is your approach to debug the state of your application after it has been launched by its URL scheme?

like image 993
stigi Avatar asked Jan 17 '09 22:01

stigi


People also ask

How do I find the URL scheme of an app?

Go to the Play store, find the app and view its page. Copy the URL from the browser address bar. Make a note of this as the "Android Fallback URL." You'll see a parameter called "id" followed by an equal sign (=).

What is a custom URL scheme?

Custom URL schemes provide a way to reference resources inside your app. Users tapping a custom URL in an email, for example, launch your app in a specified context. Other apps can also trigger your app to launch with specific context data; for example, a photo library app might display a specified image.


2 Answers

There is a way to debug your application when it is launched from an external URL:

  1. Set a breakpoint where you want it in application:handleOpenURL: or application:didFinishLaunchingWithOptions:
  2. In Xcode, edit the Active Executable's settings. On the Debugging tab, select the "Wait for next launch/push notification" checkbox.
  3. Build and Debug. The Console will give you an alert saying "Waiting for [AppName] to launch... The debugger will attach to [AppName] the next time it is launched."
  4. Open your app by invoking a custom URL or sending it a push notification. The debugger will stop at your breakpoint.
like image 135
Ole Begemann Avatar answered Nov 21 '22 01:11

Ole Begemann


I'm on Xcode 8.2.1 and the fastest way is to simply go to Product -> Edit Scheme and select “Wait for executable to be launched” like the image below. When debugging started, it will not launch the app but "waiting for "THE APP" to launch..". When an action (click on the push notification), the breakpoint will kick in.

enter image description here

like image 20
TPG Avatar answered Nov 21 '22 01:11

TPG