iPhone - adding new group to class folder - import not detecting - iphone

I hope you can help with that.
OK i have created new group/folder under Classes - Libs: Classes/Libs and have created class there Msg.h
now I am trying to import it into my RootViewController
#import "Libs/Msg.h"
but I am getting an error:
Libs/Msg.h = no such file or directory
what should i Do ?
cheers,
/marcin

OK, as it turns out, the Libs is not required just
#import "Msg.h"
is enaugh even if its in folder level down.
thanks

What path is your RootViewController in? If you give a path in import, it must be relative to the current file. Also check the case of both directory and file; Mac OS X is case-insensitive, but Xcode and iPhone are not.

Related

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>

How to define all my constants in one .h file in iPad?

I am working on an application where i have to use several constants.I want to declare all those constants in one single .h file.Can any one suggest me a way to achieve this.
Thanks in advance.
You can define all required header files and constants in the ProjectName_Prefix.pch(located under the Other Sources folder of your project) file.In this way you are not required to declare the libraries,constants required in multiple classes.
Cheers
create constants.h put all you constants into it and #import "constants.h" in your Prefix.pch
or if you don't want to recompile the whole project if you change something in constants.h just import the file in the sourcefiles where you need it.
The latter approach saves a lot of time if you use an old mac mini for development on a project which has 200MB of png files.

iPhone SDK : How to localize a Class?

I am trying to localize a class (.h & .m files) in my application. I made the same operation as when I localized my interface (xib -> Get info -> make file localizable). I created a second .h and a second .m file, and I made the modifications I needed for the new location. Great !
But it just doesn't work...
I get the error:
duplicate symbol _OBJC_METACLASS_
Does anyone have a clue ? Thanks a lot !
you are just on the wrong path..
For localization you need not create separate .m & .h files.Only Xibs are to be created.
Other than that you have to create separate Localizable.strings file for each localization.
For more understanding just chk out this link http://www.switchonthecode.com/tutorials/a-simple-localization-example-for-the-iphone
It contains the link for downloading the sample code also.

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

Issue in including AVAudioPlayer

I'm trying to use this class as
AVAudioPlayer *newPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL: fileURL error: nil];
And getting this compiler error
error: AVAudioPlayer.h no such file or directory
I have added #import "AVAudioPlayer.h at the beginning of the .m file
Could you let me know how can I fix it?
Thanks
Instead of
#import "AVAudioPlayer.h"
Try
#import <AVFoundation/AVAudioPlayer.h>
Add the AVFoundation framework to your project.
The problem is in the fact that as the Fistman said, you probably did not add the Framework to your project.
You need to go to the Frameworks folder (in your project tree on the left side, usually just bellow the Resources folder), right click on Frameworks->Add->Existing Frameworks..' and pick AVFoundation from the list.
Notice that by default XCode will open the frameworks folder of your set Active SDK and so it must be at least OS 2.2 in order to show up (that's the earliest version when apple released it).
Once you added the framework, it should compile and link and you wouldn't have to add the h files manually.
Hope it helped,
-Adi