A library within a project that I would like to use another library - iphone

It seems this has been asked before, however I have not found an answer that works for me.
Setup: I am currently creating two static library, that are used in a project. So lets say I have Project, Liba and Libb. Project links to both Liba and Libb, Libb has an import tag for Liba. Project does not directly use Liba, but I have it in the workspace because I have read that we are not supposed to have a library directly link another library. Surprisingly this all works. Where I run into issues is that I want Libb to also use StackMob. For some reason Libb can't find StackMob.h when importing. I have added the Stackmob library to my workspace in a similar way I have for my other libraries.
Here are the relevant code snippets of each class.
Project.h
#import "Libb/Libb.h"
#interface project
{
Libb* _libb;
}
#end
Project.m
#implementation Project
{
_libb = [[Libb alloc] init];
}
#end
Libb.h
#class Liba
#class StackMob
#interface Libb
{
Liba* _liba;
}
#end
Libb.m
#import "Liba/Liba.h"
#import "Stackmob.h" //This is where I get the error. I have also tried "StackMob/StackMob.h"
#implementation Libb
{
//Code here....
}
Thanks for the help. If you need me to clarify, please ask. I realize some of the code I provided is not necessary, but I thought it may help understanding how I have things setup.

Add $(SRCROOT)/../StackMob/Headers to Header Search Paths in build settings to allow the project to find the header files.

Related

iPhone - How to modify a static library (.a file)

I was given an static library (.a extension file) that I have to use in a project, however I need to modify some of the source code before it is useful to me. What is the best way to accomplish this?
The easy-but-most-of-the-time-not-applicable solutions are subclassing or extending.
You can also try to decompile the .a file if its licence authorizes it: cf. Decompiling Objective-C libraries, but it can be tricky and/or illegal.
You cannot modify a static library, your best bet is to try to get access to the sources or ask the author to modify it for you.
You may use a Objective C extension.
For example, there's a [MyClass myMethod] in the .a lib, and you want to change this one, the following code might be used:
#import "MyClass.h"
#interface MyClass( CategoryName )
-(void)myMethod;
#end
#implementation MyClass( CategoryName )
-(void)myMethod
{
//new implementation goes here
}
#end
You cannot modify a library, only extend. That's kind of the point - to distribute the functionality behind your code without people being able to read it.

ASIHTTPRequest import issue

I am trying to get up and running with ASIHTTPRequest. I have followed the instructions as per http://allseeing-i.com/ASIHTTPRequest/Setup-instructions, having added the classes to a new group called ASIHTTPRequest and added the binaries. However when I try to add the imports, I get import errors on the .m files:
#import "ASIAuthenticationDialog.h"
#import "ASIAuthenticationDialog.m"
#import "Reachability.h"
#import "Reachability.m"
Any help would be much appreciated, I am new to Objective-C.
You do not import .m files only header files .h

Trying to use the STHorizontalPicker Library from GitHub but getting multiple errors

I'm trying to use the open source STHorizontalPicker library to implement a horizontal picker to my project but when importing the .m and .h files from GitHub to my project I'm getting multiple errors when compiling.
Does it require any special implementation?
I'm simply copying the .h and .m and adding to the project. Error are like : property 'cornerRatius' cannot be found in forward class object 'CALayer'...
Do I have to import some class to those files ?
Thnaks in advice.
Do I have to import some class to those files?
Yes, you'll need Quartz.
#import <QuartzCore/QuartzCore.h>

Unit Testing with GHUnit

I am new to iPhone Development. I have integrated the framework GHUnitIOS to Test my application. but I haven't found documentation about how to implement Unit testing (it's my first time in Unit Testing).
Can someone can help me to begin with GHUnit, documentations, examples, explanations?
Here is how you configure a new target to run tests with GHUnit:
Download the GHUnitIOS framework. Note the name, don't download the one for OS X.
Add a new target to your project.
Add the following frameworks:
GHUnitIOS.framework,
CoreGraphics.framework,
Foundation.framework,
UIKit.framework,
CoreLocation.framework
In Build Settings > Other Linker
Flags add -ObjC and -all_load
Edit the ...-Info.plist for your target with a text editor and comment the following:
<!--
<key>NSMainNibFile</key>
<string>MainWindow</string>
-->
Add the GHUnitIOSTestMain.m file into your project.
In the build settings of your new target, remove the file main.m.
In the .pch file for your new target add #import <GHUnitIOS/GHUnit.h>
Now add a test:
// this import is already in the pch
// #import <GHUnitIOS/GHUnit.h>
#interface MyTest : GHTestCase { }
#end
#implementation MyTest
- (void)testFoo {
// assert that foo is not nil
GHAssertNotNULL(foo, #"foo was nil");
}
#end
Your test methods should start with test. There are other methods you can add like setUp, tearDown, setUpClass, tearDownClass, and a number of GHAssertxxx assertions.
Don't know about GHUnit, but PragPub had a nice article about TDD on the iPhone using the Google Toolbox - see http://www.pragprog.com/magazines/2010-07/tdd-on-iphone-diy

iOS linking to "ABAddressBook.h"

So I suspect this to be a project problem as opposed to a code problem. I am still relatively new to xcode. I am trying to access the ABAddressBook libraries and have included them in the project alright.
![alt text][1][1]: http://i.stack.imgur.com/lBaW0.png
Now when I try to say import "ABAddressBook.h", it doesn't know what I am talking about. Is there anything else I need to do to get that set up? Thanks!
Try
#import <AddressBook/AddressBook.h>
#import <AddressBookUI/AddressBookUI.h>
You have to import two frameworks one is the
AddressBook and the other is AddressBookUI and then you have to import those files into your viewController subclass file and you are done