Я занят выполнением тестовой программы в Xcode. Пока у меня этот код в main.m. Я вообще не получаю ошибок, но вывод не происходит, то есть NSLog в методе печати.Нет ошибок, но NSLog не выводит
В чем может быть проблема? Я знаю, что я должен упустить что-то очевидное.
#import <UIKit/UIKit.h>
#import "JTAppDelegate.h"
@interface Fraction: NSObject
-(void) print;
-(void) setNumerator: (int) n;
-(void) setDenominator: (int) d;
@end
@implementation Fraction
{
int numerator;
int denominator;
}
-(void) print
{
NSLog (@"%i/%i", numerator, denominator);
}
-(void) setNumerator:(int)n
{
numerator = n;
}
-(void) setDenominator:(int)d
{
denominator = d;
}
@end
int main (int argc, char * argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([JTAppDelegate class]));
// Create an instance of Fraction and initialise it
Fraction *myFraction = [[Fraction alloc] init];
//Set Fraction to 1/3
[myFraction setNumerator: 1];
[myFraction setDenominator: 3];
//Display the fraction using the print method
[myFraction print];
}
}
хмм ... управление возвращается от возврата UIApplicationMa – Guru
Посмотрите на [это] (http://stackoverflow.com/questions/6279551/nslog-stopped-working -in-xcode) related question – Groot
Где вы называете 'print'? – Larme