开发者

How can I tell when NSData dataWithContentsOfFile is done loading my plist? When can I fetch/assign values?

I'm reading a plist into my application, which consists of a root dictionary and a bunch of sub-values consisting of arrays and date objects. Here's my code so far:

NSError *error;    
NSString *path = [[NSBundle mainBundle] pathForResource:@"Data" ofType:@"plist"];
NSData *plistData = [NSData dataWithContentsOfFile:path];
NSPropertyListFormat plistFormat;
plistValues = [NSPropertyListSerialization propertyListWithData:plistData options:NSPropertyListImmutable f开发者_StackOverflow社区ormat:&plistFormat error:&error];

My question is: how can I tell when the NSData method dataWithContentsOfFile is done loading and...or when the NSPropertyListSerialization method is finished serializing the data? I don't want to attempt to take the values from the load and assign them to variables until the plist is finished loading and those values actually exist and are serialized.


These are synchronous messages. They will block until they have the result.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜