-1
这是我的代码:Objective-c中的XCTestCase中的类变量?
#import <XCTest/XCTest.h>
#import "GTN_GameStatistics.h"
@interface GTN_GameStatisticsTest : XCTestCase
@end
@implementation GTN_GameStatisticsTest{
GTN_GameStatistics * _gameStatistic;
}
+ (void)setUp
{
[super setUp];
// Put setup code here; it will be run once, before the first test case.
}
- (void)setUp
{
[super setUp];
// Put setup code here; it will be run once, before the first test case.
_gameStatistic = [GTN_GameStatistics sharedManager];
}
- (void)tearDown
{
// Put teardown code here; it will be run once, after the last test case.
[super tearDown];
[_gameStatistic resetStatistics];
}
是否有某种方式把代码- (void)setUp
至+ (void)setUp
。
为此我需要使GTN_GameStatistics * _gameStatistic
一个类变量不是实例变量,但我不知道如何。
我尝试了一些方法,但它没有奏效。
我可以做到这一点,但想知道这是可能的和如何?
请使用'xcode'标签只可用于与IDE本身的问题。 –
@Leo OK。谢谢。 – WebOrCode