I am currently writing an iOS application which fills Dynamic cells with data retrieved from a PLIST file. I have searched and searched but cannot comprehend/find a way to make my data searchable.

I would like my plist to be searchable and provide the correct information. Any assistance would be greatly appreciated as I am new and struggling with the search function.

I am coding with Xcode 6.1.1 and for iOS 7+. If you would like I can also post my code so you can see what I am working with.

Recommended Answers

All 4 Replies

You can read the plist into an NSData object and then convert that into an NSDictionary. This SO question has a couple of examples Click Here

ah, Thanks! I am trying to look into that now.

Currently I am trying to implement the code

`NSData* plistData = [source dataUsingEncoding:NSUTF8StringEncoding];
NSString *error;
NSPropertyListFormat format;
NSDictionary* plist = [NSPropertyListSerialization propertyListFromData:plistData mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&error];
NSLog( @"plist is %@", plist );
if(!plist){
    NSLog(@"Error: %@",error);
    [error release];
}`

Into my app but it won't recognize my data.plst xD. Such a learning experience!

    // Path to the plist (in the application bundle)
    NSString *path = [[NSBundle mainBundle] pathForResource:
                      @"Charlotte" ofType:@"plist"];

    // Build the array from the plist
    NSMutableArray *array2 = [[NSMutableArray alloc] initWithContentsOfFile:path];

    // Show the string values
    for (NSString *str in array2)
        NSLog(@"--%@", str);

The above is the code I currently have, which reads the data into the NSMutablearray but now I just need to figure out how to search the ar

*figure out how to search the array and display the results

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.