shonaa16 / upnpx

Automatically exported from code.google.com/p/upnpx
0 stars 0 forks source link

mediaServer1ItemObject always have uriCOllection belongs to the last item in the same folder #9

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
Using the demo app comes with the source code.

2.
Modify the FolderView.m as following:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath 
*)indexPath {

    MediaServer1BasicObject *item = [m_playList objectAtIndex:indexPath.row];

    if([item isContainer]){
        MediaServer1ContainerObject *container = [m_playList objectAtIndex:indexPath.row];
        FolderView *targetViewController = [[[FolderView alloc] initWithMediaDevice:m_device andHeader:[container title] andRootId:[container objectID]] autorelease];
        [[self navigationController] pushViewController:targetViewController animated:YES];
    }
    else 
    {
        MediaServer1ItemObject *itemObj = (MediaServer1ItemObject *)item;

        for (id itemRes in [itemObj resources])
        {
            NSLog(@"*** Item protocolInfo: %@", [itemRes protocolInfo]);
            NSLog(@"*** Item URI: %@", [[itemObj uriCollection] objectForKey:[itemRes protocolInfo]]);
        }
    }
}

3.
Put couple videos in a upnp sever.

What is the expected output? What do you see instead?

Instead of seeing different Item URI's, the app always displays the URI of the 
last item in the list.

What version of the product are you using? On what operating system?
Trunk.

Please provide any additional information below.

To fix this:
MediaServer1ItemObject.h
line 76: @property(retain, nonatomic) NSDictionary *uriCollection;

Change to:
@property(copy, nonatomic) NSDictionary *uriCollection;

In fact, most of the properties declared should be copy instead of retain if 
the classes have mutable subclasses like the NSString, NSDictionary, NSArray, 
etc.

Original issue reported on code.google.com by Vincent....@gmail.com on 30 Apr 2012 at 2:36