Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in readStreamHasBytesAvailable in arc project following set up instruction #33

Open
otusweb opened this issue May 14, 2012 · 5 comments

Comments

@otusweb
Copy link

otusweb commented May 14, 2012

I created a brand new projection Xcode 4.3.2
set type to iphone arc project
set project type to single view
in the controller:

in .h file
@Property (nonatomic, strong) OFFlickrAPIContext *context;

in .m file

  • (void) viewWillAppear:(BOOL)animated
    {

    // Do any additional setup after loading the view, typically from a nib.

    self.context = [[OFFlickrAPIContext alloc] initWithAPIKey:@"6903cd1cb6a4bc92e906b76d60c34f63"
    sharedSecret:@"4055df0dfc06e60f"];

    OFFlickrAPIRequest *request = [[OFFlickrAPIRequest alloc] initWithAPIContext:_context];

    // set the delegate, here we assume it's the controller that's creating the request object
    [request setDelegate:self];

    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity: 5];
    [params setObject:@"2000-01-01 00:00:00" forKey:@"max_taken_date"];
    [params setObject:@"47.60569" forKey:@"lat"];
    [params setObject:@"-122.338561" forKey:@"lon"];
    [params setObject:@"date_taken" forKey:@"date_taken"];

    [request callAPIMethodWithGET:@"flickr.photos.search"
    }

run the app in simulator
=> app crash, in LFHTTPrequest::readStreamHasBytesAvailable on line 215
_delegate is pointing to a dead pointer

@lukhnos
Copy link
Owner

lukhnos commented May 16, 2012

Did you build ObjectiveFlickr also with ARC? Or is OF built with retain-release?

Another potential issue is that your view is already gone but the OF request is not properly canceled (and it's better to set delegate to nil after canceling).

@otusweb
Copy link
Author

otusweb commented May 16, 2012

I had not turned on ARC for OF. Did so today, but it still crashes at the same place. I have a single view controller and it is not going away as i don't have any view transition.
When i trace through the creation of the request, the _delegate on the LFHTTPrequest is set to the OFFlickrAPIRequest, so not an object i own. THe delegate on LFHTTPRequest is set by the framework.

I started using the branch set to use ARC and it is working fine, so i suspect there is something not working in the ARC implementation on the main branch

Olivier

@otusweb
Copy link
Author

otusweb commented May 29, 2012

I had not turned on ARC for OF. Did so today, but it still crashes at the
same place. I have a single view controller and it is not going away as i
don't have any view transition.
When i trace through the creation of the request, the _delegate on the
LFHTTPrequest is set to the OFFlickrAPIRequest, so not an object i own. THe
delegate on LFHTTPRequest is set by the framework.

I started using the branch set to use ARC and it is working fine, so i
suspect there is something not working in the ARC implementation on the
main branch

Olivier
http://www.flickr.com/photos/otusweb/
http://www.climberbeta.com

On Tue, May 15, 2012 at 8:44 PM, Lukhnos D. Liu <
[email protected]

wrote:

Did you build ObjectiveFlickr also with ARC? Or is OF built with
retain-release?

Another potential issue is that your view is already gone but the OF
request is not properly canceled (and it's better to set delegate to nil
after canceling).


Reply to this email directly or view it on GitHub:
#33 (comment)

@marsson
Copy link

marsson commented Jul 12, 2012

Hi Olivier...
I am having the same problem. But i cannot see a ARC branch on the git of the project. Where did you get that?
cheers.

@otusweb
Copy link
Author

otusweb commented Jul 13, 2012

try this https://github.com/Angel91/objectiveflickr.git

Olivier
http://www.climberbeta.com

On Thu, Jul 12, 2012 at 3:43 PM, marsson <
[email protected]

wrote:

Hi Olivier...
I am having the same problem. But i cannot see a ARC branch on the git of
the project. Where did you get that?
cheers.


Reply to this email directly or view it on GitHub:
#33 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants