Opening my app from a Reminder on IOS using objective C
Asked Answered
P

1

7

I have created an app that creates a reminder, adds a alarm with a structured location, and sets the URL to be my app. My intention is that when the user sees this reminder on their phone and they click on it, it should open my app. But this doesn't seem to be working.

What is working is that my app does create the reminder, it is geofenced, it is just that when the user clicks on the reminder they are taken to the IOS calendar and not my app.

Here's the code that I used to set the reminder URL:

  NSString* url = [NSString stringWithFormat: @"HealthTracker://"];
  self.reminder.URL = [NSURL URLWithString: url];

I also updated the URL schemes in the pinfo.list to contain the name of the app.

Screenshot of pinfo.list

Is there something else I should be doing?

I am targeting IOS 9.1 and using my IPhone 6 to test this.

Palladio answered 5/5, 2016 at 23:59 Comment(0)
A
6

Unlike calendar entries, reminders don't support URLs. Run the Reminders app and there is no way to add a URL.

The EKReminder has a URL property (inherited from CKCalendarItem) but the Reminders app itself doesn't support a URL.

I ran into the same problem and ended generating a Calendar event so the user can open my app from the event.

I submitted an enhancement request to Apple asking for the Reminders app to support URLs. Maybe in iOS 10.

Agree answered 6/5, 2016 at 0:7 Comment(8)
Do you have a radar for this enhancement? Did you post it on open radar?Navigate
@Navigate Mine was closed as a duplicate of another (10870474 - which is still open). I did not also post on open radar.Agree
@Palladio Your app opening other apps is irrelevant to this issue. You just need to make sure that your app properly registers the HealthTracker scheme. And your Info.plist indicates you are not setup correctly. Select the Info tab for your target in Xcode and go down to the "URL Types" section. You need to provide your app id, icon, url scheme, and role.Agree
Thanks @rmaddy. My app also creates events. I added this to the events it creates and it indeed fills out the URL section now. However the calendar app doesn't open my app when you click on the URL. It just appears as text instead. In another part of my app I have code that launches the Google Maps and Apple Maps programs. To open an app there I have this line of code: BOOL opened = [[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]]; Does your code have anything that opens an app? Or is it a regular URL like maps.com?Palladio
Seems you deleted and reposted your comment. See my previous comment.Agree
@Agree thanks for the info. I updated my apps info tab per your suggestion. I am able to launch my app from another one of my apps now. However, the icalendar still only shows HealthTracker:// in its URL section as text and doesn't launch my app. When you put the URL in the event, do you need to do anything besides just setting the URL like so where HealthTracker is the URL scheme I've registered: NSString* url = [NSString stringWithFormat: @"HealthTracker://"]; self.event.URL = [NSURL URLWithString: url];Palladio
Provide more of a URL in the calendar event such as HealthTracker:///launch.Agree
As of macOS 10.5 Catalina, the macOS Reminders app does allow adding a URL to a reminder in the GUI but when querying the EKReminder instance in code for the URL property, it still returns nil.Rhythmist

© 2022 - 2024 — McMap. All rights reserved.