`
knight_black_bob
  • 浏览: 825303 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

ios nscfnumber nsinvalidargumentException 异常

阅读更多

自己 撸了一个 ios 的糗百 ,调用 了 糗百官方的 api  ,总是 运行报错

 


断点 打印 就是不理解为啥 报错

 

 

开放接口

#define LastestURLString(count,page) [NSString stringWithFormat:@"http://m2.qiushibaike.com/article/list/latest?count=%d&page=%d",count,page]
#define ImageURLString(count,page) [NSString stringWithFormat:@"http://m2.qiushibaike.com/article/list/images?count=%d&page=%d",count,page]
#define SuggestURLString(count,page) [NSString stringWithFormat:@"http://m2.qiushibaike.com/article/list/suggest?count=%d&page=%d",count,page]
#define DayURLString(count,page) [NSString stringWithFormat:@"http://m2.qiushibaike.com/article/list/day?count=%d&page=%d",count,page]
#define WeakURlString(count,page) [NSString stringWithFormat:@"http://m2.qiushibaike.com/article/list/week?count=%d&page=%d",count,page]
#define MonthURLString(count,page) [NSString stringWithFormat:@"http://m2.qiushibaike.com/article/list/month?count=%d&page=%d",count,page]
#define CommentsURLString(ID) [NSString stringWithFormat:@"http://m2.qiushibaike.com/article/%@/comments?count=500&page=1",ID]

 

 

 糗百的数据维度不错!!!!!!!!!!!!!

 

 

最后 发现是   int  型数据 我 用的是 Nstring  ,修改成int 就ok了。

@property (nonatomic, copy) NSString *userPicLink;
@property ( nonatomic, copy) NSString *userName;
@property ( nonatomic, copy) NSString *content;
@property (nonatomic,assign) int *badNum;
@property (nonatomic,assign) int *contentNum;
@property (nonatomic,assign) int *goodNum;

- (id)initWithDictionary:(NSDictionary *)dictionary;

  

 

 

 

json解析过程中,若是全是数字,会默认成nscfnumber。

 

 

 

 

 

结果如下:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

捐助开发者

在兴趣的驱动下,写一个免费的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(右上角的爱心标志,支持支付宝和PayPal捐助),没钱捧个人场,谢谢各位。



 
 
 谢谢您的赞助,我会做的更好!

 

 

 

  • 大小: 586 KB
  • 大小: 120 KB
  • 大小: 47.4 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics