0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Xcode11でObjective-CをMRCで動かす

Posted at

環境

  • macOS Big Sur 11.0 Beta
  • Xcode 11.6

Objective-C言語でMRC有効方法

  • Xcode11ではARCがデフォルト有効なため、PROJECT -> Build Settings から Objective-C Automatic Reference Counting の値を NO に変更する
    スクリーンショット 2020-08-18 23.02.36.png

  • 上記だけだとXcode11では、main.mのmain()でEXC_BAD_ACCESSが発生してしまう。
    スクリーンショット 2020-08-18 23.03.31.png

  • main()を以下のように変更するとMRC環境で実行が可能となる。

int main(int argc, char * argv[]) {
    NSString * appDelegateClassName;
    @autoreleasepool {
        // Setup code that might create autoreleased objects goes here.
        appDelegateClassName = NSStringFromClass([AppDelegate class]);
        return UIApplicationMain(argc, argv, nil, appDelegateClassName);
    }
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?