'[NSObject : AnyObject]' 与 'NSDictionary' 不相同,RKPathMatcher 有问题

'[NSObject : AnyObject]' is not identical to 'NSDictionary', trouble with RKPathMatcher

我正在使用 RestKit,并在 Swift 中调用 "addFetchRequestBlock"。

块内部...嗯,这是代码。更容易看到它:

  RKObjectManager.sharedManager().addFetchRequestBlock { (url: NSURL!) -> NSFetchRequest! in
     let pathMatcher = RKPathMatcher(pattern: partialPath)

     var argsDict: [NSObject: AnyObject]
     let tokenize = false as Bool
     if (pathMatcher.matchesPath(url.relativePath, tokenizeQueryStrings: tokenize, parsedArguments: &argsDict)) {

......

不喜欢"argsDict"。 (向右滚动代码)错误显示为

'[NSObject : AnyObject]' is not identical to 'NSDictionary'

这很奇怪,b/c 我认为是。在任何情况下,我总是可以将类型切换为 NSDictionary 并为自己省去一些麻烦,但我想知道我是否可以使用 "Dictionary" 对象而不是 NSDictionary 来做到这一点。没有别的原因,我想变得更 "swifty".

好的,在 Apple Docs 的 "Autoreleasing Pointers" 部分下找到了它。基本上,指向的类型不会被桥接。

https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithCAPIs.html

Types that are pointed to are not bridged. For example, NSString ** comes over to Swift as AutoreleasingUnsafeMutablePointer<NSString?>, not AutoreleasingUnsafeMutablePointer<String?>.