I am using a non-ARC framework in my ARC-enabled app. Now I get a weird EXC_BAD_ACCESS
at a line that looks like this:
return [super prepareURLRequest]; << Thread 1: Program received signal: "EXC_BAD_ACCESS".
First of all, how is this possible, since super
is not an object that could possibly have been deallocated. Update: Although the Debugger got stuck at this line, it turned out that the problem was one level deeper in the mentioned method.
When I run the thing in Zombie mode I get the following "zombie stack":
Event Type RefCt Responsible Caller
Malloc 1 -[MyViewController loadData:]
Retain 2 -[MyDataManager initWithBaseURL:]
Release 1 -[MyDataManager initWithBaseURL:]
Release 0 -[MyViewController loadData:]
Zombie -1 -[RKRequest prepareURLReuqest]
It seems that there is a problem with the url but in ARC I have no means of retaining the URL so that it does not get allocated. So how could I fix this problem.
Okay, I found the problem. The problem was that MyDataManager
was deallocated after the loadData:
method was through.
So I added a myDataManager
property to MyViewController
and the problem disappeared.