Adding SQLite Library -ios5 - iphone

I am working on iOS5.I am new for SQLite. I have created database named DemoDB.sqlite
Now for making connection with database I have added libsql3.0.dylib -library for SQLite.
But I received an error. "Error in readDataFromDatabase method"
Which library should I add?
-(void) readDataFromDatabase
{
sqlite3 *database;
}
The error I received is "use of undeclared identifier database"

The compiler cannot see the declaration of the sqlite 3 struct. Try importing or including the main SQLite3 API header file:
#include <sqlite3.h>
or
#import <sqlite3.h>

Yes, The Compiler cannot see the declaration of the sqlite3 library ,So you have to import it by
#import "/usr/include/sqlite3.h"
or
#import <sqlite3.h>
it will work after that .

Related

RestKit Swift Error "Value of type 'RKObjectManager' has no member 'managedObjectStore'"

I have installed RestKit 0.26 using cocoapods and importing RestKit in Bridging-Header as following :
#import <CoreData/CoreData.h>
#import <RestKit/CoreData.h>
#import <RestKit/RestKit.h>
In AppDelegate.swift Im trying to initialise RestKit but facing this error "Value of type 'RKObjectManager' has no member 'managedObjectStore'" on following code line
self.rkManagedObjectStore = RKManagedObjectStore(managedObjectModel:self.managedObjectModel)
self.rkObjectManager.managedObjectStore = self.rkManagedObjectStore
Its more likely this existing error but in Swift
Any helping pointer?
Thanks,

NSObject category class method not recognized

I created a category on top on NSObject, because I want ALL of my classes to inherit 2 class methods I wrote:
#interface NSObject (MyCategory)
+ (MyEnum) getXYZ;
+ (void) setXYZ:(MyEnum)myEnum;
#end
Then I imported this category into my PCH file:
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "NSObject+MyCategory.h"
#endif
Then I used the method in one of my classes:
[[self class]getXYZ];
and got this error in runtime:
+[MyClass getXYZ]: unrecognized selector sent to class 0xd04f4
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '+[MyClass getXYZ]: unrecognized selector sent to class 0xd04f4'
Did I do something wrong?
Is the category written well?
Are class methods not inherited?
Should I use [super class] instead of [self class]?
Is the PCH file the place to import my category?
Thanks,
Nur
i suppose you have not defined getXYZ method in the implementation file (.m) of category(NSOBject).and for calling the class method of NSObject...use
[NSObject getXYZ];
not
[[self class]getXYZ];
If your category is in an other project that your main project you have to add linker flag "-all_load"
You shouldn't import your Categories in your prefix header (.pch) file. In most cases you only need your category in a few other files, so only import them there. Only import files in your prefix header that are used throughout the whole project.
If you're sure you want to have that category in your prefix header, try setting the Build Setting Precompile Prefix Header to No. Or clean the project. Sometimes Xcode forgets to recompile the prefix header.

NSValue may not respond to... warning

I'm getting a warning in XCode which says NSValue may not respond to +valueWithCMTime:' but I'm not sure what I'm doing wrong. In my header file, I have this:
#import <Foundation/Foundation.h>
#import <CoreMedia/CoreMedia.h>
...
-(void)displayTime:(CMTime)time;
and in my implementation file, I have this:
-(void)displayTime:(CMTime)time
{
//This line has the warning
[mutableArray addObject:[NSValue valueWithCMTime:time]];
}
I've used the above line elsewhere in another class and there's no warning, so what could be missing from this one? Is it something to do with the way the method is set up?
You've probably forgotten to import the AVFoundation headers.
#import <AVFoundation/AVFoundation.h>
The iPhone class NSValue has no valueWithCMTime.
Check out the online documentation
It is added by AVFoundation framework, as documented here.
Added the corresponding header inclusion :
#import <AVFoundation/AVFoundation.h>
Make an NSMutableArray.... because you need an NSValue

Cannot find protocol declaration for 'NSPasteboardWriting'

I am getting this error
Cannot find protocol declaration for 'NSPasteboardWriting'
i have created the class
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#interface ErrorLog : NSObject<NSCoding, NSPasteboardWriting, NSPasteboardReading> {
}
#end
Can any one tell me that whether i am missing some header file or whats the reason for that?
NSPasteboardWriting is Available in Mac OS X v10.6 and later.
check your project setting(Base SDK).
Import the header file in which NSPasteboardWriting and NSPasteboardReading protocols are declared. Also make sure you have the protocols in the class specified.

ABPersonRef - usage

Trying to create a object for ABPersonRef
example:
ABpersonRef ref;
have included Addressbook and AddressBookUI framework
even then when i compile it states 'ABPersonRef' Undeclared Identifier
Have you added imports to your source file?
#import <AddressBook/AddressBook.h>
#import <AddressBookUI/AddressBookUI.h>
Edit: I've read your question more carefully. There's no ABPersonRef type (at least public) in iPhone SDK. You should work with ABRecordRef type which is generic for both person and group records - as you can see all AB*** methods work with ABRecordRef type.
You will also need to link against AddressBook framework and
#import <AddressBook/AddressBook.h>