I am trying to use FCOfflineQueue (a persistent framework for queuing network requests while offline) with my iOS app written in Swift. I am supposed to subclass the FCOfflineQueue
class and override the following method in my subclass-
- (BOOL)executeOperation:(int64_t)opcode userInfo:(NSDictionary *)userInfo;
In my own queue that I subclassed from FCOfflineQueue
, am having trouble declaring this in Swift. I am doing the following-
override func executeOperation(opcode: Int64, userInfo: NSDictionary) -> Bool
It says- this method does not override any method from its superclass.
If instead I do the following-
@objc override func executeOperation(opcode: Int64, userInfo: NSDictionary) -> Bool
It says- Overriding method with selector 'executeOperation:userInfo:' has incompatible type '(Int64, NSDictionary) -> Bool'
I thought int64_t
is equivalent to Int64
in Swift. Is it something to do with the conversion?
Any help is appreciated.
try to override like this:
override func executeOperation(opcode: Int64, userInfo: [NSObject : AnyObject]!) -> Bool {
return false
}
When you bridge from an NSDictionary object with parameterized types to a Swift dictionary, the resulting dictionary is of type [ObjectType]. If an NSDictionary object does not specify parameterized types, it is bridged to a Swift dictionary of type [NSObject: AnyObject].
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.