Ios 检查RTMP和非RTMP url的代码?
我有两个网址。我想设置一个条件来检查提供的URL是否为RTMP URL。您可以使用NSURLIos 检查RTMP和非RTMP url的代码?,ios,objective-c,iphone,rtmp,Ios,Objective C,Iphone,Rtmp,我有两个网址。我想设置一个条件来检查提供的URL是否为RTMP URL。您可以使用NSURL主机名来检查 NSURL *url = [[NSURL alloc] initWithString:@"https://www.rmp-streaming.com/media///bbb-360p.mp4"]; NSURL *URL =[[NSURL alloc]initWithString:@"https://www.youtube.com/watch?v=zQRvYYoV6bc"]; url.ho
主机名来检查
NSURL *url = [[NSURL alloc] initWithString:@"https://www.rmp-streaming.com/media///bbb-360p.mp4"];
NSURL *URL =[[NSURL alloc]initWithString:@"https://www.youtube.com/watch?v=zQRvYYoV6bc"];
url.host
将返回www.rmp-streaming.com
对于此url
NSURL *url = [[NSURL alloc] initWithString:@"https://www.rmp-streaming.com/media///bbb-360p.mp4"];
url.host
将返回www.youtube.com
现在你可以决定你想要什么了。代码未测试,这只是建议。请用您所做的代码提供您的错误。否则,stackoverflow不是人们免费为您执行任务的地方。他们都是http。Rtmp从Rtmp开始://
NSURL *URL =[[NSURL alloc]initWithString:@"https://www.youtube.com/watch?v=zQRvYYoV6bc"];