I am developing a Cocoa Touch Framework, I want to receive remote notifications from APNS and I found that (after all the process it needs to establish communication with APNS) I have to catch notifications inside application:didReceiveRemoteNotification:fetchCompletionHandler:
method. However, I want to let the less work possible to the IOS developer, so I been wondering.
I would say it's not needed. What you can do here is create some function in your with the same params as in application:didReceiveRemoteNotification:fetchCompletionHandler:
and make it available for the possible developer to call from your Framework.
Many frameworks are working that way like FacebookSDK. For example, my code in AppDelegate for opening/handling URL:
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
let fbHandled: Bool = ApplicationDelegate.shared.application(app,
open: url,
sourceApplication: options[.sourceApplication] as? String,
annotation: options[.annotation])
return fbHandled
}
You could see that Facebook just provide me some public methods to handle links inside their SDK. It's a better solution than make implicit handling for something that the developer might be needed aware of and be available to change in his code.