-[NSNull length]: unrecognized selector sent to JSON objects

前端 未结 4 1044
悲哀的现实
悲哀的现实 2020-12-01 03:00

I\'m developing an iOS 5.0+ app with latest SDK.

I get a very strange error with this code:

- (NSMutableURLRequest*)setupRequestWithService:(NSString         


        
4条回答
  •  难免孤独
    2020-12-01 03:50

    The error message is pretty clear. NSNull and nil are different things:

    The NSNull class defines a singleton object used to represent null values in 
    collection objects (which don’t allow nil values).
    

    If you want to check if authenticationToken is NSNull try: [authenticationToken isEqual: [NSNull null]]

提交回复
热议问题