So this is my first posting on StackOverflow, so excuse me if my request is not well formed.
I am attempting to load a variable with type NSString into an NSURL with the following line:
audioPlayer = [[AudioPlayer alloc] initPlayerWithURL:[NSURL URLWithString:aArchiveItem.streamURL] delegate:self];
And in AudioPlayer implementation I am using:
-(id)initPlayerWithURL:(NSURL *)url delegate:(id<AudioPlayerDelegate>) aDelegate {
self = [super init];
delegate = aDelegate;
queue = [[AudioQueue alloc] initQueueWithDelegate:self];
fileStream = [[AudioFileStream alloc] initFileStreamWithDelegate:self];
[fileStream open];
request = [[AudioRequest alloc] initRequestWithURL:url delegate:self];
return self;
}
When I hardcode a URL string(e.g. URLWithString:@"http://www.example.com") the call to the audioPlayer work flawlessly, but when attempting to populate it with the value of aArchiveItem.streamURL it fails...
What am I doing wrong here?
probably your url has white spaces try to do the following before the using the url:
aArchiveItem.streamURL=[aArchiveItem.streamURL stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With