tags:

views:

14

answers:

1

Hey All

Im getting this annoying error and tried every i know but in this case it hasnt helped.

I have in my delegate....

vid_name = [push objectForKey:@"vid"];

(in the console .... vid = "video" )

now in my normal page i have

NSString *videoName = [(MissileAppDelegate *)[[UIApplication sharedApplication] delegate] vid_name];

NSString *path = [[NSBundle mainBundle] pathForResource:videoName ofType:@"mp4"];

when i run this and it comes to play the video, i get an error that doesnt even relate to the video, it happens with all variables i try and pass over using the [push objectForKey:@"vid"];. if i just vid_name =@"video" it works fine.

Any Ideas?

Alex

+2  A: 

First of all do not name your variables like vid_name! You should always use vidName in Objective-C.

You should share more information, I'm not really getting what you're doing and the error message you get would be niche.

But It sounds like a memory management problem. Because when you use the @"video" this is a static string that is always there. But when you use objectForKey: you get an object that is autoreleased and get's eventually deallocated at some point. So make sure your vid_name still exists when accessing it from your 'normal page'.

Cocoa Memory Management Programming Guide

V1ru8