Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6658207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:51:54+00:00 2026-05-26T01:51:54+00:00

i will like to seek advise on what should i do next in order

  • 0

i will like to seek advise on what should i do next in order to pass a list of data from Plist to an array.

i will like to pass the plist data to my tableview BrowseViewController.m, but i do not know how to do it.

i tried NSlog, the plist are passing info over but i don’t know wat is my next step.

can anyone teach me ? thanks alot.

this is my Plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"     "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
    <key>AudioFileDescriptions</key>
    <array>
        <string></string>
        <string></string>
        <string></string>
        <string></string>
    </array>
    <key>CommonName</key>
    <string>Cane Toad </string>     
    <key>ScientificName</key>
    <string>Bufo marinus </string>
    <key>Species</key>
    <string>marinus</string>
</dict>

my app delegate

  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:   (NSDictionary *)launchOptions
  {
   // Override point for customization after application launch.
   // Add the tab bar controller's current view as a subview of the window
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];

//load frog information from plist
NSBundle *bundle = [NSBundle mainBundle];
NSString *eventsPath = [bundle pathForResource:@"Frog" ofType:@"plist"];
frogObject = [Frog frogObjectWithContentsOfFile:eventsPath];

return YES;
}

Frog.m

+ (id)frogObjectWithContentsOfFile:(NSString *)aPath
{
Frog *frogObject = [[Frog alloc] init];

if (frogObject) {
    // load all frogs from plist
    NSMutableArray *allFrogsArray = [NSArray arrayWithContentsOfFile:aPath];
    //NSDictionary *allFrogsArray = [NSDictionary dictionaryWithContentsOfFile:aPath];
    if (allFrogsArray == nil) {
        [frogObject release];
    }

    [frogObject.allFrogs addObjectsFromArray:allFrogsArray];

    // iterate through each event and put them into the correct array
    NSEnumerator *frogsEnumerator = [allFrogsArray objectEnumerator];
    NSDictionary *currentFrog;
    while (currentFrog = [frogsEnumerator nextObject]) {
        [frogObject addFrog:currentFrog];
    }
   // NSLog(@"FrogObject %@",allFrogsArray);
}
return frogObject;
}

- (void)addFrog:(NSDictionary *)anFrog;
{

    NSLog(@"anFrog Value %@",anFrog);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:51:54+00:00Added an answer on May 26, 2026 at 1:51 am

    You should probably rework the structure of the code, why does the “FrogObject” holds an array to all the frogs? It’s semantically confusing, as you expect that a FrogObject holds the data for a single entity, not the whole set. A way would be to make the FrogObject know how to load multiple frogs, but return the array.

    For example, the frog object would look like:

    @interface Frog : NSObject
    
    @property (nonatomic,retain) NSString* commonName;
    @property (nonatomic,retain) NSString* scientificName
    @property (nonatomic,retain) NSString* species;
    
    + (NSArray*)frogsFromFile:(NSString*)filePath;
    
    - (Frog*)initWithDictionary:(NSDictionary*)frogDictionary;
    
    @end
    

    The frogsFromFile: can create multiple instances of frogs (each one with its own sub-dictionary with initWithDictionary:), but most importantly, it returns it, it doesn’t hold it.

    Next, you can use to present it in a tableView, for example (BrowseViewController.h):

    @interface BrowseViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
    {
        NSArray *frogs;
    }
    

    BrowseViewController.m

    - (void)viewDidLoad
    {
        [super viewDidLoad];
    
        frogs = [Frog frogsFromFile:[[NSBundle mainBundle] pathForResource:@"Frog" ofType:@"plist"]];
    }
    
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
        return [frogs count];
    }
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        static NSString *cellIdentifier = @"frogCell";
    
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    
        if (cell == nil)
        {
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier] autorelease];
        }
    
        Frog *frog = [frogs objectAtIndex:indexPath.row];
    
        cell.textLabel.text = frog.commonName;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i will like to pass other than title and snippet value to the OverlayItem,
I will like to read network packets from a single board computer into a
i'd like to read binary data from a blob, using the Stream interface around
I will like to use the objdump command on cygwin. I get the exception:
I will like to know: I have a scenario. If a user adds a
i will like to ask if there is any script or any help on
I will like to know how I can change just one color in a
I will like to speed the process of traversing a tree. Here is an
I will like to take a screen capture without a window. I currently hide
Hi am new to JSON and I will like to retrieve the values for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.