2012-08-31 44 views
0

當爲NSFetchRequest使用NSPredicate並且搜索URL時是否需要轉義「/」?nspredicate轉義url

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(url == %@) , aURL]; 
+0

aURL是字符串或NSURL –

回答

2

做到這一點,因爲我認爲aURL是字符串:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(url == %@") , aURL]; 

也可以嘗試這樣的:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY url like '%@'" , aURL];