evermeer / AlamofireJsonToObjects

An Alamofire extension which converts JSON response data into swift objects using EVReflection
Other
161 stars 28 forks source link

Cant build application with latest version of AlamofireJsonToObjects #21

Closed wajahatch888 closed 8 years ago

wajahatch888 commented 8 years ago

I am using following version

Installing AlamofireJsonToObjects 1.6.0 (was 1.3.0) Installing EVReflection 2.25.0 (was 2.15.1) Installing Alamofire 3.3.1 (was 3.1.4)

After compiling project i am getting this error

screen shot 2016-04-27 at 3 32 04 pm

How can i fix this error?

evermeer commented 8 years ago

Indeed in version 1.6.0 the need for required initializers was removed so that the required initializers could also been made not required in EVReflection.

It's strange that you say that it has been upgraded to version 1.6.0 because the code in your screenshot is from an earlier version. the code should have looked like this:

    public func responseObject<T:EVObject>(queue: dispatch_queue_t? = nil, encoding: NSStringEncoding? = nil, completionHandler: (NSURLRequest?, NSHTTPURLResponse?, Result<T, NSError>) -> Void) -> Self {
        return responseString(encoding: encoding, completionHandler: { (response) -> Void in
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
                dispatch_async(queue ?? dispatch_get_main_queue()) {
                    switch response.result {
                    case .Success(let json):
                        let t = T()
                        let jsonDict = EVReflection.dictionaryFromJson(json)
                        EVReflection.setPropertiesfromDictionary(jsonDict, anyObject: t)
                        completionHandler(self.request, self.response, Result.Success(t))
                    case .Failure(let error):
                        completionHandler(self.request, self.response, Result.Failure(error ?? NSError(domain: "NaN", code: 1, userInfo: nil)))
                    }
                }
            }
        })
    }

I just did a pod update in my other projects and I get the correct version. Could you try doing another 'pod update' ? Could you test if you see the code above in your Pods/Pods/AlamoFireJsonToObjects/AlamoFireJsonToObjects.swift ?

wajahatch888 commented 8 years ago

Thanks for reply. It was xcode issue. Whenever i perform 'pod update', Pods gets updated but xcode still shows old code. I restarted the xcode and every thing runs smoothly.

evermeer commented 8 years ago

Great to hear it's solved. Thanks for letting me know.