53

About

StackKit is a library for accessing the Stack Exchange API from within Cocoa/Cocoa Touch applications. It is under active development, but the major core functionality is present.

Code Snippet

[SKSite requestSiteWithNameLike:@"Stack Overflow" completionHandler:^(SKSite *site, NSError *error) {
  SKFetchRequest *r = [[SKFetchRequest requestForFetchingUsers] withIDs: 115730, nil];
  [site executeFetchRequest:r completionHandler:^(NSArray *results, NSError *error) {
    NSLog(@"retrieved users: %@", results);
  }];
}];

License

StackKit is available under the MIT license.

Download

StackKit can be downloaded from its Github repository.

Platform

StackKit is compatible with iOS 5+ and Mac OS X 10.7+.

Contact

StackKit is being developed by myself (Dave DeLong).

Code

StackKit is written in Objective-C. If you find a bug or would like to help contribute to it, please contact me via the project repository on Github. You're also welcome to fork the repository and send pull requests.

Description and code samples shown reflect the API of the "2.0" branch

0

10 Answers 10

15

Good thing you didn't put a space in the name:

enter image description here

5
  • Is that the OS Macs use to run? Wow... Jul 5, 2010 at 18:14
  • 8
    @George yeah, like 15 years ago. :) Jul 5, 2010 at 18:36
  • Ahh... those were('nt) the days. Still, Toolbox programming in Pascal was fun. :-) Jan 19, 2011 at 16:48
  • Phone dialer? Was that for dialup? or could you phone people from Macs?
    – Jonathan.
    Oct 8, 2012 at 21:20
  • @Jonathan. Yes — it's called "FaceTime Audio" and "Calls from iPhone" nowadays...
    – adib
    Sep 2, 2018 at 1:08
3

have you thought of adding User Association from StackAuth? I added it to my copy as a class method to SKSite, not sure if it follows the design pattern but it works. Also it doesn't return complete SKUser objects, because stackauth itself doesn't and fetch the complete user object from each site isn't feasible.

1
  • FYI, this is now in place on the development branch. You can request the associated accounts of a user via the SKSiteManager object. Feb 22, 2011 at 15:18
2

Hi Dave,

I'm using StakKit and love it, but when I tried to include it in managed objective-c project I get following message

objc[2411]: '/Library/Frameworks/StackKit.framework/Versions/A/StackKit' was not compiled with -fobjc-gc or -fobjc-gc-only, but the application requires GC

I tried to compile the source with GC supported but it wasn't compiled. Could you guys make it compatible with GC

And also can you add Gravatar url for user in SKUser Entity ?

Thanks.

1
  • good idea. I'm a big fan of memory management, so I totally forgot about garbage collection. I've pushed a change that turns on support for garbage collection, as well as an SKUser method that takes a square CGSize (or CGSizeZero) and returns a gravatar URL. Keep the feature requests coming! :) Jul 14, 2010 at 2:23
2

I tried to compile the iphone static library,but it failed in SKFunctions.h on line 41

NSString * SKExtractVector(id value, SKExtractor extractor);

with the error:

Expected declaration specifiers or '...' before 'SKExtractor'

(i'm trying to use it in an iOS 3.2 app btw)

1
  • Thanks for catching this! I just pushed a change to github; I had forgotten a #import line. Aug 30, 2010 at 0:28
2

Is this project still under development?

4
  • Not actively, no. I've been thinking about resurrecting it for the 2.0 SDK, however. We'll see... Dec 22, 2011 at 22:41
  • Okay, well, I'd like to start using it - just been a bit wary as there has been so little activity on it. What was the purpose of the coredata branch? How did it differ from master? Was it ready to be used? I've tried building against it, but it just beachballs when linked into a Mac app on OS X Lion. Dec 23, 2011 at 9:44
  • FYI, I've been putting a lot of work recently into the 2.0 branch. Feb 18, 2012 at 19:01
  • Thanks for the heads up. Will have a look at it now. Cheers. Feb 19, 2012 at 15:55
1

I'm glad to hear that StackKit is alive, since I started coding an iPad app using your framework :-) Keep up the great work, I'll contact you as soon as a working prototype is ready.

1

Still using StackKit and thinking its great, I've added a SKUserRepChange object and the ability to retrieve (when I say added I mean copied, pasted and editied ;)) Not sure how I can contribute this if you want it?

(Also I've always found it a bit backwards the way SKFetchRequests are executed asyncronously? Wouldn't it be better to have a executeOnSite method in SKFetchRequest object?)

3
  • glad to hear it! to contribute changes, you can fork the repository on github, make your changes, and send me a pull request. Also, the requests are executed on the SKSite in the same way that NSFetchRequests are executed on an NSManagedObjectContext. Feb 15, 2011 at 20:34
  • @Dave of course I just got confused between NSFetchRequest and NSURLRequest. By coincidence I just forked it today, while learning about git. Thanks I realised I have been using an out of date StackKit for a while, so while the basics are the same I'll have to get used to the Builders instead of Endpoints.
    – Jonathan.
    Feb 15, 2011 at 20:55
  • technically the "coredata" branch is experimental. Once I get it to a point where I'm mostly satisfied with it, I'll merge it in to "master". However, it should be stable. If you find issues with it, be sure to let me know. Feb 15, 2011 at 21:05
1

I am having trouble figuring out how to set up StackKit within a project. This most likely is a result of my inexperience with XCode in general but I figured this would be an appropriate place to ask.

I have built the StackKit project and then copied the .framework folder to a more accessible (easier to find) location. I then add the framework to the project.

Then due to an "image not found" error I add a Copy Files build phase.

The problem is that I end up with two references to the StackKit.framework in my project. Clearly this isn't the right way to set this up. Is there a way to simplify this?

4
  • You are programming for mac, not iOS, right?
    – Jonathan.
    Mar 30, 2011 at 7:12
  • Yes, the 10.6 SDK Mar 30, 2011 at 12:05
  • Where do the references appear, one under the target and one in the project groups (normally the Frameworks group)? Also are you using Xcode 4 or 3.2?
    – Jonathan.
    Mar 30, 2011 at 13:55
  • XCode 4. They just show up at the top level of the project. Mar 30, 2011 at 14:25
0

Is it possible to get a push notification when a new answer appeared for a specific question?

2
  • you'll have to implement that yourself. See apple's fantastic documentation (not sarcasm)
    – Matt S.
    Jun 14, 2010 at 15:00
  • Since this requires a bit more information than is easily readable in a comment, I opened (and subsequently closed) an issue for this on the StackKit site: github.com/davedelong/StackKit/issues/10 Jun 14, 2010 at 22:14
0

Dave,

I'm trying to fetch user asynchronously, but somehow fetchRequestWillBeginExecuting and fetchRequestWillBeginExecuting are not executing with iPhone SDK 4, can you have a look please?

1
  • Make sure you add -ObjC and -all_load to the Other Linker Flags setting of your project. That will load the categories in the static library. Jul 18, 2010 at 23:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .