Is there a URL handler for Gmail for iOS to compose a message?

给你一囗甜甜゛ 提交于 2019-12-10 14:16:05

问题


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)?


回答1:


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?



来源:https://stackoverflow.com/questions/19281933/is-there-a-url-handler-for-gmail-for-ios-to-compose-a-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!