私はほとんど XCode の初心者なので、XCode ドキュメントにある「Hello World」の例を試してみました: クイック スタート ガイド:チュートリアル: Xcode を使用して「Hello, World!」を書きます。OS X 用。
私は XCode 4.5.1 を使用しています。そのドキュメントから、OS 10.8.2 を使用してこの例を取り上げました。私は指示に従いました。この例は機能しませんでした。ウィンドウは生成されましたが、「hello world」の印刷は生成されませんでした。関連するコードは次のとおりです。
- (void)drawRect:(NSRect)dirtyRect
{
// Drawing code here.
NSString *hello = @"Hello, World!";
NSPoint point =NSMakePoint(15, 75);
NSMutableDictionary *font_attributes = [[NSMutableDictionary alloc] init];
NSFont *font = [NSFont fontWithName:@"Futura-MediumItalic" size:42];
[font_attributes setObject:font forKey:NSFontAttributeName];
[hello drawAtPoint:point withAttributes:font_attributes];
[font_attributes release];
}
注目すべき点が 2 つあります。このコードの最後の行でエラーが発生します。
release is unavailable: not available in automatic reference counting mode
そこで、この行をコメントアウトしてプログラムを実行しました。ウィンドウは表示されましたが、「Hello World」は表示されませんでした。すべての出力に長いメッセージが表示され、その一部は次のとおりです。
"/Users/me/Library/ScriptingAdditions/YouHelper.osax/Contents/MacOS/YouHelper: no matching architecture in universal wrapper
Hello: OpenScripting.framework - scripting addition "/Users/me/Library/ScriptingAdditions/YouHelper.osax" declares no loadable handlers."
私は愚かなことをしていますか、それとも間違った例を使用していますか?