Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Getting data :(null) in the convertion of MSmutabledata to string in ios


hi im trying to play vedios in my table by fetching the url in database for that i have used the json and php code to pass the url in the im getting some problem.

I'm trying to convert the nsmutable data in to NString to pass the url for the moiveplayer but I'm getting the data Null the conversion is not happening.

this is the code i have to used to connect to the json object to the url :

   -(void)setDataSource😟vedios *)inVideosObj { self.titile.text = inVideosObj.title;  url =[NSURL URLWithString:inVideosObj.video];NSURLRequest*request =[NSURLRequest requestWithURL:url]; connection =[[NSURLConnection alloc] initWithRequest:request delegate:self]; self.responseData =[[NSMutableData alloc]init];
}-(void)connection😟NSURLConnection*)connection didReceiveData😟NSData*)data;{[self.responseData appendData:data]; }

i have tried many codes but nothing is working I'm getting the same data null error in the console

this is code i have used for the conversion:

   -(void)connectionDidFinishLoading😟NSURLConnection*)connection {// NSAssert(self.responseData, @"Response data should not be nil");
NSString*urlString =[[NSString alloc]initWithData:self.responseData encoding:NSUTF8StringEncoding];
// NSString *urlString = [[[NSString alloc] initWithData:self.responseData encoding:NSUTF8StringEncoding]autoContentAccessingProxy]; NSAssert(self.responseData,@"This should not be nil for a valid response"); NSLog(@"data :%@",urlString);MPMoviePlayerController*mov =[[MPMoviePlayerController alloc]initWithContentURL:[NSURL URLWithString:urlString]];// MPMoviePlayerController *mov = [[MPMoviePlayerController alloc]initWithContentURL:[NSURL URLWithString:urlString]]; // MPMoviePlayerController *mov = [[MPMoviePlayerController alloc]initWithContentURL:url]; self.movieplayer = mov;[self.movieplayer.view setFrame:CGRectMake(10,20,100,100)]; self.movieplayer.movieSourceType =MPMovieSourceTypeFile;[self.contentView addSubview:self.movieplayer.view];[self.movieplayer prepareToPlay];[self.movieplayer play];}

in console im getting like this

2014-01-2409:55:27.987 video[537:a0b] data 😟null)

i think url is not passing to the movieplayer but if i give direct url its working if i use the conversion of the NSMutable Data to string the conversion is not happening.

iOS 7

Posted on Jan 23, 2014 9:52 PM

Reply

There are no replies.

Getting data :(null) in the convertion of MSmutabledata to string in ios

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.