theos / templates

Templates for Theos NIC.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iphone/application_modern template will not compile

pixelomer opened this issue · comments

What are the steps to reproduce this issue?

  1. Create a new project with the template iphone/application_modern
  2. make

What happens?

The compilation fails, because the -fobjc-arc flag is set in the Makefile is set which enables ARC, while the code uses -[NSObject autorelease] which does not work with ARC.

What were you expecting to happen?

I'd expect the project to compile normally since it's a template, but it doesn't because of the problem mentioned above.

Any logs, error output, etc?

$ nic.pl  
NIC 2.0 - New Instance Creator
------------------------------
  [1.] iphone/activator_event
  [2.] iphone/application_modern
  ...
Choose a Template (required): 2
Project Name (required): aaa
Package Name [com.yourcompany.aaa]: aaa
Author/Maintainer Name [My Full Name]: aaa
[iphone/application_modern] Class name prefix (two or more characters) [XX]: aaa
Instantiating iphone/application_modern in aaa/...
Done.

$ cd aaa

$ make
> Making all for application aaa…
==> Copying resource directories into the application wrapper…
==> Compiling main.m (armv7)…
==> Compiling aaaAppDelegate.m (armv7)…
==> Compiling aaaRootViewController.m (armv7)…
aaaRootViewController.m:14:170: error: 'autorelease' is unavailable: not
      available in automatic reference counting mode
  ...target:self action:@selector(addButtonTapped:)] autorelease];
                                                     ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.4.sdk/usr/include/objc/NSObject.h:38:1: note: 
      'autorelease' has been explicitly marked unavailable here
- (instancetype)autorelease OBJC_ARC_UNAVAILABLE;
^
aaaRootViewController.m:14:170: error: ARC forbids explicit message send of
      'autorelease'
  ...[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addButtonTapped:)] a...
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
2 errors generated.
make[3]: *** [/tmp/aaa/.theos/obj/debug/armv7/aaaRootViewController.m.fe5d43d5.o] Error 1
make[2]: *** [/tmp/aaa/.theos/obj/debug/armv7/aaa.app/aaa] Error 2
make[1]: *** [internal-application-all_] Error 2
make: *** [aaa.all.application.variables] Error 2

What versions of software are you using?

Operating System: macOS Catalina 10.15.4
Toolchain Version: Xcode 11.4.1
SDK Version: iOS 13.4

This was fixed in 7d98646 (which is a few weeks earlier than when you made this issue, but I believe this is before we merged this templates repo submodule into Theos).