iphone - NSURL set to `nil` instead of path -


i have following code:

nsurl* savetourl = [[nsurl alloc] initwithstring:[self.recording filepath]]; nslog([savetourl absolutestring]); nslog(@"?"); nslog([self.recording filepath]); 

which outputs following

2013-08-07 15:51:32.182 spyapp[49799:c07] ? 2013-08-07 15:51:32.183 spyapp[49799:c07] /users/mike/library/application support/iphone simulator/6.1/applications/c9ede058-5c8b-4b75-8638-d5a4265b348f/documents/recordings/ujaxvehvjlgwfuw 

in debugger, can see savetourl nil, despite fact [self.recording filepath] returns /users/mike/library/application support/iphone simulator/6.1/applications/c9ede058-5c8b-4b75-8638-d5a4265b348f/documents/recordings/ujaxvehvjlgwfuw

why that? how fix it?

because filepath path, not url. create file url, use different method:

nsurl* savetourl = [[nsurl alloc] initfileurlwithpath:[self.recording filepath]]; 

on side note, first parameter nslog should constant string, never know when filepath have % in it.

nslog(@"%@", [savetourl absolutestring]); nslog(@"?"); nslog(@"%@", [self.recording filepath]); 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -