我正在尝试确定哪一个EKEvent's
参加者(EKPartipants
) 是当前用户。在iOS6中,EKParticipant
公开一个名为 isCurrentUser 的属性
http://developer.apple.com/library/ios/#documentation/EventKit/Reference/EKParticipantClassRef/Reference/Reference.html#//apple_ref/occ/cl/EKParticipant http://developer.apple.com/library/ios/#documentation/EventKit/Reference/EKParticipantClassRef/Reference/Reference.html#//apple_ref/occ/cl/EKParticipant
它应该准确地提供这些信息。不幸的是,每次我查找EKParticipant's
isCurrentUser
属性,它返回 NO,即使情况显然并非如此。
任何帮助将非常感激!
更新的发现:
如果您查找活动组织者,它会正确返回isCurrentUser == YES
如果你是组织者。但是,如果您从与会者集中检索自己,它就会返回isCurrentUser == NO
.
控制台输出示例,其中两个不同的 EKParticipant 对象引用具有相同电子邮件地址的同一个人:
(lldb) po [ekEvent.attendees objectAtIndex:3]
$20 = 0x208c1220 EKAttendee <0x208c1220> {UUID = CCD17C5E-FCB5-4BC9-8D9E-7E957B20025D;
name= ----- -----; email = [email protected] /cdn-cgi/l/email-protection; status = 2; role = 0; type = 1}
(lldb) print [(EKParticipant *)[ekEvent.attendees objectAtIndex:3] isCurrentUser]
(BOOL) $15 = NO
(lldb) po ekEvent.organizer
$19 = 0x20b720e0 EKOrganizer <0x20b720e0> {UUID = FD0E434D-2C9F-4A6E-98DC-
7FA6F27C3D1E; name = ----- -----; email = [email protected] /cdn-cgi/l/email-protection; isSelf = 1}
(lldb) print ekEvent.organizer.isCurrentUser
(BOOL) $16 = YES
默认情况下,活动组织者不在与会者列表中,您需要明确将他添加为与会者。
组织者被认为与与会者不同,并用属性组织者来描述。如果您使用该对象访问 isCurrentUser ,它将为您提供值 Yes。
如果您明确将组织者电子邮件 ID 添加为与会者,则会将其视为不同的用户,因此您需要比较与会者 URL 并进行检查。
示例:用户[电子邮件受保护] /cdn-cgi/l/email-protection组织一次会议或活动并受邀[电子邮件受保护] /cdn-cgi/l/email-protection那么在参加者中你将只有[电子邮件受保护] /cdn-cgi/l/email-protection and [电子邮件受保护] /cdn-cgi/l/email-protection将作为组织者提供。
如果您添加[电子邮件受保护] /cdn-cgi/l/email-protection作为与会者,则其属性 isCurrentUser 为 No,您可以通过将与会者 URL 字符串本身与组织者进行比较来进行检查。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)