views:

46

answers:

0

Hi All,

In My Application i access ipod Library and choose the song.

i want store that Song in NSUserDefault for save that song for reuse.

But when i reload the application i get error and application get crashed.

I use NSData to store that MPMediaItemCollection object.

I use following code...

Save

collection is my MPMediaItemCollection object.

NSData *data = [NSData dataWithBytes:&collection length:sizeof(collection)];

[[NSUserDefault StandardUserDefault] setObject:data forKey:@"slot1Save"];

Load

NSData *data = [[NSUserDefault StandardUserDefault] objectForKey:@"slot1Save"];

memcpy(&collection, data.bytes, data.length);

[myPlayer setQueueWithItemCollection:collection]; // error in this line

[myPlayer play];

Please help me or give me any idea.

Thanks in Advance,