2011-12-13 79 views
1

我的应用程序正在通过URL启动,我已经添加了以下方法,该方法将在发射被调用:如何将(id)参数转换为属性列表对象?

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation 

注释被描述为由源应用程序提供的属性列表对象。我想检查内容,看看源应用程序提供的信息/数据。我怎样才能做到这一点?

谢谢

回答

2

没有必要到annotation变量从id转换成别的东西。只需直接调用该对象支持的任何方法即可。

Property lists可以是数组,字典,字符串,数字,布尔值,日期和数据。

要找出属性列表的类型:[annotation className][annotation class][annotation classCode]

所有属性列表将符合descriptionvalueForKey方法。

// Retrieve the contents of a property list as a string. 
NSString *contents = [annotation description] 
NSLog(@"%@", contents); 
相关问题