开发者

How to check Gmail unread count with Cocoa Touch/Obj-C?

开发者 https://www.devze.com 2023-01-10 11:13 出处:网络
Is there an easy way to check a user\'s Gmail unread count from Cocoa Touch? I\'m not interested in sending or reading mail messages. I just want to periodically poll for the unread count. If there is

Is there an easy way to check a user's Gmail unread count from Cocoa Touch? I'm not interested in sending or reading mail messages. I just want to periodically poll for the unread count. If there is a way, could you please be as specific as possible in your answer?

EDIT: I changed the question from asking about just Cocoa to Cocoa Touch. Also, I'd like to be able to poll for any Gmail account, not just those on Google Apps domains. There is a Gmail Feed API (http://code.google.com/apis/gmail/docs/inbox_feed.html), but the docs say "Note: This feed is only available for Gmail开发者_JS百科 accounts on Google Apps domains".


You can use the PubSub framework to subscribe to an atom feed exposed by the Gmail Feed.

For the inbox, you would subscribe to: https://mail.google.com/mail/feed/atom/inbox E.g.:

PSClient *client = [PSClient applicationClient];
NSURL    *url    = [NSURL URLWithString:@"https://mail.google.com/mail/feed/atom/inbox"];
PSFeed   *feed   = [client addFeedWithURL:url];

[feed setLogin: username];
[feed setPassword: password];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号