【问题标题】:Returning integer value返回整数值
【发布时间】:2013-01-23 01:33:25
【问题描述】:

我正在使用 Objective-C iOS6 ARC 编写应用程序。 这是一段sn-p代码:

header file:
@interface Chapter : NSObject


-(void) addPageCount:(int) pCount;
-(int)getPageCount;
@end

//implementation
#import "Chapter.h"
@interface Chapter()
{

    int pageCount;
}
@end
-(void)addPageCount:(int) pCount
{
    pageCount = pCount;
}


//testing

 NSLog(@"%d", [chapter getPageCount]);

Returns -1073750816 once I pass 100.

问题是什么? 最好的问候

【问题讨论】:

    标签: ios6 integer automatic-ref-counting instance-variables nslog


    【解决方案1】:

    已找到解决方案。在某些时候,我一直在发送一个指针值而不是整数

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-11-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-15
      • 1970-01-01
      • 2023-01-22
      • 1970-01-01
      相关资源
      最近更新 更多