Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7590901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:31:14+00:00 2026-05-30T20:31:14+00:00

I am wanting to write a static library which uses RestKit , for an

  • 0

I am wanting to write a static library which uses RestKit, for an iOS application — but the RestKit calls are not working in the static library’s unit tests.

I’m almost certain that I’m doing something completely silly here, but I cannot figure out what this is.

Using the static library in an iOS application, and running it in the iOS Simulator, works as desired.

Is there something that needs to be done to get RestKit to work in a static library as opposed to in an iOS application?

I’ve created a sample Xcode 4 project here.

The code calling my API is simple:

+ (void)testRestKit
{ 
    NSString* URL = @"http://0.0.0.0:3000/api";
    RKClient* client = [RKClient clientWithBaseURL:URL username:@"me@somewhere.com" password:@"password"];
    [client get:@"/users/current" delegate:nil];
}

My test is just:

- (void)testExample
{
    [MyLib testRestKit];
    sleep(10);
}

Note: I added the sleep just in case it was a timing thing, where the unit tests would finish without RestKit being given a chance to complete the API call. It did not help.

Even though the RestKit call does not work, there are no visible errors either.

Update: For those interested in doing something similar, you may also want to check out Daniel Jalkut’s RSTestingKit. Essentially they are classes that provide, among a few other things, what the solution provided here does.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T20:31:15+00:00Added an answer on May 30, 2026 at 8:31 pm

    Sleeping the thread when you’re waiting for something to happen isn’t likely to help, but you could try cranking the run loop around a few times:

    - (void)testExample
    {
        [MyLib testRestKit];
        [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:25]];
    }
    

    I haven’t really looked into this thoroughly enough to be confident it’ll help (or to explain why, if it does), but it’s worth a try.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Often, I find myself wanting to write a unit test for a portion of
I've been wanting to write a music program for a while, but I don't
I'm wanting to write a simple WinForms application that will be able to plot
I am wanting to write an application for 3 platforms (iPhone, Android, and WPF).
I am wanting to write some cross-platform library code. I am creating a library
I am wanting to write a anagram type solver in Ruby but it will
I'm wanting to write a method that I can use to initialise a Map.
I'm wanting to write a virtual keyboard, like windows onscreen keyboard for touchscreen pcs.
I am eventually wanting to program in Objective-C to write programs for OS X
Not wanting to re-invent the wheel or anything, I was wondering if there's a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.