我想尝试基于这篇文章的实验:http://commandlinefanatic.com/cgi-bin/showarticle.cgi?article=art024
我设法编译了这个例子:
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface MyDelegate : UIResponder< UIApplicationDelegate >
@end
@implementation MyDelegate
- ( BOOL ) application: ( UIApplication * ) application
didFinishLaunchingWithOptions: ( NSDictionary * ) launchOptions {
UIWindow *window = [ [ [ UIWindow alloc ] initWithFrame:
[ [ UIScreen mainScreen ] bounds ] ] autorelease ];
window.backgroundColor = [ UIColor whiteColor ];
UILabel *label = [ [ UILabel alloc ] init ];
label.text = @"Hello, World!";
label.center = CGPointMake( 100, 100 );
[ label sizeToFit ];
[ window addSubview: label ];
[ window makeKeyAndVisible ];
[ label release ];
return YES;
}
@end
int main( int argc, char *argv[ ] )
{
UIApplicationMain( argc, argv, nil, NSStringFromClass( [ MyDelegate class ] ) );
}
使用Makefile:
XCODE_BASE=/Applications/Xcode.app/Contents
SIMULATOR_BASE=$(XCODE_BASE)/Developer/Platforms/iPhoneSimulator.platform
FRAMEWORKS=$(SIMULATOR_BASE)/Developer/SDKs/iPhoneSimulator9.2.sdk/System/Library/Frameworks/
INCLUDES=$(SIMULATOR_BASE)/Developer/SDKs/iPhoneSimulator9.2.sdk/usr/include
window: window.m
clang \
-arch i386 \
-mios-simulator-version-min=9.2 \
-fobjc-abi-version=2 \
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk \
-o window window.m -framework Foundation -framework UIKit
但我正在努力在iPhone模拟器中运行生成的示例。文章中提到的方法似乎不再起作用了:
...Contents/MacOS/Simulator -SimulateApplication ./window
任何想法如何在当前版本中实现这一目标?感谢