Open eyale opened 5 years ago
any uupdate here?
For me the file does not exist in DerivedData../../../include/React/
my solution is going to node_modules/react-native-fbsdk/ios/RCTFBSDK/login/RCTFBSDKLoginButtonManager.m
change to
#import "RCTFBSDKLoginButtonManager.h"
#import <React/RCTBridge.h>
#import <React/RCTEventDispatcher.h>
#import <React/RCTUtils.h>
#import <React/UIView+React.h>
#import "RCTConvert+FBSDKLogin.h"
@implementation RCTFBSDKLoginButtonManager
RCT_EXPORT_MODULE(RCTFBLoginButton)
#pragma mark - Object Lifecycle
- (UIView *)view
{
FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init];
loginButton.delegate = self;
return loginButton;
}
#pragma mark - Properties
RCT_EXPORT_VIEW_PROPERTY(readPermissions, NSStringArray)
RCT_EXPORT_VIEW_PROPERTY(publishPermissions, NSStringArray)
RCT_CUSTOM_VIEW_PROPERTY(loginBehaviorIOS, FBSDKLoginBehavior, FBSDKLoginButton)
{
[view setLoginBehavior:json ? [RCTConvert FBSDKLoginBehavior:json] : FBSDKLoginBehaviorNative];
}
RCT_EXPORT_VIEW_PROPERTY(defaultAudience, FBSDKDefaultAudience)
RCT_CUSTOM_VIEW_PROPERTY(tooltipBehaviorIOS, FBSDKLoginButtonTooltipBehavior, FBSDKLoginButton)
{
[view setTooltipBehavior:json ? [RCTConvert FBSDKLoginButtonTooltipBehavior:json] : FBSDKLoginButtonTooltipBehaviorAutomatic];
}
#pragma mark - FBSDKLoginButtonDelegate
- (void)loginButton:(FBSDKLoginButton *)loginButton didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result error:(NSError *)error
{
NSDictionary *event = @{
@"type": @"loginFinished",
@"target": loginButton.reactTag,
@"error": error ? RCTJSErrorFromNSError(error) : [NSNull null],
@"result": error ? [NSNull null] : @{
@"isCancelled": @(result.isCancelled),
@"grantedPermissions": result.isCancelled ? [NSNull null] : result.grantedPermissions.allObjects,
@"declinedPermissions": result.isCancelled ? [NSNull null] : result.declinedPermissions.allObjects,
},
};
[self.bridge.eventDispatcher sendInputEventWithName:@"topChange" body:event];
[self.bridge.eventDispatcher sendEvent:event];
}
- (void)loginButtonDidLogOut:(FBSDKLoginButton *)loginButton
{
NSDictionary *event = @{
@"target": loginButton.reactTag,
};
[self.bridge.eventDispatcher sendInputEventWithName:@"topChange" body:event];
[self.bridge.eventDispatcher sendEvent:event];
}
@end
thats great, i wonder why i cant find the RCTComponentEvent file itself :/
Or in package.json replace package version to previous commit
"react-native-fbsdk": "github:facebook/react-native-fbsdk#5fe8e726966faf83d3388af85dd9740f4015e5d6",
Same issue
@hramos Hey! Any fix for this?
I need to use different commits for ios & android to build my app.
same issue here, any help would be very appreciated
I am also experiencing this issue.
I think I figured out what is happening. Inside my app's pod spec, I was referencing the dependency like so:
pod 'react-native-fbsdk', :podspec => node_modules_path + '/react-native-fbsdk/react-native-fbsdk.podspec'
This is bad because it will pull the latest commit from master. Instead of doing it this way, I referenced the path:
pod 'react-native-fbsdk', :path => node_modules_path + '/react-native-fbsdk'
This solved my issue.
This I tried with all above solutions. Its yet same. I am on rc1, I tried 0.8.0. 0.9.0, nothing works. Any update?
1.0.0-rc.3 still have this problem.
We need to wait while RN team will release React/RCTComponentEvent.h
component, right? Before that we stuck with old version of fbsdk?
Based on @eyale
// Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
//
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
// copy, modify, and distribute this software in source code or binary form for use
// in connection with the web services and APIs provided by Facebook.
//
// As with any software that integrates with the Facebook platform, your use of
// this software is subject to the Facebook Developer Principles and Policies
// [http://developers.facebook.com/policy/]. This copyright notice shall be
// included in all copies or substantial portions of the software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#import "RCTFBSDKLoginButtonManager.h"
#import <React/RCTBridge.h>
//#import <React/RCTComponentEvent.h>
#import <React/RCTEventDispatcher.h>
#import <React/RCTUtils.h>
#import <React/UIView+React.h>
#import "RCTConvert+FBSDKLogin.h"
@implementation RCTFBSDKLoginButtonManager
RCT_EXPORT_MODULE(RCTFBLoginButton)
#pragma mark - Object Lifecycle
- (UIView *)view
{
FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init];
loginButton.delegate = self;
return loginButton;
}
#pragma mark - Properties
RCT_EXPORT_VIEW_PROPERTY(permissions, NSStringArray)
RCT_CUSTOM_VIEW_PROPERTY(loginBehaviorIOS, FBSDKLoginBehavior, FBSDKLoginButton)
{
[view setLoginBehavior:json ? [RCTConvert FBSDKLoginBehavior:json] : FBSDKLoginBehaviorBrowser];
}
RCT_EXPORT_VIEW_PROPERTY(defaultAudience, FBSDKDefaultAudience)
RCT_CUSTOM_VIEW_PROPERTY(tooltipBehaviorIOS, FBSDKLoginButtonTooltipBehavior, FBSDKLoginButton)
{
[view setTooltipBehavior:json ? [RCTConvert FBSDKLoginButtonTooltipBehavior:json] : FBSDKLoginButtonTooltipBehaviorAutomatic];
}
#pragma mark - FBSDKLoginButtonDelegate
- (void)loginButton:(FBSDKLoginButton *)loginButton didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result error:(NSError *)error
{
NSDictionary *body = @{
@"type": @"loginFinished",
@"error": error ? RCTJSErrorFromNSError(error) : [NSNull null],
@"result": error ? [NSNull null] : @{
@"isCancelled": @(result.isCancelled),
@"grantedPermissions": result.isCancelled ? [NSNull null] : result.grantedPermissions.allObjects,
@"declinedPermissions": result.isCancelled ? [NSNull null] : result.declinedPermissions.allObjects,
},
};
[self.bridge.eventDispatcher sendInputEventWithName:@"topChange" body:body];
// RCTComponentEvent *event = [[RCTComponentEvent alloc] initWithName:@"topChange"
// viewTag:loginButton.reactTag
// body:body];
// [self.bridge.eventDispatcher sendEvent:event];
}
- (void)loginButtonDidLogOut:(FBSDKLoginButton *)loginButton
{
NSDictionary *body = @{
@"type": @"logoutFinished",
};
[self.bridge.eventDispatcher sendInputEventWithName:@"topChange" body:body];
// RCTComponentEvent *event = [[RCTComponentEvent alloc] initWithName:@"topChange"
// viewTag:loginButton.reactTag
// body:body];
// [self.bridge.eventDispatcher sendEvent:event];
}
@end
Is this correct?
Same issue here using 1.0.0-rc.4
:
node_modules/react-native-fbsdk/ios/RCTFBSDK/login/RCTFBSDKLoginButtonManager.m:22:9: fatal error: 'React/RCTComponentEvent.h' file not found
#import <React/RCTComponentEvent.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Same problem here
My current solution:
1. Add to Podfile
:
post_install do |installer|
fix_fb
end
def fix_fb
node_modules_path = '../node_modules'
patched_text = File.read("./RCTFBSDKLoginButtonManager.m.patch")
File.open("#{node_modules_path}/react-native-fbsdk/ios/RCTFBSDK/login/RCTFBSDKLoginButtonManager.m", "w") {|file| file.puts patched_text}
end
2. Add file yourProject/ios/RCTFBSDKLoginButtonManager.m.patch
// Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
//
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
// copy, modify, and distribute this software in source code or binary form for use
// in connection with the web services and APIs provided by Facebook.
//
// As with any software that integrates with the Facebook platform, your use of
// this software is subject to the Facebook Developer Principles and Policies
// [http://developers.facebook.com/policy/]. This copyright notice shall be
// included in all copies or substantial portions of the software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#import "RCTFBSDKLoginButtonManager.h"
#import <React/RCTBridge.h>
//#import <React/RCTComponentEvent.h>
#import <React/RCTEventDispatcher.h>
#import <React/RCTUtils.h>
#import <React/UIView+React.h>
#import "RCTConvert+FBSDKLogin.h"
@implementation RCTFBSDKLoginButtonManager
RCT_EXPORT_MODULE(RCTFBLoginButton)
#pragma mark - Object Lifecycle
- (UIView *)view
{
FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init];
loginButton.delegate = self;
return loginButton;
}
#pragma mark - Properties
RCT_EXPORT_VIEW_PROPERTY(permissions, NSStringArray)
RCT_CUSTOM_VIEW_PROPERTY(loginBehaviorIOS, FBSDKLoginBehavior, FBSDKLoginButton)
{
[view setLoginBehavior:json ? [RCTConvert FBSDKLoginBehavior:json] : FBSDKLoginBehaviorBrowser];
}
RCT_EXPORT_VIEW_PROPERTY(defaultAudience, FBSDKDefaultAudience)
RCT_CUSTOM_VIEW_PROPERTY(tooltipBehaviorIOS, FBSDKLoginButtonTooltipBehavior, FBSDKLoginButton)
{
[view setTooltipBehavior:json ? [RCTConvert FBSDKLoginButtonTooltipBehavior:json] : FBSDKLoginButtonTooltipBehaviorAutomatic];
}
#pragma mark - FBSDKLoginButtonDelegate
- (void)loginButton:(FBSDKLoginButton *)loginButton didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result error:(NSError *)error
{
NSDictionary *body = @{
@"type": @"loginFinished",
@"error": error ? RCTJSErrorFromNSError(error) : [NSNull null],
@"result": error ? [NSNull null] : @{
@"isCancelled": @(result.isCancelled),
@"grantedPermissions": result.isCancelled ? [NSNull null] : result.grantedPermissions.allObjects,
@"declinedPermissions": result.isCancelled ? [NSNull null] : result.declinedPermissions.allObjects,
},
};
[self.bridge.eventDispatcher sendInputEventWithName:@"topChange" body:body];
// RCTComponentEvent *event = [[RCTComponentEvent alloc] initWithName:@"topChange"
// viewTag:loginButton.reactTag
// body:body];
// [self.bridge.eventDispatcher sendEvent:event];
}
- (void)loginButtonDidLogOut:(FBSDKLoginButton *)loginButton
{
NSDictionary *body = @{
@"type": @"logoutFinished",
};
[self.bridge.eventDispatcher sendInputEventWithName:@"topChange" body:body];
// RCTComponentEvent *event = [[RCTComponentEvent alloc] initWithName:@"topChange"
// viewTag:loginButton.reactTag
// body:body];
// [self.bridge.eventDispatcher sendEvent:event];
}
@end
3. cd ios && pod install
Same issue here using
"react-native-fbsdk": "1.0.0-rc.4",
"react-native": "0.60.0",
Have tried @kesha-antonov method and having error
/node_modules/react-native-fbsdk/ios/RCTFBSDK/login/RCTFBSDKLoginButtonManager.m:56:35: No visible @interface for 'RCTEventDispatcher' declares the selector 'sendInputEventWithName:body:'
Any help would be very appreciated.
same issue with me using
"react-native-fbsdk": "1.0.0-rc.5", "react-native": "0.60.0",
any suggestion would be very helpful.
Now I'm downgrade it to "react-native-fbsdk": "0.8.0", "react-native": "0.59.0" and it is working fine. But you will have change some Old build artifact to AndroidX build artifact by yourself. ( This is just a temporary solution for me )
my solution is going to
node_modules/react-native-fbsdk/ios/RCTFBSDK/login/RCTFBSDKLoginButtonManager.m
change to#import "RCTFBSDKLoginButtonManager.h" #import <React/RCTBridge.h> #import <React/RCTEventDispatcher.h> #import <React/RCTUtils.h> #import <React/UIView+React.h> #import "RCTConvert+FBSDKLogin.h" @implementation RCTFBSDKLoginButtonManager RCT_EXPORT_MODULE(RCTFBLoginButton) #pragma mark - Object Lifecycle - (UIView *)view { FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init]; loginButton.delegate = self; return loginButton; } #pragma mark - Properties RCT_EXPORT_VIEW_PROPERTY(readPermissions, NSStringArray) RCT_EXPORT_VIEW_PROPERTY(publishPermissions, NSStringArray) RCT_CUSTOM_VIEW_PROPERTY(loginBehaviorIOS, FBSDKLoginBehavior, FBSDKLoginButton) { [view setLoginBehavior:json ? [RCTConvert FBSDKLoginBehavior:json] : FBSDKLoginBehaviorNative]; } RCT_EXPORT_VIEW_PROPERTY(defaultAudience, FBSDKDefaultAudience) RCT_CUSTOM_VIEW_PROPERTY(tooltipBehaviorIOS, FBSDKLoginButtonTooltipBehavior, FBSDKLoginButton) { [view setTooltipBehavior:json ? [RCTConvert FBSDKLoginButtonTooltipBehavior:json] : FBSDKLoginButtonTooltipBehaviorAutomatic]; } #pragma mark - FBSDKLoginButtonDelegate - (void)loginButton:(FBSDKLoginButton *)loginButton didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result error:(NSError *)error { NSDictionary *event = @{ @"type": @"loginFinished", @"target": loginButton.reactTag, @"error": error ? RCTJSErrorFromNSError(error) : [NSNull null], @"result": error ? [NSNull null] : @{ @"isCancelled": @(result.isCancelled), @"grantedPermissions": result.isCancelled ? [NSNull null] : result.grantedPermissions.allObjects, @"declinedPermissions": result.isCancelled ? [NSNull null] : result.declinedPermissions.allObjects, }, }; [self.bridge.eventDispatcher sendInputEventWithName:@"topChange" body:event]; [self.bridge.eventDispatcher sendEvent:event]; } - (void)loginButtonDidLogOut:(FBSDKLoginButton *)loginButton { NSDictionary *event = @{ @"target": loginButton.reactTag, }; [self.bridge.eventDispatcher sendInputEventWithName:@"topChange" body:event]; [self.bridge.eventDispatcher sendEvent:event]; } @end
I have a this problem use of undeclared identifier 'FBSDKLoginBehaviorNative'; did you mean 'FBSDKLoginBehaviorBrowser'?
Hi everybody, my solution was this:
1) change the line with the import in RCTFBSDKLoginButtonManager.m:
changed to:
2) select project RCTFBSDK.xcodeproj, select target RCTFBSDK, select Build Settings, search for 'header', select 'Header Search Paths' and add this new line: '${SRCROOT}/../../../node_modules/react-native/React/Base', as non-recursive.
In this way, the FB SDK project can find the file. Hope it helps.
@platenger didn't work for me :( throws other errors
I am having this error as well. I am on
react-native: 0.60.5
react: 16.9.0
react-native-fbsdk: git+https://github.com/facebook/react-native-fbsdk.git
Adding RCTComponentEvent.h
to Copy Headers
under React
target as suggested here solves the problem for me.
However, every time I run yarn or npm, the Libraries
are reset and I have to add the header again. Anyone knows if I can solve this, or should I wait till react-native
adds the header to the React
project and pushes an update?
@BaderSerhan THIS! yes, i'm also under the same situation. It works fine but the change can be easily reverted. I want to know if there's a way too.
@crispywong I think I have the solution for you, based on @kesha-antonov fix:
"react-native-fbsdk": "1.0.1", "react-native": "0.60.4",
// Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
//
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
// copy, modify, and distribute this software in source code or binary form for use
// in connection with the web services and APIs provided by Facebook.
//
// As with any software that integrates with the Facebook platform, your use of
// this software is subject to the Facebook Developer Principles and Policies
// [http://developers.facebook.com/policy/]. This copyright notice shall be
// included in all copies or substantial portions of the software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#import "RCTFBSDKLoginButtonManager.h"
#import <React/RCTBridge.h>
//#import <React/RCTComponentEvent.h>
//#import <React/RCTEventDispatcher.h>
#import <React/RCTUtils.h>
#import <React/UIView+React.h>
#import "RCTConvert+FBSDKLogin.h"
@implementation RCTFBSDKLoginButtonManager
RCT_EXPORT_MODULE(RCTFBLoginButton)
#pragma mark - Object Lifecycle
- (UIView *)view
{
FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init];
loginButton.delegate = self;
return loginButton;
}
#pragma mark - Properties
RCT_EXPORT_VIEW_PROPERTY(permissions, NSStringArray)
RCT_CUSTOM_VIEW_PROPERTY(loginBehaviorIOS, FBSDKLoginBehavior, FBSDKLoginButton)
{
[view setLoginBehavior:json ? [RCTConvert FBSDKLoginBehavior:json] : FBSDKLoginBehaviorBrowser];
}
RCT_EXPORT_VIEW_PROPERTY(defaultAudience, FBSDKDefaultAudience)
RCT_CUSTOM_VIEW_PROPERTY(tooltipBehaviorIOS, FBSDKLoginButtonTooltipBehavior, FBSDKLoginButton)
{
[view setTooltipBehavior:json ? [RCTConvert FBSDKLoginButtonTooltipBehavior:json] : FBSDKLoginButtonTooltipBehaviorAutomatic];
}
#pragma mark - FBSDKLoginButtonDelegate
- (void)loginButton:(FBSDKLoginButton *)loginButton didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result error:(NSError *)error
{
NSDictionary *body = @{
@"type": @"loginFinished",
@"error": error ? RCTJSErrorFromNSError(error) : [NSNull null],
@"result": error ? [NSNull null] : @{
@"isCancelled": @(result.isCancelled),
@"grantedPermissions": result.isCancelled ? [NSNull null] : result.grantedPermissions.allObjects,
@"declinedPermissions": result.isCancelled ? [NSNull null] : result.declinedPermissions.allObjects,
},
};
// [self.bridge.eventDispatcher sendInputEventWithName:@"topChange" body:body];
// RCTComponentEvent *event = [[RCTComponentEvent alloc] initWithName:@"topChange"
// viewTag:loginButton.reactTag
// body:body];
// [self.bridge.eventDispatcher sendEvent:event];
}
- (void)loginButtonDidLogOut:(FBSDKLoginButton *)loginButton
{
NSDictionary *body = @{
@"type": @"logoutFinished",
};
// [self.bridge.eventDispatcher sendInputEventWithName:@"topChange" body:body];
// RCTComponentEvent *event = [[RCTComponentEvent alloc] initWithName:@"topChange"
// viewTag:loginButton.reactTag
// body:body];
// [self.bridge.eventDispatcher sendEvent:event];
}
@end
@crispywong I think I have the solution for you, based on @kesha-antonov fix:
"react-native-fbsdk": "1.0.1", "react-native": "0.60.4",
// Copyright (c) 2015-present, Facebook, Inc. All rights reserved. // // You are hereby granted a non-exclusive, worldwide, royalty-free license to use, // copy, modify, and distribute this software in source code or binary form for use // in connection with the web services and APIs provided by Facebook. // // As with any software that integrates with the Facebook platform, your use of // this software is subject to the Facebook Developer Principles and Policies // [http://developers.facebook.com/policy/]. This copyright notice shall be // included in all copies or substantial portions of the software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #import "RCTFBSDKLoginButtonManager.h" #import <React/RCTBridge.h> //#import <React/RCTComponentEvent.h> //#import <React/RCTEventDispatcher.h> #import <React/RCTUtils.h> #import <React/UIView+React.h> #import "RCTConvert+FBSDKLogin.h" @implementation RCTFBSDKLoginButtonManager RCT_EXPORT_MODULE(RCTFBLoginButton) #pragma mark - Object Lifecycle - (UIView *)view { FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init]; loginButton.delegate = self; return loginButton; } #pragma mark - Properties RCT_EXPORT_VIEW_PROPERTY(permissions, NSStringArray) RCT_CUSTOM_VIEW_PROPERTY(loginBehaviorIOS, FBSDKLoginBehavior, FBSDKLoginButton) { [view setLoginBehavior:json ? [RCTConvert FBSDKLoginBehavior:json] : FBSDKLoginBehaviorBrowser]; } RCT_EXPORT_VIEW_PROPERTY(defaultAudience, FBSDKDefaultAudience) RCT_CUSTOM_VIEW_PROPERTY(tooltipBehaviorIOS, FBSDKLoginButtonTooltipBehavior, FBSDKLoginButton) { [view setTooltipBehavior:json ? [RCTConvert FBSDKLoginButtonTooltipBehavior:json] : FBSDKLoginButtonTooltipBehaviorAutomatic]; } #pragma mark - FBSDKLoginButtonDelegate - (void)loginButton:(FBSDKLoginButton *)loginButton didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result error:(NSError *)error { NSDictionary *body = @{ @"type": @"loginFinished", @"error": error ? RCTJSErrorFromNSError(error) : [NSNull null], @"result": error ? [NSNull null] : @{ @"isCancelled": @(result.isCancelled), @"grantedPermissions": result.isCancelled ? [NSNull null] : result.grantedPermissions.allObjects, @"declinedPermissions": result.isCancelled ? [NSNull null] : result.declinedPermissions.allObjects, }, }; // [self.bridge.eventDispatcher sendInputEventWithName:@"topChange" body:body]; // RCTComponentEvent *event = [[RCTComponentEvent alloc] initWithName:@"topChange" // viewTag:loginButton.reactTag // body:body]; // [self.bridge.eventDispatcher sendEvent:event]; } - (void)loginButtonDidLogOut:(FBSDKLoginButton *)loginButton { NSDictionary *body = @{ @"type": @"logoutFinished", }; // [self.bridge.eventDispatcher sendInputEventWithName:@"topChange" body:body]; // RCTComponentEvent *event = [[RCTComponentEvent alloc] initWithName:@"topChange" // viewTag:loginButton.reactTag // body:body]; // [self.bridge.eventDispatcher sendEvent:event]; } @end
Please don't tell me this isn't the definitive "fix" for this issue. I don't want to start commenting out 3rd party library code to build my app. What's missing? for Facebook to release a version where this ComponentEvent.h is added into the React.xcodeproj headers?
Based on suggestions provided by @kesha-antonov @oded-regev
For me, with the environment
react-native-cli: 2.0.1
react-native: 0.59.10
react-native-fbsdk: 1.0.2
The project can be normally complied with below changes.
RCTFBSDKLoginButtonManager.m
#import "RCTFBSDKLoginButtonManager.h"
#import <React/RCTBridge.h>
#import <React/RCTEventDispatcher.h>
#import <React/RCTUtils.h>
#import <React/UIView+React.h>
#import "RCTConvert+FBSDKLogin.h"
@implementation RCTFBSDKLoginButtonManager
RCT_EXPORT_MODULE(RCTFBLoginButton)
#pragma mark - Object Lifecycle
- (UIView *)view
{
FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init];
loginButton.delegate = self;
return loginButton;
}
#pragma mark - Properties
RCT_EXPORT_VIEW_PROPERTY(readPermissions, NSStringArray)
RCT_EXPORT_VIEW_PROPERTY(publishPermissions, NSStringArray)
RCT_CUSTOM_VIEW_PROPERTY(loginBehaviorIOS, FBSDKLoginBehavior, FBSDKLoginButton)
{
[view setLoginBehavior:json ? [RCTConvert FBSDKLoginBehavior:json] : FBSDKLoginBehaviorBrowser];
}
RCT_EXPORT_VIEW_PROPERTY(defaultAudience, FBSDKDefaultAudience)
RCT_CUSTOM_VIEW_PROPERTY(tooltipBehaviorIOS, FBSDKLoginButtonTooltipBehavior, FBSDKLoginButton)
{
[view setTooltipBehavior:json ? [RCTConvert FBSDKLoginButtonTooltipBehavior:json] : FBSDKLoginButtonTooltipBehaviorAutomatic];
}
#pragma mark - FBSDKLoginButtonDelegate
- (void)loginButton:(FBSDKLoginButton *)loginButton didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result error:(NSError *)error
{
NSDictionary *event = @{
@"type": @"loginFinished",
@"target": loginButton.reactTag,
@"error": error ? RCTJSErrorFromNSError(error) : [NSNull null],
@"result": error ? [NSNull null] : @{
@"isCancelled": @(result.isCancelled),
@"grantedPermissions": result.isCancelled ? [NSNull null] : result.grantedPermissions.allObjects,
@"declinedPermissions": result.isCancelled ? [NSNull null] : result.declinedPermissions.allObjects,
},
};
[self.bridge.eventDispatcher sendInputEventWithName:@"topChange" body:event];
[self.bridge.eventDispatcher sendEvent:event];
}
- (void)loginButtonDidLogOut:(FBSDKLoginButton *)loginButton
{
NSDictionary *event = @{
@"target": loginButton.reactTag,
};
[self.bridge.eventDispatcher sendInputEventWithName:@"topChange" body:event];
[self.bridge.eventDispatcher sendEvent:event];
}
@end
Are you using cocoapods to link libraries? I think it happens only when linking the xcode projects.
Note that RN 0.61 won't include xcode projects anymore so I suggest migrating to cocoapods to link third party deps.
@janicduplessis no, i'm not using cocoapods, i've manually migrated from 0.59 to 0.60.4. I think that messed up my project. Although i was able to make this work by adding ComponentEvent.h into React.xcodeproj within my project, i think it's quite dirty to do that. Should i create a dummy project and move mine to the 0.60.4 version and link each dependency with cocoapods autolink? Happens that i don't know how will that work. I need to add every dependency that i use and supports autolink in the pod file?
same issue on 1.0.2
same issue on 1.0.3 RN 0.59.10 using Cocoapods
I could not upgrade into RN 0.60, because it will ruin all un-support modules.
Having the same issue with RN 0.59.
"react-native": "0.59.10",
"react-native-fbsdk": "^1.0.3",
UPDATE: Had to update the RN to 0.60 to make it work.
I had the same issue using RN 0.59.9
and react-native-fbsdk@1.0.4
.
Downgrading to react-native-fbsdk@0.10.0
fixed the problem for me. Apparently, starting at react-native-fbsdk@1.0.0
, the library assumes RN 0.60.0
.
I had the same issue using RN
0.59.9
andreact-native-fbsdk@1.0.4
.Downgrading to
react-native-fbsdk@0.10.0
fixed the problem for me. Apparently, starting atreact-native-fbsdk@1.0.0
, the library assumes RN0.60.0
.
@KevinDoom Fb login will not work in iOS 13 with this process as the version 1.0.0 only supports version 13.
my solution is going to
node_modules/react-native-fbsdk/ios/RCTFBSDK/login/RCTFBSDKLoginButtonManager.m
change to#import "RCTFBSDKLoginButtonManager.h" #import <React/RCTBridge.h> #import <React/RCTEventDispatcher.h> #import <React/RCTUtils.h> #import <React/UIView+React.h> #import "RCTConvert+FBSDKLogin.h" @implementation RCTFBSDKLoginButtonManager RCT_EXPORT_MODULE(RCTFBLoginButton) #pragma mark - Object Lifecycle - (UIView *)view { FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init]; loginButton.delegate = self; return loginButton; } #pragma mark - Properties RCT_EXPORT_VIEW_PROPERTY(readPermissions, NSStringArray) RCT_EXPORT_VIEW_PROPERTY(publishPermissions, NSStringArray) RCT_CUSTOM_VIEW_PROPERTY(loginBehaviorIOS, FBSDKLoginBehavior, FBSDKLoginButton) { [view setLoginBehavior:json ? [RCTConvert FBSDKLoginBehavior:json] : FBSDKLoginBehaviorNative]; } RCT_EXPORT_VIEW_PROPERTY(defaultAudience, FBSDKDefaultAudience) RCT_CUSTOM_VIEW_PROPERTY(tooltipBehaviorIOS, FBSDKLoginButtonTooltipBehavior, FBSDKLoginButton) { [view setTooltipBehavior:json ? [RCTConvert FBSDKLoginButtonTooltipBehavior:json] : FBSDKLoginButtonTooltipBehaviorAutomatic]; } #pragma mark - FBSDKLoginButtonDelegate - (void)loginButton:(FBSDKLoginButton *)loginButton didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result error:(NSError *)error { NSDictionary *event = @{ @"type": @"loginFinished", @"target": loginButton.reactTag, @"error": error ? RCTJSErrorFromNSError(error) : [NSNull null], @"result": error ? [NSNull null] : @{ @"isCancelled": @(result.isCancelled), @"grantedPermissions": result.isCancelled ? [NSNull null] : result.grantedPermissions.allObjects, @"declinedPermissions": result.isCancelled ? [NSNull null] : result.declinedPermissions.allObjects, }, }; [self.bridge.eventDispatcher sendInputEventWithName:@"topChange" body:event]; [self.bridge.eventDispatcher sendEvent:event]; } - (void)loginButtonDidLogOut:(FBSDKLoginButton *)loginButton { NSDictionary *event = @{ @"target": loginButton.reactTag, }; [self.bridge.eventDispatcher sendInputEventWithName:@"topChange" body:event]; [self.bridge.eventDispatcher sendEvent:event]; } @end
FBSDKLoginBehaviorNative
is not identified, and I needed to change it to FBSDKLoginBehaviorBrowser
, is there a way to fix this issue ?
I had the same issue using RN
0.59.9
andreact-native-fbsdk@1.0.4
. Downgrading toreact-native-fbsdk@0.10.0
fixed the problem for me. Apparently, starting atreact-native-fbsdk@1.0.0
, the library assumes RN0.60.0
.@KevinDoom Fb login will not work in iOS 13 with this process as the version 1.0.0 only supports version 13.
Have you tested on iOS 13? @KevinDoom @divyanshunegi
I fixed the issue by downgrading to 0.10.0
.
RN 0.60.0 is peer dependency in 1.x.x
.
https://github.com/facebook/react-native-fbsdk/blob/master/package.json#L53
There issue fixing by reverting file to previous changes from commit: https://github.com/facebook/react-native-fbsdk/commit/3eb205e1d2a7ae738ef06ea2167687df461490a7#diff-9892e5bfd3fb7155d5e3ba386aac866b