Cannot get Cocoa API working for iPhone

7 views
Skip to first unread message

CuriousG

unread,
Oct 27, 2009, 2:32:09 AM10/27/09
to SoundCloudAPI
Hello,

SoundCloud noob questions!

I can't seem to get going with the Cocoa API for iPhone. It refuses to
compile for the simulator because of errors with a lack of a key chain
(kSecClass undefined, etc.) on the device end it seems to compile, but
it crashes with:

*** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '*** -[OAToken
initWithDefaultKeychainUsingAppName:serviceProviderName:]:
unrecognized selector sent to instance 0x13a950'

I added -ObjC to the linker flags (on both the API and the test code),
but that did not help. I am working with code gotten directly from git
and not anything else.

Help is appreciated. Thanks!

- George

Ullrich Schäfer

unread,
Oct 27, 2009, 9:55:43 AM10/27/09
to soundc...@googlegroups.com
Hey George

Great to hear you're going to use the Cocoa wrapper!
Sad that you got problems, but we're here to help you :)

Can you tell me for which OS version you're trying to build.

Since the Keychain Implementations before 3.x differed between the
Simulator and the device there has been a pre compiler switch in
OAToken+Keychain.m (in Sources/OAuthExtensions).
It is possible that a bug sneaked in during the last change of that
switch to make it compile for 3.x.

/ullrich

CuriousG

unread,
Oct 27, 2009, 6:58:02 PM10/27/09
to SoundCloudAPI
Thanks Ullrich,

I think I've got things working... Maybe. I am working on iPhone OS
3.1. Here's what I did:

- Added -all_load and -ObjC to additional linker flags
- Added the Security.framework to the project
- There was a "SoundCloudAPI" directory in the test app directory. I
removed this as it was a duplicate of what was in the API directory.
- I made the additional include search directories consistent across
the build configurations
- Changed the trackNumberLabel line to: [trackNumberLabel setText:
[[userInfoDictionary objectForKey:@"track_count"] stringValue]];
because that was crashing the app.
- Changed the compiler settings to Base SDK iPhoneOS 3.1 and GCC
Compiler v4.2, etc.

So runs now, although there are a couple of kinks:

- On first run, it immediately closes to launch Safari. I think that
is just part of the flow that needs tweaking.
- When authed for the first time and it launches the app, but the app
seams to crash. I haven't figured that out yet.
- If I deauth the app under my account, the app doesn't recognize this
and doesn't offer to reauth. I think that is just another part of the
flow that requires tweaking though.

Let me know if this all looks like it makes sense. It's one thing that
it works, but it's another to make sure I implemented the correct
solutions.

- George


On Oct 27, 6:55 am, Ullrich Schäfer <ullrich.schae...@gmail.com>
wrote:

Ullrich Schäfer

unread,
Oct 28, 2009, 6:05:31 AM10/28/09
to soundc...@googlegroups.com
Hey George,

nice you got it working. Please remember that the Apps in the TestApps
directory are plain demonstration. The fine tuning of the auth flow
and such is up to your own implementation.

Is it possible that you fork the project on github to send me a pull
request for your changes? If you're not familiar with git it's just
fine if you send me the output of 'git diff' so i can follow your
changes and apply them to the repository.

I then also can comment on the correctness of your solution.
I also got some changes to the API wrapper which still need to be
pushed to the repository when I find the time. :)

/Ullrich

CuriousG

unread,
Oct 30, 2009, 4:04:13 AM10/30/09
to SoundCloudAPI
Hi Ullrich,

Yes, this is the first time I've actually used git, so I'll have to
look up the proper syntax for doing a diff. I'll send it your way.

Thanks again!

- George

On Oct 28, 3:05 am, Ullrich Schäfer <ullrich.schae...@gmail.com>
Reply all
Reply to author
Forward
0 new messages