使用iOS,如何检查URL是否为空

Jon*_*nes 7 url cocoa-touch ios

我正在加载一个JSON,但我想检查"URL": "",json中是否为空,有时ID是空的,我该怎么检查?

if(URL == HOW TO CHECK IF EMPTY?)
{

}
else
{

}
Run Code Online (Sandbox Code Playgroud)

错误:

*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 0 beyond bounds for empty array'
*** First throw call stack:
Run Code Online (Sandbox Code Playgroud)

Bla*_*zer 6

嗯,试试吧

if ([URL isEqualToString:@"The URL?"]) {
Run Code Online (Sandbox Code Playgroud)