Question

Okay, all I am doing is setting an NSString to a value with this code:

NSString *stringURL = [NSString stringWithFormat:@"http://api.themoviedb.org/3/movie/%@/trailers?api_key=1523229ded5824dab8bb7840782db266",searchID];

This is a string that I then turning into a URL for querying the TMDB database. This line of code gives me a BAD_EXC_ACCESS and it is blowing my mind because using this sort of NSString construction is something I have done thousands of times without a problem.

The one other thing to note is that this line is being executed right after another query call is made. The weird thing is that call makes the stringURL the same way, yet it works fine.

Any help would be appreciated...

Was it helpful?

Solution

You need to use %i to log an NSInteger, not %@

OTHER TIPS

You need to use the following NSString *stringURL = [NSString stringWithFormat:@"http://api.themoviedb.org/3/movie/%d/trailers?api_key=1523229ded5824dab8bb7840782db266",searchID];

Because searchID has NSInteger type and you are using "%@"

If it's an NSInteger you need to use %ld or you will got a warning, you can also use %d and explicitly cast to int via (int)searchID

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top