문제

My iOS application includes sending emails as part of its functionality. MFMailComposeViewController allows in-app composition of an email, with the OS using Mail.app in the background to send the message. However, I want to allow users to send an email with the Gmail app for iOS if they so choose.

Since remote view controllers aren't public API, the only way this would be possible is with a URL handler, but I couldn't find one documented online anywhere. Does anyone know of one? If there is one, is it publicly acknowledged by the Gmail team (i.e. do they consider it public API, or are they using it only between Chrome and Gmail and aren't quite ready to take the wrapping paper off)?

도움이 되었습니까?

해결책

Silly me, I didn't finish doing my research. Once I opened up the Gmail app's .ipa and found googlegmail as a listed CFBundleURLTypes in the Info.plist, the web turned up a few great resources for this:

  1. Finding the Gmail URL scheme for iOS
  2. Finding the Gmail URL scheme for iOS: Part 2
  3. handleOpenURL: Shared Interapp Communication! has a searchable list of URL handlers.

Long story short, this worked on my iPhone 5 running iOS 7.0 and Gmail for iOS v2.4.1, and opened a compose pane in the Gmail app, even when the app had been explicitly killed:

googlegmail:///co?subject=Hello&body=Hi

I'm still looking for confirmation that this is considered a public API of Gmail. Does anyone have any knowledge about how the Gmail team feels about this?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top