0

When I tried to get remote notifications, I made a mistake that using UIApplicationLaunchOptionsLocalNotificationKey as the LaunchingOptions dictionary's key to get information. But it all works well on my real iPhone(10.2).

enter image description here

I can tap the remote notification to launch my app. Why is that?

ItamarG3
  • 4,092
  • 6
  • 31
  • 44
H.Shane
  • 11
  • 4
  • Both of them do go to a server, and can get a notification when done... you can look at the Apple Docs: https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ – Burnie777 Jun 26 '17 at 09:56
  • Would you please give me a comprehensive explanation? I really got messed up with it. Plus, I couldn't find out that local notification go to a server , too, in the Apple Docs. Really need your help, thank you! – H.Shane Jun 26 '17 at 13:16

1 Answers1

0

In the link I shared there is a part:

When to Use Local and Remote Notifications

Because apps on iOS, tvOS, and watchOS are not always running, local notifications provide a way to alert the user when your app has new information to present. For example, an app that pulls data from a server in the background can schedule a local notification when some interesting piece of information is received. Local notifications are also well suited for apps such as calendar and to-do list apps that need to alert the user at a specific time or when a specific geographic location is reached.

Remote notifications are appropriate when some or all of the app’s data is managed by your company’s servers. With remote notifications, you decide when you want to push a notification to the user’s device. For example, a messaging app would use remote notifications to let users know when new messages arrive. Because they are sent from your server, you can send remote notifications at any time, including when the app is not running on the user’s device.

Burnie777
  • 395
  • 5
  • 18
  • I've always thought that a local notification just stay in the system. Thank you! Still, yet, why can I use LocalNotificationKey to get a remote notification dic? – H.Shane Jun 26 '17 at 13:54
  • I am unsure about this, will have to look, however I think it has to do with the dictionary being the same no matter what type of notification it is... Local and Remote is the iOS derivatives, but on the webserver there is no difference – Burnie777 Jun 26 '17 at 13:58
  • It's an odd case, but I've learnt some from your answers from you. Thank you ! Pls share me the answer when figure it out. I appreciate your help)))) – H.Shane Jun 26 '17 at 14:11
  • Pleasure... will do... you can upvote and mark best if it helped you – Burnie777 Jun 26 '17 at 16:37
  • Sorry, I'm a beginner.... already did that. – H.Shane Jun 27 '17 at 00:39