I am trying to read a plist from a server. I know for a fact that the plist is valid since when I go to the URL i get the plist downloaded and the plist editor shows me my array properly. Now when I use the following code I get now array populated. I see the data is in there. In debugger i see that plistData has value however the array petListArray has no data at all. What is wrong?
- (void)getPetListRequestFinished:(ASIHTTPRequest *)request
{
NSData *plistData = [request responseData];
NSError *error = nil;
NSPropertyListFormat format = NSPropertyListBinaryFormat_v1_0;
NSArray *petListArray = (NSArray *)[NSPropertyListSerialization propertyListWithData:plistData
options:(NSPropertyListReadOptions)NSPropertyListImmutable format:&format error:(NSError **)error];
if(error){
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"GetPetListError" message:[NSString stringWithFormat:@"getPettListRequestFinished_new deserialization error: error = %@", error]
delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
return;
}
----snip-------
You are passing the wrong type of argument for the
error:slot of- NSPropertyListSerialization propertyListWithData:options:format:error:. Try:(edited after checking docs)