I have an NSString that points to a URL, something like this:
https://.../uploads/video/video_file/115/spin_37.mp4
I want to get the filename in my iOS app from the NSString (in this example, spin_37.mp4)
I'm trying the following:
NSUInteger *startIndex = [self.videoURL rangeOfString:@"/" options:NSBackwardsSearch].location+1;
NSUInteger *endIndex = [self.videoURL length] - startIndex;
NSString *fileName = [self.videoURL substringWithRange:(startIndex, endIndex)];
But I'm running into a lot of errors with NSUInteger, namely right now
Invalid operands to binary expression ('unsigned long' and 'NSUInteger *' (aka 'unsigned long *'))
Can someone explain what I'm doing wrong?
You could always just use NSString's lastPathComponent
API which would take a NSString with "https://.../uploads/video/video_file/115/spin_37.mp4
" and return "spin_37.mp4
" to you.