Note that there are some explanatory texts on larger screens.

plurals
  1. PORestKit not working when used in a static library
    primarykey
    data
    text
    <p>I am wanting to write a static library which uses <code>RestKit</code>, for an iOS application -- but the <code>RestKit</code> calls are not working in the static library's unit tests. </p> <p>I'm almost certain that I'm doing something completely silly here, but I cannot figure out what this is.</p> <p>Using the static library in an iOS application, and running it in the iOS Simulator, works as desired.</p> <p>Is there something that needs to be done to get <code>RestKit</code> to work in a static library as opposed to in an iOS application?</p> <p>I've created a sample Xcode 4 project <a href="https://github.com/dbarros/RestKitStaticLibraryTest" rel="nofollow">here</a>.</p> <p>The code calling my API is simple:</p> <pre><code>+ (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]; } </code></pre> <p>My test is just:</p> <pre><code>- (void)testExample { [MyLib testRestKit]; sleep(10); } </code></pre> <p><em>Note:</em> I added the sleep just in case it was a timing thing, where the unit tests would finish without <code>RestKit</code> being given a chance to complete the API call. It did not help.</p> <p>Even though the <code>RestKit</code> call does not work, there are no visible errors either.</p> <p><strong>Update:</strong> For those interested in doing something similar, you may also want to check out Daniel Jalkut's <a href="https://github.com/danielpunkass/RSTestingKit" rel="nofollow">RSTestingKit</a>. Essentially they are classes that provide, among a few other things, what the solution provided here does.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload