Jump to content

Welcome! You're currently a Guest.

If you'd like to join in the Discussion, or access additional features in our forums, please sign in with your Evernote Account here. Have an Evernote Account but forgot your password? Reset it! Don't have an account yet? Create One! You'll need to set your Display Name before your first post.

Photo

iOS SDK SampleApp crash at every turn

ios

  • Please log in to reply
3 replies to this topic

#1 fengyuxx

fengyuxx

  • Pip
  • Title: Member
  • Group: Members
  • 2 posts

Posted 30 June 2012 - 10:08 AM

Apologize for my poor english.

When I learn how to use evernote sdk from SampleApp.
I run SampleApp lot times for test, and SampleApp push a alert view then crash after I click login button in authorize page at every turn.

I was confused, is there anything I did wrong?
I don't change any code of SampleApp, except CONSUMER_KEY and CONSUMER_SECRET.
But simetimes SampleApp works fine. I can authorize and list notes.

Anyone help. thanks.

I print crash error info as follow:

Error Domain=NSURLErrorDomain Code=-999 "The operation couldn’t be completed. (NSURLErrorDomain error -999.)" UserInfo=0x6d17250 {NSErrorFailingURLKey=https://sandbox.evernote.com/Login.action?targetUrl=%2FOAuth.action%3Foauth_token%3Dfengyuxx-............., NSErrorFailingURLStringKey=https://sandbox.evernote.com/Login.action?targetUrl=%2FOAuth.action%3Foauth_token%3Dfengyuxx-.............}

#2 AndyDent

AndyDent

  • PipPipPip
  • Title: Bushwhacker
  • Group: Members
  • 136 posts

Posted 01 July 2012 - 11:48 AM

Maybe it's because isAuthenticated needs fixing, I think?

I pointed this out in a thread a day or so ago.

I think EvernoteSession::authenticationToken should be rewritten as:


- (NSString *)authenticationToken
{
if (self.credentials)
return [self.credentials authenticationToken];
return nil;
}

#3 fengyuxx

fengyuxx

  • Pip
  • Title: Member
  • Group: Members
  • 2 posts

Posted 02 July 2012 - 08:16 AM

Maybe it's because isAuthenticated needs fixing, I think?

I pointed this out in a thread a day or so ago.

I think EvernoteSession::authenticationToken should be rewritten as:


- (NSString *)authenticationToken
{
if (self.credentials)
return [self.credentials authenticationToken];
return nil;
}


Thanks for you response.
But I don't think it is.
I try to change the code as you said, but the problem still appear.

Finally, I find the problem:

In ENOAuthViewController.viewDidLoad
this line:
self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
shuld be:
self.webView = [[[UIWebView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)] autorelease];

Then it works fine now.

PS:
Some lines above in the same method
"UIBarButtonItem *cancelItem" did not release too.

#4 AndyDent

AndyDent

  • PipPipPip
  • Title: Bushwhacker
  • Group: Members
  • 136 posts

Posted 02 July 2012 - 05:04 PM

The addition of the autorelease is very interesting.

I am building the library as a static lib then including it into an ARC app, with the -fno-objc-arc on the lib and other associated files such as GCOAuth.m and NSData+Base64.m.

Maybe I am protected from the crashes because my main app is using ARC?

Too busy frantically trying to get app finished to investigate now but will be interested to see what the Evernote people say.





Also tagged with one or more of these keywords: ios

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users

Clip to Evernote