简体   繁体   English

如何从Xcode读取iPhone Exchange帐户名?

[英]How do I read iPhone Exchange Account Name from Xcode?

I want to be able to read the names of the exchange accounts. 我希望能够读取交换帐户的名称。

ABSource objects only have 2 properties from what i could tell.One of them is an integer specifying the type of source(ex: 0 for local addressbook, 1 for exchange addressbook) and the other is a string specifying the name of the source.Unfortunetely the name of the source will not be the name of your exchange account,it will always be called "Contacts".The problem is that if you would save all the sources in an array and when writing a contact to a specific source you would acces it from there it will work...it will add it to the right source,my problem is i want to be able to select which account to add to from a table view and so far have found no way of differentiating the accounts. 据我所知,ABSource对象仅具有2个属性。一个是整数,它指定了来源的类型(例如,本地地址簿为0,交换地址簿为1),另一个是指定来源名称的字符串。来源的名称将不是您的交换帐户的名称,它始终被称为“联系人”。问题是,如果您将所有来源保存在数组中,并且在将联系人写入特定来源时可以访问从那里它会工作...它将把它添加到正确的来源,我的问题是我希望能够从表视图中选择要添加到哪个帐户,到目前为止,还没有找到区分这些帐户的方法。

Yes, for some Exchange accounts (and other types of accounts) it seems like there is no way to get any other name except "Contacts". 是的,对于某些Exchange帐户(和其他类型的帐户),除了“联系人”外,似乎没有其他名称。

What you should do is: 您应该做的是:

Create a separate object that holds the ID and name of the source and has a boolean which tracks whether this account has been selected. 创建一个单独的对象,该对象包含源的ID和名称,并具有一个布尔值,该布尔值跟踪是否已选择此帐户。 Hold these objects within the array that is responsible for populating the UITableView. 将这些对象保存在负责填充UITableView的数组中。 When the user selects a source, modify the boolean and at the end, when you want to know what the user selected, go through the array and select only the IDs from the objects that have been selected. 当用户选择一个源时,修改布尔值,最后,当您想知道用户选择了什么时,遍历数组并仅从已选择的对象中选择ID。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM