Skip to content
This repository has been archived by the owner on May 8, 2020. It is now read-only.

Getting a build error in _DCTOAuth1Account.m #1

Closed
RobKaldor opened this issue Jan 17, 2013 · 15 comments
Closed

Getting a build error in _DCTOAuth1Account.m #1

RobKaldor opened this issue Jan 17, 2013 · 15 comments

Comments

@RobKaldor
Copy link

Hi,
I'm getting the following error on build:
.../DCTAuth/_DCTOAuth1Account.m:171:9: error: returning block that lives on the local stack

I've just added the project into mine, not done anything further than that.
It's an iOS5/6 project, not using ARC.
Any ideas?

@danielctull
Copy link
Owner

I've not seen this myself. What version of Xcode are you using?

@RobKaldor
Copy link
Author

Morning,
I'm running 10.8.2 with Xcode 4.5.2, up to date but not beta.
It may be just that I'm not including the library correctly.
Do I just add the DCTAuth folder to my project? I'm a little hazy on the correct method perhaps?

Rob

@danielctull
Copy link
Owner

Hi Rob,

I think that should work, but it's not advisable. The best way to include it is as a subproject as such:

  1. Drag the DCTAuth Xcode project into your file list in your application project
  2. Go to your app Xcode project in the files and go to the build phases tab for your app target
  3. Add DCTAuth to the "Link Binary with Libraries" section (by clicking the + button)
  4. You also need to add the following system libraries: Security.framework, libresolv.dylib

Details of a lot of this can be found here: http://www.blog.montgomerie.net/easy-xcode-static-library-subprojects-and-submodules

Hope this helps,
Daniel

@RobKaldor
Copy link
Author

Awesome, thanks, will try and let you know.

@RobKaldor
Copy link
Author

OK, followed the instructions on the link, exceelent btw. Project is included.
When I call
[oauthAccount authenticateWithHandler:^(NSDictionary *responses, NSError *error) { }];

I get the following:
2013-01-18 09:48:51.412 Spearmint[33659:c07] -[NSURL dctAuth_URLByAddingQueryParameters:]: unrecognized selector sent to instance 0xae7ce30
2013-01-18 09:48:51.425 Spearmint[33659:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSURL dctAuth_URLByAddingQueryParameters:]: unrecognized selector sent to instance 0xae7ce30'
*** First throw call stack:
(0x2522012 0x17a1e7e 0x25ad4bd 0x2511bbc 0x251194e 0x15982 0x1582a 0x162cf 0x16442 0x1bc91 0x1b248 0x89ff 0x17b5705 0x240920 0x2408b8 0x301671 0x301bcf 0x300d38 0x27033f 0x270552 0x24e3aa 0x23fcf8 0x2f57df9 0x2f57ad0 0x2497bf5 0x2497962 0x24c8bb6 0x24c7f44 0x24c7e1b 0x2f567e3 0x2f56668 0x23d65c 0x25ed 0x2525)
libc++abi.dylib: terminate called throwing an exception

Any thoughts?

@danielctull
Copy link
Owner

Ah yeah, you'll need to add -ObjC to the Other Linker Flags in the build settings of your project. This will bring in the categories I've added in DCTAuth. :)

Screen Shot 2013-01-18 at 10 00 45

@RobKaldor
Copy link
Author

Yep that fixed it, top man.
OK, off to play with OAuth...

@danielctull
Copy link
Owner

Have fun!

What service are you accessing by the way?

@RobKaldor
Copy link
Author

It's under NDA, an internal system for a client.
Question: It's popping out to the browser for the sign in, but it's not returning to the app once auth'd. I can;t see anything different to the demo app in my code. Am I missing setting a callback somewhere?

@danielctull
Copy link
Owner

OK, cool! :)

You need to set the callbackURL on the account and this should match your URL scheme for the app that you can see in the plist.

@danielctull
Copy link
Owner

It might also be worth noting that you can use +[DCTAuth setURLOpener:] to handle URLs that get pushed to Safari (so if you want to use an internal UIWebView to handle it). If you do this, you still need to set the callbackURL and call to handle it with +[DCTAuth handleURL:].

@RobKaldor
Copy link
Author

Awesome, works.
If you don't mind a further question...
The service I'm connecting to requires a signature, signature method and nonce.
Does this get generated for me by the DCAuthRequest or do I have to assemble it from the data I get back from the auth connection? I'm a bit newby on this...
Edit: From looking at the source the signature is generated from the URL given to the account. If I'm sending a request to a slightly different URL, do I need a different account generated?

@danielctull
Copy link
Owner

If you assign an authorised account to a request, then when you perform the request or get a signedRequest, it should have the correct authentication headers.

@RobKaldor
Copy link
Author

Hmmm. Thats What I thought. Could I send a bit of code via email and get your opinion?

@danielctull
Copy link
Owner

Sure thing, my email is listed on my profile page: https://github.com/danielctull :)

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

No branches or pull requests

2 participants