The basic workflow is correct, and you have several ways to achieve what you want:
Gmail API , which is a RESTful API that can be used to access Gmail mailboxes and send mail. The API supports many of the basic operations available through the Gmail user interface, such as reading, composing, and sending mail. It also allows you to manage tags on streams and messages and request specific messages and streams.
You can write your own Objective-C wrapper around the API to make the correct HTTP request for the different endpoints described in the API link but this is a lot of work, you need to write everything you need, error management, validation, etc.
You can use the Google API client library for Objective-C recommended for accessing the JSON APIs for iOS and Mac OS X applications. This API includes support for many Google products, including Gmail.
The IMAP and SMTP protocols are supported by Gmail and include OAuth 2.0 authorization.
- You can use any existing IMAP and SMTP libraries that support SASL, and you must be compatible with the GAS-supported SASL XOAUTH2 mechanism. You can use MailCore , for example, as you expected.
It seems to me that you are looking for the easiest way to interact with Gmail mailboxes, so the Gmail API is the best choice for authorized access to Gmail user data.
I would go for the Google API client library for Objective-C , so you donโt have to write your own wrapper around the API and can use it out of the box.
You saw the python sample code for fetching the streams page:
threads = gmail_service.users().threads().list(userId='me').execute()
The Google APIs client library for Objective-C will give you ways to do the same with several parameters, such as the ability to include spam and a garbage basket in the results, the maximum number of results, finding a stream that matches a specific request, etc.
+ (id)queryForUsersThreadsList;
All actions described in the API reference are supported by the Google API Client Library for Objective-C.
Hideo source share