Re: NSMutableURLRequest-compile error

74 views
Skip to first unread message

Jesse Tayler

unread,
Aug 1, 2012, 7:42:08 PM8/1/12
to iphonesdkd...@googlegroups.com

you have ARC turned on, so you no longer release or autorelease objects, the compiler will figure out when the memory needs to be evicted from the heap.

it's nice.



On Aug 1, 2012, at 6:25 PM, don <donj...@gmail.com> wrote:

From the code(bold), compile error occur. how to fix this?

I downloaded project. If compile as it is, compile succeed.

But, if I create my own project and make codes without any change, compile error occurs.

It seems error occurs because Xcode version difference.

How could I solve this?



NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];

'autorelease' is unavailable: not available in automatic reference counting mode

ARC forbids explicit message send of 'autorelease'


receivedData = [[NSMutableData data] retain]; 

ARC forbids explicit message send of 'retain'


--
You received this message because you are subscribed to the Google Groups "iPhone SDK Development" group.
To view this discussion on the web visit https://groups.google.com/d/msg/iphonesdkdevelopment/-/tbgjfspF1F4J.
To post to this group, send email to iphonesdkd...@googlegroups.com.
To unsubscribe from this group, send email to iphonesdkdevelop...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/iphonesdkdevelopment?hl=en.

jrparro

unread,
Aug 1, 2012, 9:21:39 PM8/1/12
to iphonesdkd...@googlegroups.com, iphonesdkd...@googlegroups.com
Unless, you don't need ARC in your project you can disabled it & the project will compile fine.

Sent from my iPhone

Glenn Phillips

unread,
Aug 1, 2012, 9:26:40 PM8/1/12
to iphonesdkd...@googlegroups.com
Or you can disable ARC only on the library files that weren't developed with it in mind. 


BareFeetWare

unread,
Aug 1, 2012, 9:26:54 PM8/1/12
to iphonesdkd...@googlegroups.com
In reply to:

NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];

'autorelease' is unavailable: not available in automatic reference counting mode

ARC forbids explicit message send of 'autorelease'


You can just delete the bit that ARC doesn't like "autorelease", so it reads:


NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];

receivedData = [[NSMutableData data] retain]; 

ARC forbids explicit message send of 'retain'


You can just delete "retain", so it reads:

receivedData = [NSMutableData data];

Or, you can disable ARC.

Tom

Reply all
Reply to author
Forward
0 new messages