我做错了什么?
import UIKit
var values:NSMutableArray = []
let url = NSURL(string: "URL") // PHP JSON Result
let data = NSData(contentsOfURL: url!)
values = try! NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions.MutableContainers) as! NSMutableArray
var searchtext = "ROYAL"
let resultPredicate = NSPredicate(format: "SELF contains[cd] %@", searchtext)
let filteredCars = values.filteredArrayUsingPredicate(resultPredicate)
答案 0 :(得分:-1)
像这样更改你的代码
select *
from DataInizioGestione
where OtherFieldFK like = '2016%'
您需要添加要在其中过滤文字的let resultPredicate = NSPredicate(format: "SELF.Vendor contains[cd] %@ OR SELF.vendor contains[cd] %@ OR SELF.email contains[cd] %@", searchtext, searchtext, searchtext)
let filteredCars = values.filteredArrayUsingPredicate(resultPredicate)
希望这会对你有所帮助。