xmartlabs / react-native-line Goto Github PK
View Code? Open in Web Editor NEWLine SDK wrapper for React Native π
License: MIT License
Line SDK wrapper for React Native π
License: MIT License
I'm currently using
react native: 0.60.5
@xmartlabs/react-native-line : 2.0.1
const loginResult = await Line.login({
scopes: ['email', 'profile'],
botPrompt: 'normal',
onlyWebLogin : true
})
When adding onlyWebLogin field to loginArguments, the following error occurs :
Value for onlyWeblogin cannot be cast from Boolean to String
checkInstance[ReadablenativeMap.java:141]
getNullableValue[ReadablenativeMap.java:129]
getString[ReadablenativeMap.java:163]
login[RnLine.kt:61]
...
Thank you.
Undefined symbols for architecture arm64:
"_RCTRegisterModule", referenced from:
_initialize_LineLogin in LineLogin-138bef0e233c3c4437231f24c868aa03c1831bc8c7a540fc7b932c7a4d7a2881.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
can anyone help me ?
In IOS, Line Login not working with Native Line APP.
is there any way set canLoginWithLineApp in App anywhere?
Would be good to add them
I completed the settings according to read.me, but the Android build does not work with the following error.
ios runs correctly.
I am getting an error in RNLine.kt.
error what went wrong
/node_modules/@xmartlabs/react-native-line/android/src/main/java/com/xmartlabs/rnline/RNLine.kt: (262, 36): Unresolved reference: to
Hello
I'm fairly new to mobile development. I've successfully implemented this into my project (big thank you by the way) however I've hit a snag. On iOS when I enter my Line login details I am prompted to open the app (cancel/ok) however I get the error Safari cannot open this page because the address is invalid
Everything works perfectly on Android
Could you point me in the right direction?
adding AppDelegate.mm incase that's relevant
#import "AppDelegate.h"
#import <React/RCTBundleURLProvider.h>
#import "RNLine-Swift.h"
@implementation AppDelegate
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[LineLogin setupWithChannelID:@"2000308557" universalLinkURL:nil];
self.moduleName = @"Food Menu TW";
// You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native.
self.initialProps = @{};
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
(NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@".expo/.virtual-metro-entry"];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
return [LineLogin application:app open:url options:options];
}
(BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id> * _Nullable))restorationHandler
{
BOOL handledLine = [LineLogin application:application continue:userActivity restorationHandler:restorationHandler];
return handledLine;
}
@EnD
error: no suitable method found for getLoginIntent(Context,String)
Intent intent = LineLoginApi.getLoginIntent(context, channelId);
^
method LineLoginApi.getLoginIntent(Context,String,LineAuthenticationParams) is not applicable
(actual and formal argument lists differ in length)
method LineLoginApi.getLoginIntent(Context,LineAuthenticationConfig,LineAuthenticationParams) is not applicable
(actual and formal argument lists differ in length)
/home/thuc/Desktop/fukuon/node_modules/react-native-line-sdk/android/src/main/java/com/xmartlabs/lineloginmanager/LineLogin.java:135: error: cannot find symbol
result.putString("accessToken", accessToken.getAccessToken());
^
symbol: method getAccessToken()
location: variable accessToken of type LineAccessToken
2 errors
You can run (react-native -v
) to obtain info and paste it below:
I want to use lib but I do not config it for my project even though I followed the instructions and example!
First , I login and get success user_profile.
LineLogin.login()
.then(user => {
console.log(user.profile);
})
.catch(err => {
console.log(err);
});
Next I logout:
LineLogin.logout()
And, I re-login and it's not show form login Line and log error:
Error: Missing access token.
at createErrorFromErrorData (NativeModules.js:115)
at NativeModules.js:78
at MessageQueue.__invokeCallback (MessageQueue.js:296)
at MessageQueue.js:120
at MessageQueue.__guard (MessageQueue.js:218)
at MessageQueue.invokeCallbackAndReturnFlushedQueue (MessageQueue.js:119)
at debuggerWorker.js:71
I debug in LineLoginManager.m and it's jump to line 102:
if ([shared isAuthorized])
{
[self getProfile:loginResolver // line 102
rejecter:loginRejecter];
}
I try debugging but it is very difficult for me, please help me !
iOS AppDelegate.m: Handling openUrl RCTLinkingManager and Line - Duplicate declaration of method 'application:openURL:options:'
how should I handle this...
similar to this stack post https://stackoverflow.com/questions/63541274/ios-appdelegate-m-handling-openurl-rctlinkingmanager-and-twitter-duplicate-de
LineLogin.login()
.then((user) => {
console.log(user.profile.displayName)
})
.catch((err) => {
console.log(err)
})
When clicked my button, It was redirected to Line. And after logged-in successful, it returned back to my application but no any value return.
Any suggestions, please?
Cheers!
i can perfectly run npm run ios
however I have tried to build product and got Use of undeclared identifier 'LineLogin'
i hae tried @import RNLine; on the appdelefate.m
This is my code. I don't know it's a bug or my mistake
i create a button and that on press to this function --> onLineButtonPress()
import LineLogin from '@xmartlabs/react-native-line';
const onLineButtonPress = async () => {
try {
const {accessToken} = await LineLogin.login();
console.log(accessToken, 'accessToken');
} catch (error) {
console.log(error, 'error');
}
};
i can't use the method that provide on LineLogin()
it's will always show [TypeError: Cannot read property 'getCurrentAccessToken' of null] error
it's happen every function.
react-native": "0.71.8"
"@xmartlabs/react-native-line": "^2.1.0",
After authorizing my application. The Line App opens to this page to navigate to my application.
I received the notice: "Safari cannot open this page because the address is invalid"
I follow this docs.
https://developers.line.biz/en/docs/ios-sdk/swift/universal-links-support/
But in step 3. I not sure how. Becase your lib use Objective-C.
I think this is the reason lead to mine problem.
Could you tell me how to fix it?
Hope you help me and thank you very much. <3
You can run (react-native -v
) to obtain info and paste it below:
Error
at Object.promiseMethodWrapper [as login] (NativeModules.js:106)
at _callee4$ (lineSDKWrapper.js:23)
at tryCatch (runtime.js:63)
at Generator.invoke [as _invoke] (runtime.js:294)
at Generator.next (runtime.js:119)
at tryCatch (runtime.js:63)
at invoke (runtime.js:155)
at runtime.js:190
at tryCallTwo (core.js:45)
Thank you for the great library.
I was able to retrieve profile information with this lib, but not yet find the way to get email address of the login user.
I confirmed I can pass 'email' and 'openid' to loginWithPermissions() and they are shown on Line authorization screen, but the response from line doesn't contain email.
Could you advise how to get email address? or it's not supported yet?
I need user email
As subject, 'LineLogin' cannot be defined, no matter if I install 'LineSDKSwift' or 'LineSDKSwift/ObjC' or nothing.
I modified the Podfile to install LineSDK as below :
platform :ios, '10.0'
#use_frameworks! # It cause many issues so that I mask it.
target 'CSApp3' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
pod 'LineSDKSwift/ObjC', '~> 5.0'
......................................................................................
Then amend Info.plist :
<key>CFBundleURLSchemes</key>
<array>
...................... (ignore) .............................
<!-- Specify URL scheme to use when returning from LINE to your app.-->
<string>line3rdp.$(PRODUCT_BUNDLE_IDENTIFIER)</string>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
................... (ignore) .......................
<!-- Specify URL scheme to use when launching LINE from your app.-->
<string>lineauth2</string>
</array>
and then, modify AppDelegate.m
@import RNLine;
........................ (ignore) ...........................
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#ifdef FB_SONARKIT_ENABLED
InitializeFlipper(application);
#endif
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"MyAppName"
initialProperties:nil];
............................... (ignore) ..............................
[LineLogin setupWithChannelID:@"OurLineID" universalLinkURL:nil];
return YES;
}
//
// Handle redirection back to the app from Line
//
(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
return [LineLogin application:app open:url options:options];
}
(BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id> * _Nullable))restorationHandler
{
BOOL handledLine = [LineLogin application:application continue:userActivity restorationHandler:restorationHandler];
return handledLine;
}
This error persists when i try to login to LineLogin.login() . I can access LineLogin and have setup the SDK with podfile.
pod 'LineSDK', '~> 5.0'
### Console Error
TypeError: Cannot read property 'login' of undefined
at LineLogin.login (LineLogin.js:10)
at onLineLogin$ (index.js:217)
at tryCatch (runtime.js:45)
at Generator.invoke [as _invoke] (runtime.js:271)
at Generator.prototype. [as next] (runtime.js:97)
at next (redux-saga-core.dev.cjs.js:1155)
at proc (redux-saga-core.dev.cjs.js:1106)
at redux-saga-core.dev.cjs.js:589
at immediately (redux-saga-core.dev.cjs.js:60)
at runForkEffect (redux-saga-core.dev.cjs.js:588)
Similar to this issue #73, while I'm using AppDelegate.mm instead of AppDelegate.m.
I also use @import RNLine instead of #import "RNLine-Swift.h in reference to #58 (comment), but not found error still occurred at @import RNLine in AppDelegate.mm.
Later on, I changed the filename from "AppDelegate.mm" to "AppDelegate.m" in Xcode, and it worked! Not sure if this is the best solution, but it worked for me. Hope this information can help those who are struggling with the same issue, just like I was.
We should update the codebase on android tu support expo to avoid issues like #6 .
react-native:0.71.4
xcode:14.3
You can run (react-native -v
) to obtain info and paste it below:
##Podfile
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '12.4'
prepare_react_native_project!
react-native-flipper
your iOS build will fail when NO_FLIPPER=1
is set.react-native-flipper
depends on (FlipperKit,...) that will be excludedreact-native-flipper
using a react-native.config.js
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
permissions_path = '../node_modules/react-native-permissions/ios'
linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
use_frameworks! :linkage => linkage.to_sym
end
pod 'Firebase', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
pod 'FBSDKLoginKit'
target 'RichestLife' do
config = use_native_modules!
pod 'LineSDKSwift', '~> 5.0'
# project 'RichestLife',
# 'Debug' => :debug,
# 'Dev Debug' => :debug,
# 'Alpha Debug' => :debug,
# 'QA Debug' => :debug,
# 'Release' => :release,
# 'Dev Release' => :release,
# 'Alpha Release' => :release,
# 'QA Release' => :release
flags = get_default_flags()
use_react_native!(
:path => config[:reactNativePath],
# Hermes is now enabled by default. Disable by setting this flag to false.
# Upcoming versions of React Native may rely on get_default_flags(), but
# we make it explicit here to aid in the React Native upgrade process.
:hermes_enabled => flags[:hermes_enabled],
:fabric_enabled => flags[:fabric_enabled],
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
:flipper_configuration => flipper_config,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
target 'RichestLifeTests' do
inherit! :complete
# Pods for testing
end
post_install do |installer|
react_native_post_install(
installer,
# Set mac_catalyst_enabled
to true
in order to apply patches
# necessary for Mac Catalyst builds
:mac_catalyst_enabled => false
)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
__apply_Xcode_12_5_M1_post_install_workaround(installer)
installer.pods_project.build_configurations.each do |config|
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
end
end
end
I am trying follow your example.
Use of undeclared identifier 'LineLogin'
#import "RNLine-Swift.h"
in AppDelegate.m
pod install
but failedplatform :ios, '9.0'
to platform :ios, '10.0'
ENV['SWIFT_VERSION'] = '5'
on top of my podfile'RNLine-Swift.h' file not found
Tks for your lib, pls help
You can run (react-native -v
) to obtain info and paste it below:
While login android, but ios is fine.
Can you tell me how to debug your native module on android, many thks
<resources> <string name="line_channel_id" translatable="false">1654402186</string> </resources>
The .idea
folder should be ignored, since is a Android Studio specific folder, created automatically with the IDE configuration. It would be better if the project is IDE agnostic.
When I try to build in Xcode 12.4 - Apple Silicon Mac, "Module 'RNLine' not found" error occurred at @import RNLine
in AppDelegate.m.
I use @import RNLine
instead of #import "RNLine-Swift.h
in reference to #58 (comment)
How can I resolve this error ... ?
Is there any way to change or disable the login success toast message instead of showing "Login successful!"?
Toast message during onlyWebLogin:true is disable.
Currently using:
"react-native": "0.63.3",
@xmartlabs/react-native-line": "^2.1.0"
It works fine in development environment, however when I do build the app. An error has occurred.
@property (nonatomic, strong) UIWindow *window;
^
βΈ Linking mobile
β ld: symbol(s) not found for architecture arm64
β clang: error: linker command failed with exit code 1 (use -v to see invocation)
/Users/user/Library/Developer/Xcode/DerivedData/mobile-enlqcscemfhhjjfldsucnptaosmk/Build/Intermediates.noindex/ArchiveIntermediates/mobile/InstallationBuildProductsLocation/Applications/mobile.app/mobile
Undefined symbols for architecture arm64:
"_swift_stdlib_isStackAllocationSafe", referenced from:
_$ss10_NativeSetV6filteryAByxGSbxKXEKF7LineSDK15LoginPermissionV_Tg503$s7d95SDK19ShareViewControllerC41localAuthorizationStatusForSendingMessage11permissionsAA0gH0OSayAA15fG15VG_tFZSbAIXEfU_SayAGGTf1cn_nTf4ng_n in libLineSDKSwift.a(ShareViewController.o)
_$ss10_NativeSetV6filteryAByxGSbxKXEKF7LineSDK15LoginPermissionV_Tg503$s7d92SDK26OpenChatCreatingControllerC027localAuthorizationStatusForcD011permissionsAA0hI0OSayAA15fG15VG_tFZSbAIXEfU_SayAGGTf1cn_nTf4ng_n in libLineSDKSwift.a(OpenChatCreatingController.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Hi,
I'm currently using
I can't find anywhere to get the raw id token in LineSDKJSONWebToken class.
But I do able to get my email from credential.IDToken.email
Is there a way to get the raw id token string in iOS?
Thank you guys.
Will you update it for react-native version 0.60? It doesn't work on it now.
Without Import that file, I can not build.
If Removed library from this then I can build my project
if I do this, then I can not use LineLoginManager from LineLogin.js file.
it says that LineLoginManager is undefined.
I tried manually Link LindSdk framework, LineSDK pod file also.
if I do Link with libraries libLinaManager.a file
then I get this error
https://i.imgur.com/aEAlmvV.png
I can't login line in device iOS
When we upgrade this wrapper from 1.1.0 to 1.2.0. If there are v4 tokens of line, it won't work at getUserProfile function since the Line API server reject their v4 token on v5 sdk.
react-native-line/ios/LineLoginManager.m
Lines 100 to 103 in dcbdfe3
There is no way to clear stale token. The only way is to receive new token from Line API server.
So, I removed that code, when I got the new token from Line login process, stale token issue was resolved.
We need to isolate getUserProfile from loginWithPermissions method.
I'll contribute this by pull request. Thank you.
Hi, I'm using react-native on ios but when I click on sign in, the app crashes.
I think it has a problem with new versions of react-native maybe?
react-native-cli: 2.0.1
react-native: 0.68.2
and SDK is the latest version. Higher than 5
When building in Xcode, I keep getting the error "Use of undeclared identifier 'LineLogin'" in AppDelegate.m.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
[LineLogin setupWithChannelID:@"....." universalLinkURL:nil];
return YES;
}
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
return [LineLogin application: application open:url options:options];
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
{
BOOL handledLine = [LineLogin application:application continue:userActivity restorationHandler:restorationHandler];
return handledLine;
}
I am working both with react-native-line and react-native-maps. To install react-native-maps I must remove use_framework! in podfile. Any solution for this
I installed this package :
import LineLogin from '@xmartlabs/react-native-line'
I was wondering how I can get the user email, thank you.
Use of undeclared identifier 'LineLogin'
I have read some links as below and tried to fix it. But all of them do not work.
#58
https://github.com/xmartlabs/react-native-line#using-objective-c
install
yarn add @xmartlabs/react-native-line
cd ios
edit Podfile as below : ( I mask 'use_frameworks!'. It cause many compatible error. I tried 'use_frameworks! :linkage => :static'. It cause error too. )
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
#use_frameworks! :linkage => :static
#use_frameworks!
target 'CSApp3' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
#Line Login --> I have tried both ways.
pod 'LineSDKSwift', '> 5.0'> 5.0'
#pod 'LineSDK', '
end
pod install :
pod install
cd ..
edit AppDelegate.m to import header file : ( I have tried two ways )
#import "RNLine-Swift.h"
or
@import RNLine;
add this line before return :
[LineLogin setupWithChannelID:@"1111111111" universalLinkURL:nil];
Use of undeclared identifier 'LineLogin'
I am looking forward to building success.
Use of undeclared identifier 'LineLogin'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.