8

I'm setting up an iMessage app for iOS 10 that requires a logging in to a social network. In traditional iOS apps we normally configure a shared instance with app id in the AppDelegate...and I also need to handle call back URLs: 2 methods (below) also traditionally placed in the AppDelegate.

With an iMessage app/extension, there is no AppDelegate. Where can I place this code? I was able to configure with app ID in willBecomeActive on MessagesViewController and did receive an instance back, however I also put these methods in MessagesViewController with break points and they are never called, which I believe is preventing my successful log in. Any help is much appreciated!

Update: my biggest issue, even before figuring out how to handle the callBack is how not having an openURL method available, there are a few posts on ways around this in extensions but I wasn't successful with any of the proposed solutions: openURL not work in Action Extension

As I see it I either need to (1) find a way to call openURL in my iMessage Extension so that I can let the SDK handle the OAuth (2) create my own webview, push to the website, log the user in, store the token and segue back to my app (seems unnecessary) or (3) create an iPhone app, just for the purpose of logging in (i.e. iMessage extension open's parent application and logs in), again seems unnecessary). Surely this is going to be commonplace in iMessage extensions?

func application(application: UIApplication, handleOpenURL url: NSURL) -> Bool {
}

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {   
}
mugx
  • 9,869
  • 3
  • 43
  • 55
GarySabo
  • 5,806
  • 5
  • 49
  • 124

0 Answers0