Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all 17267 articles
Browse latest View live

Expo AV audio not playing on iOS/ iPhone

$
0
0

I have used Expo AV and developed a screen in my app to play audio files fetched from my server. It works fine on Android, but doesn't play anything on iPhone.

When I play a button to play the audio which loads and plays the file

soundObject.loadAsync({ uri: this.state.file });soundObject.playAsync();

It returns an error:

This media format is not supported. - The AVPlayerItem instance has failed with the error code -11828 and domain "AVFoundationErrorDomain".

Here is my code that loads and plays the audio :

async loadAudio() {soundObject = new Audio.Sound();try {await soundObject.loadAsync({ uri: this.state.file });console.log("File loaded: " + this.state.file);} catch (error) {console.log(error);}}async playAudio() {if (!this.state.isPlayingAudio) {try {  await soundObject.playAsync();} catch (error) {  console.log(error);}  else {soundObject.pauseAsync();  }  }

I have tried changing the audio format to m4a, wav, caf while recording and fetching the file but that did not helpI'm running the app on iPhone 7 plus, iOS 14.2Any suggestions/ fixes, please? Thanks in advance


React Native ios build error 'React/RCTBridgeModule.h' file not found with react-native-document-picker

$
0
0

I am unable to build iOS App because of the issue - 'React/RCTBridgeModule.h' file not found

"react": "^16.13.1", "react-native": "^0.63.4", "react-native-document-picker": "^4.2.0"

iOS target -- 10.0

I already tried a few of the suggested solutions includingthis. Though, unable to follow the following step, as there was no React.xcodeproj file available

Add react as a project dependecy

Xcode Project Navigator -> drag React.xcodeproj from Libraries to roottree Build Phases Tab -> Target Dependencies -> + -> add React

Also triedhttps://stackoverflow.com/a/52425997/1479511andhttps://stackoverflow.com/a/41664041/1479511

but still no luck yet :(

enter image description here

UPDATE

Tried following the steps suggested by @Muhammad Numan in the answer.

  1. Check that I have React in my pods (pod 'React', :path =>'../node_modules/react-native/'). If not, add it.
  2. Uninstall reinstall pods (pod deintegrate && pod clean && podinstall in the ios folder, I believe the pod deintegrate commandneeds to be downloaded and isn't available by default)

Error

So, modified contents of React.podspec from

s.dependency "React-Core", version  s.dependency "React-Core/DevSupport", version  s.dependency "React-Core/RCTWebSocket", version  s.dependency "React-RCTActionSheet", version  s.dependency "React-RCTAnimation", version  s.dependency "React-RCTBlob", version  s.dependency "React-RCTImage", version  s.dependency "React-RCTLinking", version  s.dependency "React-RCTNetwork", version  s.dependency "React-RCTSettings", version  s.dependency "React-RCTText", version  s.dependency "React-RCTVibration", version

to

s.dependency "React/Core", version  s.dependency "React/Core/DevSupport", version  s.dependency "React/Core/RCTWebSocket", version  s.dependency "React/RCTActionSheet", version  s.dependency "React/RCTAnimation", version  s.dependency "React/RCTBlob", version  s.dependency "React/RCTImage", version  s.dependency "React/RCTLinking", version  s.dependency "React/RCTNetwork", version  s.dependency "React/RCTSettings", version  s.dependency "React/RCTText", version  s.dependency "React/RCTVibration", version

followed by the command pod repo update

Then, afterwards, getting this error

Current Error

What is the best game framework/engine for react-native?

$
0
0

What is the best framework/game engine for developing games in react-native?The game i need to develop is simple 2D game smilar to Flappy Bird. Also it need to be protect very well from cheating (users will be winning real prizes).

Showing error Undefined symbol: _OBJC_CLASS_$_RNFirebaseMessaging

$
0
0

I am new to react native, In my react native project facing error while creating build in xcode(version-11.2), It is showing error " Undefined symbol: OBJC_CLASS$_RNFirebaseMessaging" while creating build. If I remove that RNFirebaseMessaging from pod then It run properly.

react native version: 0.63.2pods are uptodate

My podfile is like following:

// Pod file    # Uncomment the next line to define a global platform for your project    # platform :ios, '9.0'    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!    target 'Epicbae' do      # Comment the next line if you don't want to use dynamic frameworks      # use_frameworks!      config = use_native_modules!      use_react_native!(:path => config["reactNativePath"])      pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"      pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"      pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"      pod 'React', :path => '../node_modules/react-native/'      pod 'React-Core', :path => '../node_modules/react-native/'      pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'      pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'      pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'      pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'      pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'      pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'      pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'      pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'      pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'      pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'      pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'      pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'      pod 'Dou[bleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'      pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'      pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'      pod 'RNInputMask', :path => '../node_modules/react-native-text-input-mask/ios/InputMask'      # add the Firebase pod for Google Analytics      # pod 'Firebase/Analytics'      pod 'Fir][1]ebase/Analytics'      pod 'Firebase/Core'      pod 'Firebase/Auth'      pod 'Firebase/Messaging'      pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'      pod 'Google-Mobile-Ads-SDK'      target 'EpicbaeTests' do        # inherit! :complete        # inherit! :search_paths        # Pods for testing      end      # use_flipper!      # post_install do |installer|      #   flipper_post_install(installer)      # end    end    target 'Epicbae-tvOS' do      # Comment the next line if you don't want to use dynamic frameworks      use_frameworks!      # Pods for Epicbae-tvOS      target 'Epicbae-tvOSTests' do        inherit! :search_paths        # Pods for testing      end    end

enter image description here

UMModuleRegistryAdapter.h not found when running React Native app in iOS simulator

$
0
0

I have a simple React Native app that I've been testing on Android and now want to test on iOS. It's using React Navigation.

I ran npm run ios but I'm getting the following error:

info In file included from /Users/rbbit/reactnative/testproj1/ios/testproj1/main.m:10:/Users/rbbit/reactnative/testproj1/ios/testproj1/AppDelegate.h:9:9: fatal error: 'UMReactNativeAdapter/UMModuleRegistryAdapter.h' file not found#import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~info 1 error generated.

I opened XCode but I'm basically getting the same message, nothing else that would help me debug this.

I do see that there is a package called react-native-adapter (https://github.com/expo/expo/tree/master/packages/%40unimodules/react-native-adapter), however I'm hesitant to just install this since I followed the instructions on how to include react-navigation and didn't mention that, assuming this is related.

Also, that page says If you are using react-native-unimodules, this package will already be installed and configured!, and react-native-unimodules already is in my dependencies.

Any pointers on how to solve this? Thank you!

Unable to find a specification for `React-Core` depended upon by `RNCPicker` 1.6.0 with React Native 0.59

$
0
0

I was getting this error when running pod install for RNCPicker of version 1.6.0 with React Native 0.59

Analyzing dependencies[!] Unable to find a specification for `React-Core` depended upon by `RNCPicker`You have either: * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`. * mistyped the name or version. * not added the source repo that hosts the Podspec to your Podfile.

In my case I have to use these specific versions.How do I get rid of this error?

React Native iOS Push Notification with Image

$
0
0

I currently have an app which was made with React Native. I need to display a local push notification, and there needs to be an image displayed within this notification. Currently, I am using the react-native-push-notification library for basic text notifications.

I have been looking for solutions but I have not found any way yet that I can add images into a notification. Is there some way to hook into native code that would allow me to do it?

Any help is greatly appreciated.

creating a bridge for react native through IOS and getting an error

$
0
0

calling below function and getting error "Warning: Attempt to present <DigitalPayments_PaymentForm_SDK.WebViewController: 0x7f8ac4769540> on <PaymentModule: 0x7f8ac470d7d0> whose view is not in the window hierarchy!"

overridefunc loadView() {DispatchQueue.main.async(execute: {

  DPMakePayment         .initialize(sessionKey: "xxxxxx-xxxx-xxxx-xxxxxxxxxxxx", url: "https://stgportalone.processonepayments.com/Api")         .makePayment(request:             MakePaymentRequest(                 paymentCategory: PaymentCategory.eCheck,                 feeContext: FeeContext.paymentWithFee,                 amountContext: AmountContext.selectOrEnterAmount,                 minAmountDue: 50,                 accountBalance: 100,                 policyHolderName: "John Smith",                 clientReferenceData1: "POL330701-02"             ))         .startWebView( hostViewController: self)   })

}


expo-location not working in ios and not showing location permission in app settings

$
0
0

I am trying to get current location in IOS 14, but i am getting no response and when i check in exposettings it's not showing location permission there. I have checked in both simulator and physical device.

Hook Code

import { useEffect, useState } from "react";import * as Location from "expo-location";export default useLocation = () => {  const [location, setLocation] = useState();  const getLocation = async () => {    try {      const { granted } = await Location.requestPermissionsAsync();      if (!granted) return;      const {        coords: { latitude, longitude },      } = await Location.getLastKnownPositionAsync();      setLocation({ latitude, longitude });    } catch (error) {      console.log(error);    }  };  useEffect(() => {    getLocation();  }, []);  return location;};

Response

undefined

How to save/cache all data on device for quick loading and updates in background when React native app launches?

$
0
0

I am using axios for API calls, and Async storage for storing some details like user profile and all. But Async storage seems very slow.

My apps' key functionality needs internet to work, but lot of screens would have content which doesn't update in realtime or always. How do I save all that info in local so whenever new session of the app is launched, the screens show fully loaded instead of querying data from API and showing a loader, the info update can happen in the background. Like how all the major apps work is by not loading already loaded content but somehow saving it on the device itself, but at the same time allowing for updating if new info comes in.

Some sort of DB in the app to store all info would work? if yes, what's the best to go with Redux, Axios implementation that is fast and not as slow as Async Storage?

How to Have Functionality For Multiple TextFields In React Native

$
0
0

I am creating a login screen in react native and have created a custom input field component built off the generic textfield.

My problem is when I add anymore than two input fields react native only allows me to interact with the last two input fields leaving any input field before them unable to be selected.

The application works when I have two or less input fields on my page the app allows me to select and change text in all of the input fields with unique values.

Any idea on what I am doing wrong and how to properly setup this kind of view?

Here is my code for the view:

import React from 'react'import {View} from 'react-native'import InputField from '/src/Components/Single Items/Textboxs/InputField.js'import GeneralAccountSignUpTextFieldsStyles from '/src/Components_Style/Authentication/Textboxes/GeneralAccountSignUpTextFields.styles.js'const CreateAccountFields = (props) => { const [nameValue,setNameValue] = React.useState(''); const [emailValue,setEmailValue] = React.useState(''); const [passwordValue,setPasswordValue] = React.useState(''); const [birthdayValue,setBirthdayValue] = React.useState(''); return (<View><View><InputField    label="Full Name"    labelStyle={GeneralAccountSignUpTextFieldsStyles.labelStyle}   placeholder="Full Name"   inputStyle={GeneralAccountSignUpTextFieldsStyles.inputStyleOsNormal}   value={nameValue}   onChangeText={(text) => setNameValue(text)}   autoFocus={true}   /></View><View><InputField    label="DOB"    labelStyle={GeneralAccountSignUpTextFieldsStyles.labelStyle}   placeholder="DOB"   inputStyle={GeneralAccountSignUpTextFieldsStyles.inputStyleOsNormal}   value={birthdayValue}   onChangeText={(text) => setBirthdayValue(text)}   autoFocus={true}   /></View><View><InputField    label="Email"    labelStyle={GeneralAccountSignUpTextFieldsStyles.labelStyle}   placeholder="Email"   inputStyle={GeneralAccountSignUpTextFieldsStyles.inputStyleOsNormal}   value={emailValue}   onChangeText={(text) => setEmailValue(text)}   autoFocus={true}   /></View><View><InputField    label="Password"    labelStyle={GeneralAccountSignUpTextFieldsStyles.labelStyle}   placeholder="Password"   inputStyle={GeneralAccountSignUpTextFieldsStyles.inputStyleOsNormal}   value={passwordValue}   onChangeText={(text) => setPasswordValue(text)}   autoFocus={true}   /></View></View> )}export default CreateAccountFields;

Throw new error is not working in React native iOS

How to reduce PDF file size in react native app

$
0
0

I am working on a react native app and i want to compress the PDF files which are more than 10MB size. Is there any plugin to reduce the size of PDF ?

Identify Return Key action in React Native

$
0
0

I have a TextInput which I have enabled multiline as true. Thing is the Keyboard won't hide after Return is pressed. It goes to a new line. So I was hoping to use react-native-dismiss-keyboard. To exploit this I need to identify the Return key action. How to do this?

<TextInput    style={styles.additionalTextInput}    multiline={true}    autoCapitalize="sentences"    autoCorrect={true}    onChangeText={(text) => this.setState({text})}    keyboardType="default"    returnKeyType="done"    onKeyPress={(keyPress) => console.log(keyPress)}    placeholder="Enter text here..."/>

Firebase crashlytics not getting correct error line in React native

$
0
0

Firebase crashlytics not getting correct error line in React native code,stack trace is showing the crash error lines in Xcode only but not in React native code

Device details iPhone simulator 13.3
enter image description here


React Native iOS build succeeds locally but fails on CI server

$
0
0

I recently updated a React Native project to version 0.59, and the built-in AsyncStorage is now deprecated. So I installed the @react-native-community/react-native-async-storage package instead as advised, and linked the packages by running react-native link @react-native-community/async-storage.

The build now succeeds when running it in Xcode locally. However, when I try to run the build in my CI pipeline in Azure DevOps, it fails during linking:

# ...▸ Compiling main.m▸ Linking MyApp⚠️  ld: directory not found for option '-L/Users/vsts/agent/2.149.2/work/1/s/ios/MyApp/System/Library/Frameworks'❌  ld: library not found for -lRNCAsyncStorage❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)▸ Linking MyApp⚠️  ld: directory not found for option '-L/Users/vsts/agent/2.149.2/work/1/s/ios/MyApp/System/Library/Frameworks'❌  ld: library not found for -lRNCAsyncStorage❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)** BUILD FAILED **The following build commands failed:    Ld /Users/vsts/Library/Developer/Xcode/DerivedData/MyApp-asjjausbybqgpsdjodrbvoyzaeqx/Build/Intermediates.noindex/MyApp.build/BetaRelease-iphoneos/MyApp.build/Objects-normal/armv7/MyApp normal armv7    Ld /Users/vsts/Library/Developer/Xcode/DerivedData/MyApp-asjjausbybqgpsdjodrbvoyzaeqx/Build/Intermediates.noindex/MyApp.build/BetaRelease-iphoneos/MyApp.build/Objects-normal/arm64/MyApp normal arm64(2 failures)##[error]Error: /usr/bin/xcodebuild failed with return code: 65##[section]Finishing: Xcode build, sign and export

Further up it does look like it has been built:

# ...▸ Building RNCAsyncStorage/RNCAsyncStorage [(Release)]▸ Check Dependencies▸ Building library libRNCAsyncStorage.a▸ Building library libRNCAsyncStorage.a▸ Copying RNCAsyncStorage.h▸ Copying RNCAsyncStorageDelegate.h# ...

Any ideas what might cause this?

how do i capture the accelerometer in the background with react native

$
0
0

I am developing a posture checking app with react native expo CLI. So I'm trying to check the posture of the user when they are using my app so they can maintain good posture using the Accelerometer i can check that but right now it only works when they are using my app but i want it to work even when they close my app. i know that i have to use background fetch and task manager for it and i tried but i don't understand exactly how it works.

import * as BackgroundFetch from "expo-background-fetch";import * as TaskManager from "expo-task-manager";let setStateFn = () => {  console.log("State not yet initialized");};function myTask() {  try {    // fetch data here...    const backendData = "Simulated fetch " + Math.random();    console.log("myTask() ", backendData);    setStateFn(backendData);    return backendData      ? BackgroundFetch.Result.NewData      : BackgroundFetch.Result.NoData;  } catch (err) {    return BackgroundFetch.Result.Failed;  }}async function initBackgroundFetch(taskName,                                   taskFn,                                   interval = 60 * 15) {  try {    if (!TaskManager.isTaskDefined(taskName)) {      TaskManager.defineTask(taskName, taskFn);    }    const options = {      minimumInterval: interval // in seconds    };  await BackgroundFetch.registerTaskAsync(taskName, options);  } catch (err) {    console.log("registerTaskAsync() failed:", err);  }}initBackgroundFetch('myTaskName', myTask, 5);// Put the next lines inside the React componentconst [state, setState] = useState(null);setStateFn = setState;

I'm using this method to do the backround fetch

How to stop landscape orientation, particularly in iPhone SE in react native?

$
0
0

All Devices

I can stop orientation in all the devices but for iPhone SE only I need to stop the orientation

Only For iPhone SE, I need only for iPhone 5

App closes on start when trying to run react-native run-ios

$
0
0

I'm facing some issues with running react-native run-ios on my react native project.After the command the app as loading, black screen appears for a few seconds and then the app is closes.Here is a log from WebStorm.

info Found Xcode workspace "Actors.xcworkspace"info Launching iPhone 11 (iOS 14.3)info Building (using "xcodebuild -workspace Actors.xcworkspace -configuration Debug -scheme Actors -destination id=5508C928-BADB-4FE5-8426-9B1461397EC3")(node:44088) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency(Use `node --trace-warnings ...` to show where the warning was created)success Successfully built the appinfo Installing "/Users/michaelionia/Library/Developer/Xcode/DerivedData/Actors-gzwkhkgvbultrlcjeogpfwamtnzi/Build/Products/Debug-iphonesimulator/Actors.app"info Launching "org.name.Actors"success Successfully launched the app on the simulator

When I'm running react-native run-android the app workings good with all libraries.

I've tried to run the project from xCode , but facing the same issue , the app opens with back screen and 0 Errors.

Here is a log from xcode

2021-02-15 10:43:06.728730+0200 Actors[44637:1250270] You've implemented -[<UIApplicationDelegate> application:performFetchWithCompletionHandler:], but you still need to add "fetch" to the list of your supported UIBackgroundModes in your Info.plist.2021-02-15 10:43:06.728839+0200 Actors[44637:1250270] You've implemented -[<UIApplicationDelegate> application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.2021-02-15 10:43:06.866897+0200 Actors[44637:1251130] [] nw_protocol_get_quic_image_block_invoke dlopen libquic failed2021-02-15 10:43:06.904031+0200 Actors[44637:1250270] [native] Running application main ({    initialProps =     {    };    rootTag = 1;})2021-02-15 10:43:06.930218+0200 Actors[44637:1250270] [native] 'SplashScreen.storyboard' file is missing. Fallbacking to 'SplashScreen.xib' file.2021-02-15 10:43:06.930558+0200 Actors[44637:1250270] [native] 'SplashScreen.xib' file is missing - 'expo-splash-screen' will not work as expected.2021-02-15 10:43:06.966657+0200 Actors[44637:1250270] *** Terminating app due to uncaught exception 'ERR_NO_SPLASH_SCREEN', reason: 'Couln't locate neither 'SplashScreen.storyboard' file nor 'SplashScreen.xib' file. Create one of these in the project to make 'expo-splash-screen' work (https://github.com/expo/expo/tree/master/packages/expo-splash-screen#-configure-ios).'*** First throw call stack:(    0   CoreFoundation                      0x00007fff20420af6 __exceptionPreprocess + 242    1   libobjc.A.dylib                     0x00007fff20177e78 objc_exception_throw + 48    2   Actors                              0x0000000101dc49e9 -[EXSplashScreenViewNativeProvider createSplashScreenView] + 2185    3   Actors                              0x0000000101dc19bd -[EXSplashScreenController initWithViewController:splashScreenViewProvider:] + 221    4   Actors                              0x0000000101dc3878 -[EXSplashScreenService showSplashScreenFor:splashScreenViewProvider:successCallback:failureCallback:] + 312    5   Actors                              0x0000000101dc36a5 -[EXSplashScreenService showSplashScreenFor:] + 149    6   Actors                              0x0000000101dc4075 -[EXSplashScreenService application:didFinishLaunchingWithOptions:] + 181    7   Actors                              0x00000001021fdc9c -[UMAppDelegateWrapper application:didFinishLaunchingWithOptions:] + 476    8   Actors                              0x0000000101d8567e -[AppDelegate application:didFinishLaunchingWithOptions:] + 574    9   UIKitCore                           0x00007fff2468d0f1 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 232    10  UIKitCore                           0x00007fff2468ec73 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 3919    11  UIKitCore                           0x00007fff24694681 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1237    12  UIKitCore                           0x00007fff23cbd907 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 122    13  UIKitCore                           0x00007fff2424bdb6 _UIScenePerformActionsWithLifecycleActionMask + 88    14  UIKitCore                           0x00007fff23cbe416 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 198    15  UIKitCore                           0x00007fff23cbdeda -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 474    16  UIKitCore                           0x00007fff23cbe247 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 819    17  UIKitCore                           0x00007fff23cbdadb -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 345    18  UIKitCore                           0x00007fff23cc5d73 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 178    19  UIKitCore                           0x00007fff241556ab +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 871    20  UIKitCore                           0x00007fff2426865e _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 240    21  UIKitCore                           0x00007fff23cc5a79 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 361    22  UIKitCore                           0x00007fff23ae896f __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 797    23  UIKitCore                           0x00007fff23ae7419 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 253    24  UIKitCore                           0x00007fff23ae85a8 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 208    25  UIKitCore                           0x00007fff24692b20 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 508    26  UIKitCore                           0x00007fff2417dab7 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 358    27  FrontBoardServices                  0x00007fff25aa20ae -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 391    28  FrontBoardServices                  0x00007fff25acab41 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.176 + 102    29  FrontBoardServices                  0x00007fff25aafad5 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 209    30  FrontBoardServices                  0x00007fff25aca80f __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke + 352    31  libdispatch.dylib                   0x00000001035329c8 _dispatch_client_callout + 8    32  libdispatch.dylib                   0x0000000103535910 _dispatch_block_invoke_direct + 295    33  FrontBoardServices                  0x00007fff25af07a5 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30    34  FrontBoardServices                  0x00007fff25af048b -[FBSSerialQueue _targetQueue_performNextIfPossible] + 433    35  FrontBoardServices                  0x00007fff25af0950 -[FBSSerialQueue _performNextFromRunLoopSource] + 22    36  CoreFoundation                      0x00007fff2038f38a __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17    37  CoreFoundation                      0x00007fff2038f282 __CFRunLoopDoSource0 + 180    38  CoreFoundation                      0x00007fff2038e764 __CFRunLoopDoSources0 + 248    39  CoreFoundation                      0x00007fff20388f2f __CFRunLoopRun + 878    40  CoreFoundation                      0x00007fff203886d6 CFRunLoopRunSpecific + 567    41  GraphicsServices                    0x00007fff2bededb3 GSEventRunModal + 139    42  UIKitCore                           0x00007fff24690e0b -[UIApplication _run] + 912    43  UIKitCore                           0x00007fff24695cbc UIApplicationMain + 101    44  Actors                              0x0000000101d85eb0 main + 112    45  libdyld.dylib                       0x00007fff202593e9 start + 1    46  ???                                 0x0000000000000001 0x0 + 1)libc++abi.dylib: terminating with uncaught exception of type NSException*** Terminating app due to uncaught exception 'ERR_NO_SPLASH_SCREEN', reason: 'Couln't locate neither 'SplashScreen.storyboard' file nor 'SplashScreen.xib' file. Create one of these in the project to make 'expo-splash-screen' work (https://github.com/expo/expo/tree/master/packages/expo-splash-screen#-configure-ios).'terminating with uncaught exception of type NSExceptionCoreSimulator 732.18.6 - Device: iPhone 11 (5508C928-BADB-4FE5-8426-9B1461397EC3) - Runtime: iOS 14.3 (18C61) - DeviceType: iPhone 11(lldb) .

I've tried to delete podfile.log and run pod install from ios diractory.

Google SignIn for IOS with React-native (expo)

$
0
0

I'm setting up a page where I can Id with a Google account. This is my code:

import React from "react"import { StyleSheet, Text, View, Image, Button } from "react-native"import * as Google from "expo-google-app-auth";export default class App extends React.Component {  constructor(props) {    super(props)    this.state = {      signedIn: false,      name: "",      photoUrl: ""    }  }  signIn = async () => {    try {      const result = await Google.logInAsync({        androidClientId:"1051966217196.apps.googleusercontent.com",          iosClientId:"1051966217196.apps.googleusercontent.com",        scopes: ["profile", "email"]      })      if (result.type === "success") {        this.setState({          signedIn: true,          name: result.user.name,          photoUrl: result.user.photoUrl        })      } else {        console.log("cancelled")      }    } catch (e) {      console.log("error", e)    }  }  render() {    return (<View style={styles.container}>        {this.state.signedIn ? (<LoggedInPage name={this.state.name} photoUrl={this.state.photoUrl} />        ) : (<LoginPage signIn={this.signIn} />        )}</View>    )  }}const LoginPage = props => {  return (<View><Text style={styles.header}>Sign In With Google</Text><Button title="Sign in with Google" onPress={() => props.signIn()} /></View>  )}const LoggedInPage = props => {  return (<View style={styles.container}><Text style={styles.header}>Welcome:{props.name}</Text><Image style={styles.image} source={{ uri: props.photoUrl }} /></View>  )}const styles = StyleSheet.create({  container: {    flex: 1,    backgroundColor: "#fff",    alignItems: "center",    justifyContent: "center"  },  header: {    fontSize: 25  },  image: {    marginTop: 15,    width: 150,    height: 150,    borderColor: "rgba(0,0,0,0.2)",    borderWidth: 3,    borderRadius: 150  }})

On Android it's ok, everything is fine but in IOS I have that mistake :

Google 400 - That's an error - Error : redirect_uri_mismatch

Where is it goes wrong? I'm new to react native so I need detailed explanations.

Viewing all 17267 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>