Google Cloud Endpoints linking iOS client issues - ios

This problem arises from the fact I don't completely understand static libraries in iOS and the docs from google seem to be a little sparse.
I am trying to use Google Cloud Endpoints for my mobile backend.
I generate the .m and .h files for my client library. Then I created a new project(OwnItApi), dragged the libGTLTouchStaticLib.a static library from GTL.proj to this new project. Then I add the generated files .m and .h files to this project. I add all the .m files to the Compile Sources and then I the header files Copy Files. In the Build Settings I add "-ObjC -all_load" to the Other Linker Flags item.
Update: I forgot to mention that I also copied the headers from the GTL.proj to OwnItAPI project. These include files GTLBase64.h, GTLBatchQuery.h, GTLBatchResult,h, etc. I think I had to do this because the build was failing without them.
Without the headers, I get: the error "'GTLObject.h'file not found." on the import statement.
Then I take the static library generated from this project and add it to my main project whose target is an iphone app. To test if the API is working, I added this to App Delegate
#import "OwnItApi/GTLServiceOwnit.h"
#import "OwnItApi/GTLQueryOwnit.h"
#import "OwnItApi/GTLOwnitApiBrands.h"
This is inside the application:didFinishLaunchingWithOptions: function
static GTLServiceOwnit *service = nil;
if (!service) {
service = [[GTLServiceOwnit alloc] init];
service.retryEnabled = YES;
[GTMHTTPFetcher setLoggingEnabled:YES];
}
GTLQueryOwnit *query = [GTLQueryOwnit queryForBrandsListWithUserID:#"venkat"];
[service executeQuery:query completionHandler:^(GTLServiceTicket *ticket, GTLOwnitApiBrands *object, NSError *error) {
NSArray *items = [object brands];;
NSLog(#"%#", items);
}];
When I compile I get duplicate errors like this:
duplicate symbol _OBJC_METACLASS_$_GTLOwnitApiBrand in:
/Users/vrao/Library/Developer/Xcode/DerivedData/Own_It!-ertvnctptaddricdrjyrmgemzgsh/Build/Products/Release-iphoneos/libOwnItApi.a(GTLOwnit_Sources.o)
17 errors that look just like that. and then finally
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Update: In GTL project, libGTLTouchStaticLib.a is red after I build it and when I right click it the "Show in Finder" is greyed out. To find the .a file I use "Show in Finder" for "GTL.framework" and then go back a folder to find libGTLTouchStaticLib.a.

I believe you're seeing the issue you see because you're also including the GTLOwnit_Sources.m file. You can omit this from the list of files you include.

Related

Duplicate symbol error with GoogleCast.framework

I just started porting an Android app to iOS, and am hitting a major roadblock that I can't figure out despite scouring many similar questions.
I am attempting to follow the pattern implemented in the CastVideos sample where the GoogleCast API is encapsulated in a singleton class which I've called CastManager. To use my singleton class, I #import "CastManager.h" in AppDelegate.m. Then in CastManager.h, I #import <GoogleCast/GoogleCast.h> so that I can use classes and protocols from it as part of CastManager's public interface. However, because I'm importing CastManager.h in both CastManager.m and AppDelegate.m, the linker is finding duplicate symbols from the GoogleCast framework.
This is my CastManager.h:
#import <GoogleCast/GoogleCast.h>
#import <Foundation/Foundation.h>
#interface CastManager : NSObject
#property(nonatomic, strong) GCKDeviceScanner *deviceScanner;
+ (instancetype)sharedCastManager;
#end
And corresponding CastManager.m:
#import "CastManager.h"
#implementation CastManager
+ (instancetype)sharedCastManager {
NSLog(#"sharedCastManager");
static CastManager *singleton = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
singleton = [[self alloc] init];
});
return singleton;
}
- (instancetype)init {
NSLog(#"init()");
if (self = [super init]) {
self.deviceScanner = [[GCKDeviceScanner alloc] init];
}
return self;
}
#end
And this is the main part of my AppDelegate.m:
#import "AppDelegate.h"
#import "CastManager.h"
#implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
CastManager *castManager = [CastManager sharedCastManager];
return YES;
}
However, this results in the following error from the linker when attempting to build the project:
duplicate symbol _kGCKDeviceCapabilityVideoOut in:
/Users/nate/Library/Developer/Xcode/DerivedData/MyCastApp-ezrgxdnlvywpanerezulnarzknno/Build/Intermediates/MyCastApp.build/Debug-iphonesimulator/MyCastApp.build/Objects-normal/x86_64/AppDelegate.o
/Users/nate/Library/Developer/Xcode/DerivedData/MyCastApp-ezrgxdnlvywpanerezulnarzknno/Build/Intermediates/MyCastApp.build/Debug-iphonesimulator/MyCastApp.build/Objects-normal/x86_64/CastManager.o
... many similar errors ommitted for brevity ...
duplicate symbol _kGCKDeviceCapabilityAudioIn in:
/Users/nate/Library/Developer/Xcode/DerivedData/MyCastApp-ezrgxdnlvywpanerezulnarzknno/Build/Intermediates/MyCastApp.build/Debug-iphonesimulator/MyCastApp.build/Objects-normal/x86_64/AppDelegate.o
/Users/nate/Projects/MyCastApp/GoogleCast.framework/GoogleCast(GCKDevice.o)
ld: 8 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
As far as I can tell, this exactly copies the pattern as defined in the CastVideos sample, but the sample compiles fine, and mine doesn't, and I've scoured through both projects trying to find what is different, but I just don't see it. Further, I don't see anything really wrong with doing this, and would expect it to work fine. I can't think of any other way to do it, really.
Here are the relevant files from the CastVideos sample for comparison:
ChromecastDeviceController.h
ChromecastDeviceController.m
AppDelegate.m
Other questions point to solutions that don't apply or don't fix it:
I'm not importing a .m file on accident.
I don't have duplicate references to any files in the project.
The "Compile Sources" section of the "Build Phases" project setting doesn't include any duplicates.
I've added the '-ObjC' linker flag as described by the GoogleCast API docs, though it has the same error with or without it.
I've tried deleting the delegate data and doing a clean before building.
This is with Xcode 6.3.1 running on OS X Yosemite 10.10.3 and the GoogleCastSDK-2.6.0 package from the SDK documentation page
I have checked in my sample project with the problem at https://github.com/nshafer/MyCastApp
Any help is greatly appreciated!
Edit: the duplicate is somewhat related, it's definitely about the same symbols, but the answers there didn't help, as I'm not using Object-C++, but rather just Objective-C. I don't have a .mm file, just a .m file.
For me it helped to switch the "No Common Blocks" compiler setting to NO:
It pretty much seems to make sense, the setting is explained here: What is GCC_NO_COMMON_BLOCKS used for?
The linker tells you that you have a variable named kGCKDeviceCapabilityVideoOut in two files, AppDelegate.m and CastManager.m. Since it's not in your source code, it's most likely in the GoogleCast code that you are including.
Either change the GoogleCast.h file, or make sure it is only included in one .m file. Including it from CastManager.h means it is indirectly included in every file that includes CastManager.h, so I would avoid that and only include it from CastManager.m. You'll probably have to add
#class GCKDeviceScanner;
in your CastManager.h file.
I found another fix, which is to edit GCKDevice.h in the GoogleCast.framework/Headers folder. Change the 4 constants from GCK_EXPORT to GCK_EXTERN near the top of the file.
/** Device capability flag for video out. */
GCK_EXTERN const NSInteger kGCKDeviceCapabilityVideoOut;
/** Device capability flag for video in. */
GCK_EXTERN const NSInteger kGCKDeviceCapabilityVideoIn;
/** Device capability flag for audio out. */
GCK_EXTERN const NSInteger kGCKDeviceCapabilityAudioOut;
/** Device capability flag for audio in. */
GCK_EXTERN const NSInteger kGCKDeviceCapabilityAudioIn;
I detailed this in a bug report I filed with Google's issue tracker, but it was marked as a duplicate of another somewhat related issue. Either way, it will perhaps get fixed in the next version. Until then, I would suggest going with changing the "No Common Blocks" setting as detailed in Joobik'com's answer, as that doesn't involve changing the 3rd party code.

iOS static library, cannot access some class methods

I'm building a static library in iOS. after importing that library in my project, I added -ObjC in Other linker flags. But when I call the class methods(currently 3 available), 2 of them are being called and executed properly, but the last one is getting this error: "+[RankConferenceLib joinConferenceWithName:]: unrecognized selector sent to class 0x5044dc".
This is my Header file of library
#interface RankConferenceLib : NSObject
+(void)initEnvironment;
+(void)orientationChange;
+(void)joinConferenceWithName:(NSString *)name;
#end
in .m file of library
+ (void)joinConferenceWithName:(NSString *)name
{
//....codes
}
and in my project I'm calling them
- (IBAction)join:(UIButton *)sender {
[RankConferenceLib joinConferenceWithName:#"User"];
}
Please tell me what I'm missing here. This is my first static library. I've searched but could not find any help which is similar as my situation here. Please mention what else you need to know.
Thank you.
I have checked this and for me it's working fine without any linker flags added.
The only one error possibility is something happened inside the + (void)joinConferenceWithName:(NSString *)name
Write a log inside the joinConferenceWithName to printout the parameter name and make sure this is calling and the problem is occurring inside that method.
+ (void)joinConferenceWithName:(NSString *)name
{
NSLog(#"the name is: %#", name);
}
Finally, make sure that you added the latest modified static library into your project.
You can download the working sample from here
Try Running using the -all_load linker flag
Apple Documentation
Stack Overflow Answer

iOS writing unit tests for a library

I'm writing a library that adds syntactic sugar to native iOS framework functions. As such, I am extending native types such as NSString and NSArray. For example:
#implementation NSString (NPB)
-(BOOL) includesCharsInString: (NSString *)charsInString
{
NSCharacterSet *charset = [NSCharacterSet characterSetWithCharactersInString:charsInString];
return [self rangeOfCharacterFromSet:charset].location != NSNotFound;
}
#end
In my test framework I include the extended .h files and have the library as a target dependency, and also link against it. However, when I write a test against the library, the tests fail with "unrecognized selector sent to ..." error.
If I include the appropriate .m file in the compile sources list, then it works fine. But if I'm linking against the library, why would I need to do that?
Since the linker can't find any usage of category code, they are, by default, stripped when linking against libraries. In your build settings, add -ObjC to your linker flags.

iOS CoreData: Linker Error even after adding it to target's build phases [duplicate]

I am trying to implement the SVProgressHUD activity indicator. I copied the classes to my project and added the following code to my appDelegate but can't figure out why it crashes.
I get they following error and am not sure where to look to fix it:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_SVProgressHUD", referenced from:
objc-class-ref in QuotesAppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here is the code:
#import "SVProgressHUD.h"
#implementation QuotesAppDelegate
- (void)startLoading
{
//call this in your app delegate instead of setting window.rootViewController to your main view controller
//you can show a UIActivityIndiocatorView here or something if you like
[SVProgressHUD show];
[self performSelectorInBackground:#selector(loadInBackground) withObject:nil];
}
- (void)loadInBackground
{
//do your loading here
//this is in the background, so don't try to access any UI elements
[self populateFromDatabase];
[SVProgressHUD dismiss];
[self performSelectorOnMainThread:#selector(finishedLoading) withObject:nil waitUntilDone:NO];
}
- (void)finishedLoading
{
//back on the main thread now, it's safe to show your view controller
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
}
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[self copyDatabaseIfNeeded];
[self startLoading];
}
Edit
The answer I provided (see My original answer) only fixes the problem, but it's not the correct solution. For correct solutions see Jim answer
It sounds like SVProgressHUD.m isn't enabled for your target. Click on
it in the project navigator in the left-hand pane, then look in the
file inspector in the right-hand pane to make sure there's a tick next
to the target you are building.
or Parth Bhatt link.
For the sake of completeness
Experimenting a little bit, I found that when you drag and drop file or directory within your project, Xcode (4.3.1) asks you to select the right option to add those files or dir to your project. Make sure that that "Add to targets" option is checked.
If you have missed to check that option, you need to following these steps:
Select YourProjectName
Select TARGETS
Select Build Phases
Add .m classes in Compile Sources section
My original answer
If you dragged those classes in your project, it could be the problem.
To avoid that compiling error, use "Add Files to YourProjectName" instead.
Suppose you have a directory that contains .h and .m files called "SVProgressHUD" in your desktop.
Now you have to:
Remove previous files (both .h and .m)
Click with right click in your project
Select "SVProgressHUD" dir with "Add Files to YourProjectName" (select the following check box options: Destination Copy items... and Folders Create groups for any...)
Hope it helps.
It sounds like SVProgressHUD.m isn't enabled for your target. Click on it in the project navigator in the left-hand pane, then look in the file inspector in the right-hand pane to make sure there's a tick next to the target you are building.
Checkout this link. Refer to accepted answer in this link:
Undefined symbols for architecture i386: _OBJC_CLASS_$_SKPSMTPMessage", referenced from: error
If it still doesnt help then refer to Allen Pike's answer in the above link. try removing and adding back QuartzCore framework in your app.
Hope this helps you.
check if you have any objects that you could previously delete without knowing it
check if your all objects are connected , for example if you have a MapView but without a connection, it crashes down
if this doesn't work, try with cleaning the app, or just restarting your iPhone and Xcode
I resolved this issue by changing in Player Settings in the Unity Editor.
menu path:
PlayerSettings > OtherSettings > Scripting Backend change to IL2CPP from Mono2x.
Second change was to change the Architecture to universal.

Can anyone help me setting up the Salesforce Mobile SDK for iOS?

I'm having a horrible time getting this thing to work at all. I've spent two days reading the documentation on Salesforce's website, the example code in the distributed SDK and just generally beating my head against the wall.
The most frustrating part is that I think I'm just missing the login screen, but I can't find anything that will tell me how to make one. From what I can tell, it's just a UIWebView that points to the SF login page.
Here's what I've been able to figure out so far:
Added the SDK to my project (SalesforceSDK, SalesforceOAuth, RestKit) and linked against all the libraries that are mentioned in the Git readme.
Included "SFRestAPI.h" in my server communications class I'm using to send and receive data from the server.
Called the SFRestRequest using the code from the XCode template that's distributed with the SDK:
SFRestRequest *request = [[SFRestAPI sharedInstance] requestForQuery:#"SELECT Name FROM User LIMIT 10"];
[[SFRestAPI sharedInstance] send:request delegate:self];
Added the delegate methods:
#pragma mark - Salesforce REST API delegate methods
- (void)request:(SFRestRequest *)request didLoadResponse:(id)jsonResponse
{
NSLog(#"%#", jsonResponse);
}
- (void)request:(SFRestRequest *)request didFailLoadWithError:(NSError*)error
{
NSLog(#"%#", error);
}
- (void)requestDidCancelLoad:(SFRestRequest *)request
{
NSLog(#"%#", request);
}
- (void)requestDidTimeout:(SFRestRequest *)request
{
NSLog(#"%#", request);
}
5. Saw this in the console:
`2012-09-11 10:23:44.128 ClientApp[39697:c07] SFRestAPI::send: <SFRestRequest 0xd4a9cb0
endpoint: /services/data
method: GET
path: /v23.0/query
queryParams: {
"q" : "SELECT Name FROM User LIMIT 10"
}`
None of the delegate methods for SFRestRequest were called.
Here's what hasn't worked:
Making my app delegate a subclass of SFNativeRestAppDelegate
This created about 12 duplicate symbol errors:
duplicate symbol _OBJC_CLASS_$_SFNativeRestAppDelegate in:
/Volumes/Wallace/Users/gromitt/Library/Developer/Xcode/DerivedData/ClientApp-bpccblcllzkzvudxtwutuqliagld/Build/Intermediates/ClientApp.build/Debug-iphonesimulator/ClientApp.build/Objects-normal/i386/SFNativeRestAppDelegate.o
/Volumes/Wallace/Users/gromitt/Documents/Out to Lunch/ iOS Apps/ClientApp/ClientApp/dependencies/SalesforceSDK/libSalesforceSDK.a(SFNativeRestAppDelegate.o)
duplicate symbol _OBJC_IVAR_$_SFNativeRestAppDelegate._authViewController in:
/Volumes/Wallace/Users/gromitt/Library/Developer/Xcode/DerivedData/ClientApp-bpccblcllzkzvudxtwutuqliagld/Build/Intermediates/ClientApp.build/Debug-iphonesimulator/ClientApp.build/Objects-normal/i386/SFNativeRestAppDelegate.o
/Volumes/Wallace/Users/gromitt/Documents/Out to Lunch/ iOS Apps/ClientApp/ClientApp/dependencies/SalesforceSDK/libSalesforceSDK.a(SFNativeRestAppDelegate.o)
duplicate symbol _OBJC_IVAR_$_SFNativeRestAppDelegate._viewController in:
/Volumes/Wallace/Users/gromitt/Library/Developer/Xcode/DerivedData/ClientApp-bpccblcllzkzvudxtwutuqliagld/Build/Intermediates/ClientApp.build/Debug-iphonesimulator/ClientApp.build/Objects-normal/i386/SFNativeRestAppDelegate.o
/Volumes/Wallace/Users/gromitt/Documents/Out to Lunch/ iOS Apps/ClientApp/ClientApp/dependencies/SalesforceSDK/libSalesforceSDK.a(SFNativeRestAppDelegate.o)
duplicate symbol _OBJC_IVAR_$_SFNativeRestAppDelegate._window in:
/Volumes/Wallace/Users/gromitt/Library/Developer/Xcode/DerivedData/ClientApp-bpccblcllzkzvudxtwutuqliagld/Build/Intermediates/ClientApp.build/Debug-iphonesimulator/ClientApp.build/Objects-normal/i386/SFNativeRestAppDelegate.o
/Volumes/Wallace/Users/gromitt/Documents/Out to Lunch/ iOS Apps/ClientApp/ClientApp/dependencies/SalesforceSDK/libSalesforceSDK.a(SFNativeRestAppDelegate.o)
duplicate symbol _OBJC_METACLASS_$_SFNativeRestAppDelegate in:
/Volumes/Wallace/Users/gromitt/Library/Developer/Xcode/DerivedData/ClientApp-bpccblcllzkzvudxtwutuqliagld/Build/Intermediates/ClientApp.build/Debug-iphonesimulator/ClientApp.build/Objects-normal/i386/SFNativeRestAppDelegate.o
/Volumes/Wallace/Users/gromitt/Documents/Out to Lunch/ iOS Apps/ClientApp/ClientApp/dependencies/SalesforceSDK/libSalesforceSDK.a(SFNativeRestAppDelegate.o)
duplicate symbol _kDefaultLoginHost in:
/Volumes/Wallace/Users/gromitt/Library/Developer/Xcode/DerivedData/ClientApp-bpccblcllzkzvudxtwutuqliagld/Build/Intermediates/ClientApp.build/Debug-iphonesimulator/ClientApp.build/Objects-normal/i386/SFNativeRestAppDelegate.o
/Volumes/Wallace/Users/gromitt/Documents/Out to Lunch/ iOS Apps/ClientApp/ClientApp/dependencies/SalesforceSDK/libSalesforceSDK.a(SFAccountManager.o)
ld: 6 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any help is appreciated. Thanks in advance.
Targets-> build Settings —> other Linker Flags
As specified in the Rest Kit Tutorial we changed added a flag called -ObjC-all_load now edit that to just display -ObjC and then the application works like a charm.
Hope this helps those people who are facing this issue in the future.
So this is more than a little embarrassing, but I don't want people to keep trying to answer this problem so here goes:
I had two copies of SFNativeAppDelegate.h added to my app. I was looking through the files included in the SF Mobile SDK, and I must have skipped over it. So I added it a second time, and that's when my problems started.
I have it working now. Here's what I did:
Create a Native app using the SalesForce project template.
Go to your Native app's directory in the Finder. Copy the dependencies directory into your existing project.
Open the Native project in XCode and copy over the Settings.bundle to your existing project. Grab the SFAuthorizingViewController.xib while you're in there, too. Close the Native project. You don't need it anymore.
Open your existing app's plist file. Add a key named SFDCOAuthLoginHost, and set it to either test.salesforce.com or login.salesforce.com
In your existing app delegate, include SFNativeAppDelegate.h, SFOAuthCoordinator.h and
SFOAuthCredentials.h
Change the interface declaration line from this:
#interface YourAppDelegate : UIResponder <UIApplicationDelegate>
...to this:
#interface YourAppDelegate : SFNativeRestAppDelegate
Add two properties to YourAppDelegate:
#property (nonatomic, readonly) SFOAuthCoordinator *coordinator;
#property (nonatomic, retain) SFAuthorizingViewController *authViewController;
Go to YouAppDelegate.m. Add the following lines:
// Fill these in when creating a new Remote Access client on Force.com
static NSString *const RemoteAccessConsumerKey = #"...yourConsumerKeyGoesHere...";
static NSString *const OAuthRedirectURI = #"https://test.salesforce.com/services/oauth2/success";
Add these methods as well (the Authorizing Coordinator was the secret sauce I was missing)
#pragma mark - Salesforce.com login helpers
- (NSString*)remoteAccessConsumerKey {
return RemoteAccessConsumerKey;
}
- (NSString*)oauthRedirectURI {
return OAuthRedirectURI;
}
-(NSString *)oauthLoginDomain {
return #"test.salesforce.com";
}
-(void)login{
[self.coordinator authenticate];
}
- (void)logout {
[self.coordinator revokeAuthentication];
[self.coordinator authenticate];
}
- (void)loggedIn {
//provide the Rest API with a reference to the coordinator we used for login
[[SFRestAPI sharedInstance] setCoordinator:self.coordinator];
//[[SFRestAPI sharedInstance] setApiVersion:#"24.0"];
}
- (UIViewController*)newRootViewController {
NSLog(#"You must override this method in your subclass");
[self doesNotRecognizeSelector:#selector(newRootViewController)];
return nil;
}
- (SFOAuthCoordinator*)coordinator {
//create a new coordinator if we don't already have one
if (nil == _coordinator) {
NSString *appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleNameKey];
NSString *loginDomain = [self oauthLoginDomain];
NSString *accountIdentifier = [self userAccountIdentifier];
//here we use the login domain as part of the identifier
//to distinguish between eg sandbox and production credentials
NSString *fullKeychainIdentifier = [NSString stringWithFormat:#"%#-%#-%#",appName,accountIdentifier,loginDomain];
SFOAuthCredentials *creds = [[SFOAuthCredentials alloc]
initWithIdentifier:fullKeychainIdentifier
clientId: [self remoteAccessConsumerKey] encrypted:NO ];
creds.domain = loginDomain;
creds.redirectUri = [self oauthRedirectURI];
SFOAuthCoordinator *coord = [[SFOAuthCoordinator alloc] initWithCredentials:creds];
coord.scopes = [[self class] oauthScopes];
coord.delegate = self;
_coordinator = coord;
}
return _coordinator;
}
Now you're ready to make a call using the SFRestAPI. If the user hasn't already logged in, the SalesForce authentication page will appear the first time you try to use it.
Thanks to everyone who tried to help. Again, super-embarrassed.
Let's start with the SFNativeRestAppDelegate issues, as ultimately, you want to inherit from that class, so that you can get authentication "for free".
Assuming you don't actually define SFNativeRestAppDelegate somewhere in your developed app, it looks like you may have build state issues that are causing the conflicts you're seeing. When I see duplicate symbols issues between a referenced static library and random symbols down in the DerivedData folder, I usually take the following actions:
Close out Xcode.
Blow away DerivedData entirely (rm -rf ~/Library/Developer/Xcode/DerivedData/* — This is temporary build data, and will be regenerated with your next Xcode build).
Optionally, blow away the Xcode project state data for my app (rm -rf MyProjectDir/MyProjectDir.xcodeproj/project.xcworkspace/ MyProjectDir/MyProjectDir.xcodeproj/xcuserdata/), just to make sure my project state is clean.
When you're able to inherit from SFNativeRestAppDelegate, all of the authentication linkage should happen behind the scenes, including setting up [SFRestAPI sharedInstance] with the credentials it needs to make authenticated calls to the service. It looks like not being able to inherit from SFNativeRestAppDelegate is the crux of your problem. Once that's done, the pattern you've described for REST API access looks correct.
If you have further follow-up questions, you can also consult with the folks on the Mobile board at developerforce.com.
Did u set the class with the SFRestAPI delegate??
#interface GSK_SFADataSyncManager : NSObject < SFRestDelegate >
SFRestRequest *request = [[SFRestAPI sharedInstance] requestForQuery:query];
[[SFRestAPI sharedInstance] send:request delegate:self];
Try clearing your search path from the Build settings... do u have any other lib along with this??

Resources