Showing posts with label RestKit. Show all posts
Showing posts with label RestKit. Show all posts

Thursday, June 11, 2015

CocoaPods dependency errors

Analyzing dependencies
[!] Unable to satisfy the following requirements:

- `AFNetworking (= 1.3.4)` required by `Podfile.lock`
- `AFNetworking (~> 1.3.0)` required by `RestKit/Network (0.20.3)`

- `AFNetworking (~> 2.5)` required by `ABMSoundCloudAPI (0.1.0)`

References:
http://blog.cocoapods.org/CocoaPods-0.35/

Solution:

  1. Fork the repository,
  2. Make the changes or update dependencies
  3. Install from the forked repository

Wednesday, May 27, 2015

[__NSCFNumber length]: unrecognized selector sent to instance

If you get any of these runtime errors/warnings:
[__NSCFNumber length]: unrecognized selector sent to instance
restkit.object_mapping:RKMappingOperation.m: Coercing NSNull value to nil in shouldSetValue:atKeyPath: -- should be fixed
class User: NSObject {
    var userId: String?
    var userImageUrl: String?

}

Check whether server is sending JSON response not as String like
{
  "id":12345
  "avatar_url":""
}

Solution:

Such error causing properties should be defined as NSObject

class User: NSObject {
    var userId: NSObject?
    var userImageUrl: String?

}