所以我得到了以下代码:
RKObjectManager.sharedManager().addFetchRequestBlock({
url in
// let pathMatcher = RKPathMatcher(path: "/v1/groups/")
// var dict = NSDictionary?()
// let match = pathMatcher.matchesPath(url.relativePath, tokenizeQueryStrings: false, parsedArguments: &dict)
// if match {
if let path = url.relativePath where path == "/v1/groups" {
let fetchRequest = NSFetchRequest(entityName: String(self))
fetchRequest.predicate = NSPredicate(format: "ANY member == %@", activeUser)
return fetchRequest
}
return nil
})
它有效,但你可以看到它没有使用RKPathMatcher。
如果我在评论后的代码中发表评论,我会得到:
*** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason:
'*** -[NSRegularExpression enumerateMatchesInString:options:range:usingBlock:]: nil argument'
答案 0 :(得分:1)
我没试过,但dict部分应该是:
var dict: NSDictionary?
虽然它看起来不像你正在使用它所以你可以把它设置为零。