-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