좋아 작동하지 않는, 그래서 나는 목표 - C의 세계로 내 모험을 시작하고 현재 다음과 같은 시나리오를 난처한 상황에 빠진입니다. 시나리오는 다음과 같이 내가 그것을 위해 클래스, 간단한 방법을 만들어 내 클래스의 객체를 생성 한 후 내가 만든 방법을 사용하여 내 객체의 값을 설정하려고합니다. 나는 응용 프로그램을 실행하려고 할 때 간단한 엑스 코드는 목표 - C 클래스는
(lldb)
이 모든
는 간단한 명령 줄 도구입니다,[chris setAge:29];
및 콘솔 출력 상태에서 브레이크 포인트를 얻을 수 하나의 파일, main.m로 구성되어 있습니다
// main.m
#import <Foundation/Foundation.h>
@interface Person : NSObject {
int age;
}
-(void)setAge:(int)a;
@end
@implementation Person
-(void)setAge:(int)a {
age = a;
}
@end
int main(int argc, const char * argv[])
{
@autoreleasepool {
// insert code here...
int age = 29;
int money = 0;
int broke = age + money;
NSLog(@"Hello, World!\n");
NSLog(@"I am %i",broke);
Person *chris = [[Person alloc]init];
[chris setAge:29];
NSLog(@"Chris's age is %@",chris);
}
return 0;
}
가능한 중복 (http://stackoverflow.com/q/10406572/)와 [가 중단 오류에서 중지 ] 객체를 초기화 (http://stackoverflow.com/q/10016890/)와 때이 문제를 해결 할 수 있습니다 중단 사람에 정지?] (http://stackoverflow.com/questions/8531373/) –