???????????????????????????п?????? ???????????????????????£??????????????????????????????????????????????????? TDD Ч??????????????????÷?????
?????????? iOS ?????????????????????????????????????????е?????Σ?????????????? development??????????????Σ????????? production????????????????????????????? Development?? testing?? acceptance and production ???? app delegate????????????Ч???????
?????????? app delegate ???????????????????????
???????????????????????????????????????——?????????????????????飬??????????????????Щ?????????????????????????????????
?????????????α??????????
????????????
????Apple ???????????????????ò?????????????????????????????????????????ò?????????豸?????У??????????????????????????????
???????????????????????????? Apple ???????????????????????ò????Apple ??????????????????????????????μ? Xcode???? ????????????????Apple ??????? “app tests” ?? “library tests”???????????????????????????????????? Xcode ??????????????????? target ??????????????????
?????????????????????????????????????????????????????????ò?????????? ???????????????????????? ?????????? Xcode ??????????е?????????????????????ò????????????????????
????1??????????
????2??????????У???????
????3???????? bundle ??????е????
????4?????в???
??????????????????????????????????????????????????£?????t????????????
????????? app delegate
??????????????£???????????????????Ole Begemann ?? Revisiting the App Launch Sequence on iOS ?н???????????????????????? UIApplicationMain() ?????? app delegate???? application:didFinishLaunchingWithOptions: ???????????????????????????????????????????????
????1?????? Core Data??
????2????????????????
????3??????????????
????4????????????????????????????????????????????????????????????
??????????????????????????顣?????????????????????????????????????????????????????
??????????????????????????????巽????
??????? main ????
????????????????? main ???????????????
????#import <UIKit/UIKit.h>
????#import "AppDelegate.h"
????int main(int argc?? char *argv[])
????{
????@autoreleasepool {
????return UIApplicationMain(argc?? argv?? nil?? NSStringFromClass([AppDelegate class]));
????}
????}
???????????????????????????????в????????????????????????????????????????? app delegate????????????????
???????汾
????#import <UIKit/UIKit.h>
????#import "AppDelegate.h"
????#import "TestingAppDelegate.h"
????int main(int argc?? char *argv[])
????{
????@autoreleasepool {
????BOOL isTesting = NSClassFromString(@"XCTestCase") != Nil;
????Class appDelegateClass = isTesting ? [TestingAppDelegate class] : [AppDelegate class];
????return UIApplicationMain(argc?? argv?? nil?? NSStringFromClass(appDelegateClass));
????}
????}
??????????????????? XCTestCase ???????????????? TestingAppDelegate ?????????????????????????? app delegate???????????????????????????????? app delegate???????TestingAppDelegate ???????????????? target ?У?
??????????Щ?????????????????л????????????????????????????????????????????????????????е???飬???????????
????@autoreleasepool {
????Class appDelegateClass = NSClassFromString(@”XYZTestingAppDelegate”);
????if( appDelegateClass == nil ) {
????appDelegateClass = [DOAAppDelegate class];
????}
????return UIApplicationMain(argc?? argv?? nil?? NSStringFromClass(appDelegateClass));
????}