user3446535 user3446535 - 4 months ago 56
Objective-C Question

Codename one Native IOS implementation error: .h file not found

I need to log in with Facebook using a Native Implementation on iOS in order to change the login behaviour to web view. In order to achieve this I need to

#import
the Facebook SDK. I only need the
FBSDKLoginKit.framework
file. So I downloaded the Facebook SDK from the Facebook developer site and I copied the
FBSDKLoginKit.framework
file from the SDK to the native/iOS directory in my cn1 project. This is my native code:

#import "za_co_bonyelo_mibrand_NativeImplImpl.h"
#import <FBSDKLoginKit/Headers/FBSDKLoginKit.h>
@implementation za_co_bonyelo_mibrand_NativeImplImpl

-(void)facebookLogin {
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login setLoginBehavior:FBSDKLoginBehaviorWeb];
[login logInWithReadPermissions:@[@"public_profile"]
fromViewController:nil handler:^(FBSDKLoginManagerLoginResult
*result, NSError *error) {
NSLog(@"");
}];
}

-(BOOL)isSupported {
return YES;
}

@end


When I send the build I get a build error and the log says:
FBSDKLoginKit/Headers/FBSDKLoginKit.h
File not found. I tried putting the import into "quotations" instead of <>, I also tried removing the
.framework
file because I know cn1 already have the SDK installed but I still got the same error. What am I doing wrong here? Do I need the directory in which the SDK is stored on the cn1 servers or am I importing it wrong. I added the framework to an XCode project and added the same code and I get no compilation errors. I also added the build hint:

ios.add_libs=F.framework;Second.framework;FBSDKLoginKit.framework


Thank You.

UPDATE. Build error:

** BUILD FAILED **


The following build commands failed:
CompileC /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build8449449665536309564xxx/dist/build/Build/Intermediates/Pods.build/Release-iphoneos/Bolts.build/Objects-normal/armv7/BFAppLinkNavigation.o Bolts/Bolts/iOS/BFAppLinkNavigation.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build8449449665536309564xxx/dist/build/Build/Intermediates/Pods.build/Release-iphoneos/Bolts.build/Objects-normal/armv7/BFCancellationToken.o Bolts/Bolts/Common/BFCancellationToken.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build8449449665536309564xxx/dist/build/Build/Intermediates/Pods.build/Release-iphoneos/Bolts.build/Objects-normal/armv7/BFCancellationTokenRegistration.o Bolts/Bolts/Common/BFCancellationTokenRegistration.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build8449449665536309564xxx/dist/build/Build/Intermediates/Pods.build/Release-iphoneos/Bolts.build/Objects-normal/armv7/BFCancellationTokenSource.o Bolts/Bolts/Common/BFCancellationTokenSource.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build8449449665536309564xxx/dist/build/Build/Intermediates/Pods.build/Release-iphoneos/Bolts.build/Objects-normal/armv7/BFExecutor.o Bolts/Bolts/Common/BFExecutor.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(5 failures)

I also found errors like these when I looked through the logs.

/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:52:31: error: expected '>'
@interface BFTask<__covariant ResultType> : NSObject
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:52:31: error: unknown type name 'ResultType'; did you mean 'ResType'?
@interface BFTask<__covariant ResultType> : NSObject
^~~~~~~~~~
ResType
In module 'UIKit' imported from /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Target Support Files/Bolts/Bolts-prefix.pch:2:
In module 'Darwin' imported from /Applications/Xcode6.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKitDefines.h:8:
/Applications/Xcode6.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk/usr/include/MacTypes.h:292:41: note: 'ResType' declared here
typedef FourCharCode ResType;
^
In file included from /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.m:11:
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:52:41: error: expected identifier or '('
@interface BFTask<__covariant ResultType> : NSObject
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:63:33: error: expected a type
+ (instancetype)taskWithResult:(nullable ResultType)result;
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:63:1: error: missing context for method declaration
+ (instancetype)taskWithResult:(nullable ResultType)result;
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:69:1: error: expected method body
+ (instancetype)taskWithError:(NSError *)error;
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:75:1: error: missing context for method declaration
+ (instancetype)taskWithException:(NSException *)exception;
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:80:1: error: expected method body
+ (instancetype)cancelledTask;
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:87:46: error: expected a type
+ (instancetype)taskForCompletionOfAllTasks:(nullable NSArray<BFTask *> *)tasks;
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:87:1: error: missing context for method declaration
+ (instancetype)taskForCompletionOfAllTasks:(nullable NSArray<BFTask *> *)tasks;
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:95:1: error: expected method body
+ (instancetype)taskForCompletionOfAllTasksWithResults:(nullable NSArray<BFTask *> *)tasks;
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:103:45: error: expected a type
+ (instancetype)taskForCompletionOfAnyTask:(nullable NSArray<BFTask *> *)tasks;
^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6712163475603117880xxx/dist/Pods/Bolts/Bolts/Common/BFTask.h:103:1: error: missing context for method declaration
+ (instancetype)taskForCompletionOfAnyTask:(nullable NSArray<BFTask *> *)tasks;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

Answer

I think #import <FBSDKLoginKit/FBSDKLoginKit.h> should normally be the right value. But really, I recommend you to work with Cocoapods!

Comments