- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想我的问题可能很幼稚,因为对象描述通常用于 NSLog 中的调试和输出。我也不得不承认我尝试使用 object.description 的方法可能是错误的。但是,我确实发现,描述中的信息正是我所需要的。如果我可以从描述中轻松取出零件。
好的,这是我的代码,我需要的是用户名(不是用户名):
self.facebookAccountStore = [[ACAccountStore alloc] init];
ACAccountType* facebookAccountType = [self.facebookAccountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
//[self.facebookAccountStore requestAccessToAccountsWithType:facebookAccountType withCompletionHandler:^(BOOL granted, NSError* e) {
[self.facebookAccountStore requestAccessToAccountsWithType:facebookAccountType options:facebookOptions completion:^(BOOL granted, NSError* e) {
if (granted) {
NSArray* accounts = [self.facebookAccountStore accountsWithAccountType:facebookAccountType];
self.facebookAccount = [accounts lastObject];
NSLog(@"acct description: %@", self.facebookAccount.description);
NSLog(@"acct type: %@", self.facebookAccount.accountType);
NSLog(@"acct credential: %@", self.facebookAccount.credential);
NSLog(@"acct identifier: %@", self.facebookAccount.identifier);
NSLog(@"acct username: %@", self.facebookAccount.username);
} else { //.....
}
acct description:
objectID: x-coredata://F8123001-FB33-48D4-B1A7-EXXXX1243XXXX/Account/p10
enabledDataclasses: {(
"com.apple.Dataclass.Contacts",
"com.apple.Dataclass.Calendars"
)}
enableAndSyncableDataclasses: {(
)}
properties: {
fullname = "LOOKAT HERE";
uid = 100004223213342323;
}
parentAccount: (null)
owningBundleID:(null)
type:com.apple.facebook
identifier: EF34399A-8577-459B-BE5E-FD12132SEDSFE
accountDescription: Facebook
username: pspped.ok@mailserver.com
最佳答案
解析 description
是错误的.这是错误的,因为描述没有记录格式。它可以从一个对象实例任意更改为下一个实例,也可以从一个操作系统版本任意更改为下一个版本。所以你的代码很可能会出错。依赖未记录的行为,您也违反了您与 Apple 签订的 iOS 开发者计划协议(protocol),该协议(protocol)赋予他们随时拉取您的应用程序的权利。
此外,如果出于某种原因您绝对不顾一切地使用未记录的 API,那么您不妨使用 [self.facebookAccount.description valueForKey:@"fullName"]
;它对操作系统的变化同样健壮,无需您再次猜测 Core Data 对象描述是如何输出的。
关于objective-c - iOS Objective-C : how can I get useful information out of object description?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12716946/
Win32 的 Delphi XE5 编译器具有新的调试信息设置:有限调试信息。 有限调试信息和调试信息有什么区别? 最佳答案 某些编译器提供调试标志的变体,可提供不同级别的调试信息和优化。根据编译和
我有一个 highcharts 散点图,我想添加一些自定义功能。对于每次单击 highcharts 中的项目(单击过滤器、数据点和关闭按钮),我想将有关单击的项目的信息发送到我在下面包含的函数“s”。
我们在 Java 应用程序中更新了安全证书,突然我们开始收到下面提到的异常: java.lang.SecurityException: class "org.hibernate.cfg.Configu
我正在使用 HttpURLConnection 实例来连接到 URL。 然后我调用 getResponseCode 方法以确定连接状态。 我正在使用此方法轮询连接,直到返回的响应代码不是 1xx: H
我很难调试 ASP.NET MVC 代码。我最终按照本 website 中的描述进行操作.调试符号已加载并适用于所有 dll,但 System.Web.MVC。当我双击 stacktrace 窗口中的
好吧,我在很多应用程序上都发现了这个文本,那就是当我安装一些应用程序时需要android.permission.READ_LOGS 权限,它们显示一些文本,例如“读取敏感日志数据的权限...”我不明白
我有一个在浏览器中运行并从 Javascript 调用的小程序。有 2 个类:PortalLauncher 和 ParamSplitter,它们位于默认包中。 Javascript 调用 Portal
我在 eclipse 中使用 OSGi 项目运行 JUnit 测试,我遇到了这个异常: java.lang.SecurityException: class "org.eclipse.core.run
我正在开发一个给 PDF 加水印的小工具,它适用于某些 PDF,但对某些其他 PDF 会崩溃。 我正在使用 iText 库和 bouncycaSTLe(依赖项) pom.xml:
很抱歉,我不知道这是否是属于mathoverflow的数学问题,还是属于这里的计算机科学问题。 就是说,我相信我理解基本的difference between data, information, a
在什么情况下“反文档频率”在信息检索中不起作用? 最佳答案 如果您不希望在系统中权衡稀有术语而不是频繁出现的术语,则可能不希望使用IDF。此外,计算idf是一项昂贵的操作。从以下事实可以明显看出这一点
我正在尝试计算 Average Precision (和 Mean Average Precision )在 Oxford Building image dataset 上. 下面是他们提供的用于计算
信息隐藏如何帮助解耦构成系统的模块? 最佳答案 封装(信息隐藏)允许您只向外界公开绝对最小值。这意味着您可以在不影响客户的情况下将未公开的位更改为您心中的内容。 一个例子。假设您已经实现了一个将字符串
想象一下,在接下来的 10 年里,你拥有世界上所有的 super 计算机。你的任务是尽可能无损地压缩 10 部完整的电影。另一个标准是普通计算机应该能够即时解压缩,并且不需要花费太多的 HD 来安装解
我生活在一个每年更改两次时间的国家。即:一年中有一段时期与 UTC 的偏移量为 -3 小时(-180 分钟),其他时期的偏移量为 -4 小时(-240 分钟) 从图形上看: |-----
在哪里可以找到有关 DrRacket 中 #:when 构造的文档? 这是完整的示例: (define (problem_9 sum) (for*/first ([c (in-range 3 (-
有人知道在网站上查找最相关的联系信息的脚本/食谱/库吗? 一些可能的情况: 在个人网页上查找联系电话号码 在博客上查找所有者电子邮件地址 查找联系页面的网址 最佳答案 查看WSO2's Mashup
你们如何管理信息溢出?你们都用什么工具?有用的工具之一是 RSS 提要阅读器。是否有任何机构使用任何其他工具或任何其他方式来有效管理信息? 最佳答案 做一个信息势利小人。 如果该博客没有绝对震撼您的世
我最近根据 Artima Inside the JVM 2-nd Ed 阅读了有关 JVM 规范的内容。其中一章提到了 Java 运行时中的类型存储,内容如下: An instance of clas
我已阅读 Permuterm indexes stanford 网站上的页面,但是我仍然无法弄清楚我们如何从以下地址到达:*X*至 X* . 那么$在哪里? ? 我可以得到这些: For X, loo
我是一名优秀的程序员,十分优秀!