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

'React/UIView+React.h' file not found. Xcode 11 build failed

$
0
0

I wanted to do testing in ios 13 for that I needed xcode v11 so after upgrading to xcode 11.5 and then after running my project in simulator(ios 13). I was facing the following error.

enter image description hereThis exception was coming after a successful build.

Investigating about it online, there was a suggestion to upgrade the react and react-native versions. So I upgraded to the latest versions i.e "16.0.0-alpha.12" and "0.62.2" respectively and restarted Xcode. Afterwhich whole lot of errors started coming based on version dependencies, due to which I reverted the changes back to the initial stage.And then I clicked on Product->Clean build folder in Xcode and restarted xcodeNow after this when I am trying to build the project in simulator, the build is failing giving this error in build timeenter image description here

Aim : I want my project to run successfully in simulator. As it was running before upgrading to xcode 11.

P.S - Here is my project's package.json in react-native.

{"_from": "react-native@0.62.2","_id": "react-native@0.62.2","_inBundle": false,"_integrity": "sha512-gADZZ3jcm2WFTjh8CCBCbl5wRSbdxqZGd+8UpNwLQFgrkp/uHorwAhLNqcd4+fHmADgPBltNL0uR1Vhv47zcOw==","_location": "/react-native","_phantomChildren": {"@hapi/joi": "15.1.1","@jest/types": "25.5.0","@react-native-community/cli-debugger-ui": "4.9.0","@react-native-community/cli-server-api": "4.9.0","@react-native-community/cli-tools": "4.9.0","@react-native-community/cli-types": "4.10.0","@types/color-name": "1.1.1","@types/istanbul-lib-coverage": "2.0.3","@types/istanbul-reports": "1.1.2","@types/yargs-parser": "15.0.0","command-exists": "1.2.9","commander": "2.20.3","core-js": "2.6.11","cosmiconfig": "5.2.1","deepmerge": "3.3.0","envinfo": "7.5.1","fbjs-css-vars": "1.0.2","fs-extra": "8.1.0","fs.realpath": "1.0.0","graceful-fs": "4.1.11","inflight": "1.0.6","inherits": "2.0.3","inquirer": "3.2.1","is-stream": "1.1.0","isomorphic-fetch": "2.2.1","js-tokens": "3.0.2","lodash": "4.17.15","loose-envify": "1.3.1","metro": "0.58.0","metro-config": "0.58.0","metro-core": "0.58.0","metro-react-native-babel-transformer": "0.58.0","metro-resolver": "0.58.0","minimatch": "3.0.4","minimist": "1.2.5","mkdirp": "0.5.5","nice-try": "1.0.5","node-stream-zip": "1.11.2","npm-run-path": "2.0.2","object-assign": "4.1.1","once": "1.4.0","ora": "3.4.0","p-finally": "1.0.0","path-is-absolute": "1.0.1","path-key": "2.0.1","promise": "7.3.1","pump": "3.0.0","react-is": "16.13.1","serve-static": "1.13.1","setimmediate": "1.0.5","shebang-command": "1.2.0","signal-exit": "3.0.2","strip-eof": "1.0.0","sudo-prompt": "9.2.1","ua-parser-js": "0.7.21","wcwidth": "1.0.1","which": "1.3.0"  },"_requested": {"type": "version","registry": true,"raw": "react-native@0.62.2","name": "react-native","escapedName": "react-native","rawSpec": "0.62.2","saveSpec": null,"fetchSpec": "0.62.2"  },"_requiredBy": ["#USER","/"  ],"_resolved": "https://registry.npmjs.org/react-native/-/react-native-0.62.2.tgz","_shasum": "d831e11a3178705449142df19a70ac2ca16bad10","_spec": "react-native@0.62.2","_where": "/Users/$$$$/Desktop/zippy/zippy-ios","bin": {"react-native": "cli.js"  },"bugs": {"url": "https://github.com/facebook/react-native/issues"  },"bundleDependencies": false,"dependencies": {"@babel/runtime": "^7.0.0","@react-native-community/cli": "^4.5.1","@react-native-community/cli-platform-android": "^4.5.1","@react-native-community/cli-platform-ios": "^4.5.0","abort-controller": "^3.0.0","anser": "^1.4.9","base64-js": "^1.1.2","connect": "^3.6.5","create-react-class": "^15.6.3","escape-string-regexp": "^1.0.5","eslint-plugin-relay": "1.4.1","event-target-shim": "^5.0.1","fbjs": "^1.0.0","fbjs-scripts": "^1.1.0","hermes-engine": "~0.4.0","invariant": "^2.2.4","jsc-android": "^245459.0.0","metro-babel-register": "0.58.0","metro-react-native-babel-transformer": "0.58.0","metro-source-map": "0.58.0","nullthrows": "^1.1.1","pretty-format": "^24.7.0","promise": "^7.1.1","prop-types": "^15.7.2","react-devtools-core": "^4.0.6","react-refresh": "^0.4.0","regenerator-runtime": "^0.13.2","scheduler": "0.17.0","stacktrace-parser": "^0.1.3","use-subscription": "^1.0.0","whatwg-fetch": "^3.0.0"  },"deprecated": false,"description": "A framework for building native apps using React","detox": {"test-runner": "jest","runner-config": "RNTester/e2e/config.json","specs": "","configurations": {"ios.sim.release": {"binaryPath": "RNTester/build/Build/Products/Release-iphonesimulator/RNTester.app/","build": "xcodebuild -workspace RNTester/RNTesterPods.xcworkspace -scheme RNTester -configuration Release -sdk iphonesimulator -derivedDataPath RNTester/build -UseModernBuildSystem=NO -quiet","type": "ios.simulator","name": "iPhone 6s"      },"ios.sim.debug": {"binaryPath": "RNTester/build/Build/Products/Debug-iphonesimulator/RNTester.app/","build": "xcodebuild -workspace RNTester/RNTesterPods.xcworkspace -scheme RNTester -configuration Debug -sdk iphonesimulator -derivedDataPath RNTester/build -UseModernBuildSystem=NO -quiet","type": "ios.simulator","name": "iPhone 6s"      }    }  },"devDependencies": {"@babel/core": "^7.0.0","@babel/generator": "^7.5.0","@react-native-community/eslint-plugin": "file:packages/eslint-plugin-react-native-community","@reactions/component": "^2.0.2","async": "^2.4.0","babel-eslint": "10.0.1","clang-format": "^1.2.4","coveralls": "^3.0.2","detox": "14.5.1","eslint": "5.1.0","eslint-config-fb-strict": "24.3.0","eslint-config-fbjs": "2.1.0","eslint-config-prettier": "^6.0.0","eslint-plugin-babel": "^5.3.0","eslint-plugin-eslint-comments": "^3.1.1","eslint-plugin-flowtype": "2.50.3","eslint-plugin-jest": "22.4.1","eslint-plugin-jsx-a11y": "6.2.1","eslint-plugin-prettier": "2.6.2","eslint-plugin-react": "7.12.4","eslint-plugin-react-hooks": "^2.0.1","eslint-plugin-react-native": "3.8.1","eslint-plugin-relay": "1.4.1","flow-bin": "^0.113.0","flow-remove-types": "1.2.3","jest": "^24.8.0","jest-junit": "^6.3.0","jscodeshift": "^0.6.2","mkdirp": "^0.5.1","prettier": "1.17.0","react": "16.11.0","react-test-renderer": "16.11.0","shelljs": "^0.7.8","signedsource": "^1.0.0","ws": "^6.1.4","yargs": "^14.2.0"  },"engines": {"node": ">=8.3"  },"files": ["!template/node_modules","!template/package-lock.json","!template/yarn.lock",".flowconfig","android","cli.js","flow","index.js","init.sh","interface.js","jest-preset.js","jest","lib","Libraries","LICENSE","local-cli","packager","React-Core.podspec","react-native.config.js","react.gradle","React.podspec","React","ReactAndroid","ReactCommon","README.md","rn-get-polyfills.js","scripts/compose-source-maps.js","scripts/ios-configure-glog.sh","scripts/ios-install-third-party.sh","scripts/launchPackager.bat","scripts/launchPackager.command","scripts/node-binary.sh","scripts/packager.sh","scripts/react-native-xcode.sh","template.config.js","template","third-party-podspecs"  ],"homepage": "https://github.com/facebook/react-native#readme","jest-junit": {"outputDirectory": "reports/junit","outputName": "js-test-results.xml"  },"license": "MIT","name": "react-native","peerDependencies": {"react": "16.11.0"  },"repository": {"type": "git","url": "git+ssh://git@github.com/facebook/react-native.git"  },"scripts": {"build-ios-e2e": "detox build -c ios.sim.release","clang-format": "clang-format -i --glob=*/**/*.{h,cpp,m,mm}","docker-build-android": "docker build -t reactnativeci/android -f .circleci/Dockerfiles/Dockerfile.android .","docker-setup-android": "docker pull reactnativecommunity/react-native-android","flow": "flow","flow-check-android": "flow check --flowconfig-name .flowconfig.android","flow-check-ios": "flow check","format": "npm run prettier && npm run clang-format","format-check": "prettier --list-different \"./**/*.{js,md,yml}\"","lint": "eslint .","lint-ci": "./scripts/circleci/analyze_code.sh && yarn shellcheck","prettier": "prettier --write \"./**/*.{js,md,yml}\"","shellcheck": "./scripts/circleci/analyze_scripts.sh","start": "react-native start","test": "jest","test-android-all": "yarn run docker-build-android && yarn run test-android-run-unit && yarn run test-android-run-instrumentation && yarn run test-android-run-e2e","test-android-e2e": "yarn run docker-build-android && yarn run test-android-run-e2e","test-android-instrumentation": "yarn run docker-build-android && yarn run test-android-run-instrumentation","test-android-run-e2e": "docker run --privileged -it reactnativeci/android bash .circleci/Dockerfiles/scripts/run-ci-e2e-tests.sh --android --js","test-android-run-instrumentation": "docker run --cap-add=SYS_ADMIN -it reactnativeci/android bash .circleci/Dockerfiles/scripts/run-android-docker-instrumentation-tests.sh","test-android-run-unit": "docker run --cap-add=SYS_ADMIN -it reactnativeci/android bash .circleci/Dockerfiles/scripts/run-android-docker-unit-tests.sh","test-android-unit": "yarn run docker-build-android && yarn run test-android-run-unit","test-ci": "jest --maxWorkers=2 --ci --reporters=\"default\" --reporters=\"jest-junit\"","test-ios": "./scripts/objc-test.sh test","test-ios-e2e": "detox test -c ios.sim.release RNTester/e2e"  },"version": "0.62.2"}

react native ios create actionable notification

$
0
0

I have checked with many blogs and examples.But I am not getting proper documentation or steps to add actions in iOS push notification.

My application builds using latest versions,

So using this plugin I am able to get normal notification, but in some case I need user action so want create Notification with Accept and Decline button. like below image,

Actionable notification

Also I have tried with react-native-ios-notification-actions plugin. But this plugin is not working with my current PushNotificationIOS plugin.

So my question is,

  1. How I can register action as there is option given in plugin documentation to handle actionable parameter but not sure how to register it before sending the notification?
  2. Is there any other plugin using that anyone achieve this functionality?
  3. Any iOS guy can suggest me steps or way where I can merge native UNNotificationAction class code into it's didReceiveRemoteNotification method.

React-native - screen on iOS is not updated even if render method is called

$
0
0

I am working on mobile app and I've run into problem which I don't know how to resolve.

I have to load some data from API after creating a screen. I do this in componentDidMount method which is async so I can use await keyword. After that I am setting state so the Loader component (which is just modal displaying text) is hidden and the screen is rerendered with data from API. This works fine on Android devices. But running this code on iOS (iPhone X) doesn't work. The render methods of SomeScreen.js and Loader.js are called and Loader.js render method is returning null (checked with console) but the view on iPhone is not updated. Loader modal is still there even when its render method is returning null. Am I doing anything wrong? Calling this.foceUpdate() doesn't help either.

SomeScreen.js

import React, {Component} from 'react';import Loader from 'components/Loader/Loader';export default class SomeScreen extends Component {    constructor(props) {        super(props);        this.state = {            loading: true,            data: []        };    }    async componentDidMount() {        const data = await this.loadData();        this.setState({loading: false, data: data})    }    async loadData() {       //fetch and return data from API    }    render() {        return (<SafeAreaView style={{flex: 1}}><Loader loading={this.state.loading}/>                //other rendering...</SafeAreaView>        );    }}

Loader.js

import React, {Component} from 'react';import {Modal, Text, View} from 'react-native';export default class Loader extends Component {    static defaultProps = {        loading: false    };    render() {        if (this.props.loading !== true) {           return null;        }        return(<Modal              transparent={false}              animationType={'none'}              visible={true}><View style={{backgroundColor: "white", flex: 1, justifyContent: "center"}}><Text>Loading data...</Text></View></Modal>        )    }}

React Native ternary operator display lag due to ajax request

$
0
0

I have isRegistered that I fetch via ajax call so isRegistered takes an amount of time to be set.

<View style={{ width: '48%' }}><Text style={style.labelStyle}>            {isRegistered ? 'Attempt' : 'Amount'}</Text></View>

As a result I see 'Amount' first (a few hundred of milliseconds so noticeable by human) before I can see 'Attempt'

How can I avoid this?

I am developping on IOS emulator (not device) but wonder it will also happen on real device

react-native alert error "Attemp to present UIAlertController

$
0
0

In my react-native application i use some alerts to display messages to the user.

On android everything works fine, but in ios i get following error, every time i try to display an alert:

Warning: Attempt to present <UIAlertController: 0x1030fb600> on <RCTModalHostViewController: 0x1021ad720> whose view is not in the window hierarchy!

i call the alert message via:

this.setState({spinner: true}, () => {  eventHandler    .joinEventById(eventCode, qrHash)    .then((response) => {      this.setState({spinner: false}, () => {        Toast.show('Event Registrierung erfolgreich');      });    })    .catch((error) => {      this.setState({spinner: false}, () =>        funcHelper.showAlert('Fehler beim Beitritt', error, null),      );    });});

i found some solutions to fix it but only for native code, not for the react version.

Can someone give me a hint how i cant fix this or whats the reason for this error

ReferenceError: Can't find variable: document when importing loadStripe from '@stripe.stripe-js'

$
0
0

While developing an app in React Native intgerating with Stripe, I keep getting a warning [ReferenceError: Can't find variable: document].

I can't get the cause for the error.

The only possiblity I can think is if the Stripe module is only built for react js and is looking for the HTML document to reference.

I am fairly certain it is this line which is causing the warning.

import {loadStripe} from '@stripe/stripe-js';

When it is included the warning shows up. I read the documentation but there's nothing I could find.

If anyone could point me in the right direction for what might be causing the problem or if stripe will work on react native as a cross platform app, please let me know.

getInitialLink is not working but onLink is working in react-native-firebase v6

$
0
0

I am using the following code in App.js - componentDidMount

    firebase      .dynamicLinks()      .getInitialLink()      .then(link => {        if (link) {          if (link.url.includes('/s/')) {            this.handleSignupURL(link.url)          }        }      })    firebase.dynamicLinks().onLink(({ url }) => {      if (url && url.includes('/s/')) {        this.handleSignupURL(url)      }    })  }

On clicking the dynamic link: When the app is active, onLink handler is fired and the app handles it correctly. But when the app is closed, getInitialLink returns a null. Any solution to get the initial link?

I am using react-native-firebase v6, react-native corresponding to expo 36. The installation is performed as per the new react-native-firebase quick start. I am using the iOS app.

Audio/Video not supported React Native ios webview

$
0
0

I'm working on a live video session app. I have used the BigBlueButton API to develop the web version, which is working properly on the web. I'm trying to use that web app URL in my react native app using react-native-webview. In iOS app, I'm able to join the session but while enabling video I'm getting error message as follows

**Audio/Video not supported**At this time audio and video not supported on chrome for ios. We recommend using Safari iOS.

When I'm setting userAgent as "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/604.3.5 (KHTML, like Gecko) Chrome/83.0.4103.97 Version/12.0.1 Mobile Safari/604.3.5".

And when I'm setting userAgent as "Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/83.0.4103.88 Mobile/15E148 Safari/604.1" I'm getting following error.

On iOS please use Safari for full support.

When I'm removing the userAgent it showing the error like

It looks like you're using a browser that is not supported. Please use either Chrome or Firefox for full support.

At this time audio and video not supported on chrome for ios. We recommend using Safari iOS.On iOS please use Safari for full support.It looks like you're using a browser that is not supported. Please use either Chrome or Firefox for full support.

Thanks in advance.


react native - collapse table

$
0
0

I plan to make a collapse table. You can find it in this link

I tried:

  • Using a Custom Component for column name and FlatList for the first column
  • Using Section list for the rest column

=============================================================
| _____Custom Component_____ | __________Section list header__________ |
|============================================================|
| _________Flat List___________| __________ Section list body____________|
|============================================================|

I am able to make the list scroll together. However, if the list has 450+ rows, the performance will be reduced dramatically.

Please let me know if you have any solution.

Thank you in advanced!

TextInput with TextAlign on iOS does not add ellipsis instead wraps [React Native]

$
0
0
import React, { PureComponent } from 'react';import {Text, TextInput, View} from 'react-native';const App = () => {  return (<View style={{flex: 1, justifyContent: 'center'}}><View><Text>Text Input without alignment</Text><TextInput style={{padding: 10, margin: 20, borderColor: 'grey', borderWidth: 1}}/><Text>Text Input with right alignment</Text><TextInput textAlign={'right'} style={{padding: 10, margin: 20, borderColor:  'grey', borderWidth: 1}}/></View><TextInput/></View>);};export default App;

Write some long text into the first field with spaces.

image

Write similar text into the second field.

image

Unfocus second inputExpected: both fields will have ellipsis at the endActual: second input with textAlign doesn't have ellipsis.

Android app works in a different way:It never shows ellipsis but if you type a long string it always shows the end of it and never beginning. I guess it should move to begin when unfocused.

react: 16.11.0 => 16.11.0react-native: 0.62.1 => 0.62.1

I have created an issue on github but haven't got any response yet. https://github.com/facebook/react-native/issues/29068

React native - Can i integrate multi react native application to exiting native application (ios/android)?

$
0
0

I am learning about how to integrate react native app into an existing native app.Most of the tutorials on the internet only instruct integrate 1 application react-native to an existing native application, I don't know if it will work with many react native apps? How can I call multiple jsbundles in native apps? (as screenshot)Thank you <3 enter image description here

How to change display name of an app in react-native

$
0
0

Apple have clear instructions on how to change the display name of an IOS app, but they are not useful for a react-native app because the folder structure is different. How do you change the display name if you have a react-native app?

iOS: Does app by default has any restrictions when doing network requests when app was killed (swiped away)?

$
0
0

First of all I would like to notice that I am not experienced iOS developer, I am writing app in React Native.

The essence of the problem:

If my app was swiped away and push notification from FCM arrived, I would like to send network request in response to user action in notification, but it's failed. The code doesn't even send request, because logs on server side doesn't exist. In the meantime everything works fine in case when app was rolled up or in the foreground state.

Here is the code:

AppDelegate.m:

/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */#import "AppDelegate.h"#import <React/RCTBridge.h>#import <React/RCTBundleURLProvider.h>#import <React/RCTRootView.h>#import <React/RCTLinkingManager.h>@import Firebase;#import "FirebaseMessagingModule.h"@implementation AppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{  ...  [FIRApp configure];  FirebaseMessagingModule* firebaseMessagingModule = [bridge moduleForClass:FirebaseMessagingModule.class];  [FIRMessaging messaging].delegate = firebaseMessagingModule;  /*   Notifications require some setup   */  if ([UNUserNotificationCenter class] != nil) {    // iOS 10 or later    // For iOS 10 display notification (sent via APNS)    [UNUserNotificationCenter currentNotificationCenter].delegate = firebaseMessagingModule;    UNAuthorizationOptions authOptions = UNAuthorizationOptionAlert |        UNAuthorizationOptionSound | UNAuthorizationOptionBadge;    [[UNUserNotificationCenter currentNotificationCenter]        requestAuthorizationWithOptions:authOptions        completionHandler:^(BOOL granted, NSError * _Nullable error) {          // ...        }];  } else {    // iOS 10 notifications aren't available; fall back to iOS 8-9 notifications.    UIUserNotificationType allNotificationTypes =    (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge);    UIUserNotificationSettings *settings =    [UIUserNotificationSettings settingsForTypes:allNotificationTypes categories:nil];    [application registerUserNotificationSettings:settings];  }  [application registerForRemoteNotifications];  [firebaseMessagingModule register2FACategory];  return YES;}...@end

FirebaseMessagingModule.h:

////  FirebaseMessagingModule.h//  bastionpassmobile////  Created by Anotn on 25/05/2020.//  Copyright © 2020 Facebook. All rights reserved.//#ifndef FirebaseMessagingModule_h#define FirebaseMessagingModule_h#endif /* FirebaseMessagingModule_h */#import <React/RCTBridgeModule.h>#import <React/RCTEventEmitter.h>@import Firebase;@interface FirebaseMessagingModule : NSObject <RCTBridgeModule, FIRMessagingDelegate, UNUserNotificationCenterDelegate>@property NSString* token;- (void)register2FACategory;@end

FirebaseMessagingModule.m:

////  FirebaseMessagingModule.m//  bastionpassmobile////  Created by Anotn on 25/05/2020.//  Copyright © 2020 Facebook. All rights reserved.//#import <Foundation/Foundation.h>#import "FirebaseMessagingModule.h"@import Firebase;#import "constants.h"#import "MF_Base32Additions.h"#import <CommonCrypto/CommonCrypto.h>@implementation FirebaseMessagingModuleRCT_EXPORT_MODULE()/* Registers 2FA category for remote notifications. */- (void)register2FACategory{  UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter];  UNNotificationAction* twofaDeclineAction = [UNNotificationAction actionWithIdentifier:TWOFA_NOTIFICATION_ACTION_DECLINE_ID title:TWOFA_NOTIFICATION_ACTION_DECLINE_LABEL options:UNNotificationActionOptionAuthenticationRequired];  UNNotificationAction* twofaConfirmAction = [UNNotificationAction actionWithIdentifier:TWOFA_NOTIFICATION_ACTION_CONFIRM_ID title:TWOFA_NOTIFICATION_ACTION_CONFIRM_LABEL options:UNNotificationActionOptionAuthenticationRequired];  UNNotificationCategory* twofaCategory = [UNNotificationCategory categoryWithIdentifier:TWOFA_NOTIFICATION_CATEGORY_ID actions:@[twofaDeclineAction, twofaConfirmAction] intentIdentifiers:@[] options:UNNotificationCategoryOptionNone];  NSSet* categories = [NSSet setWithObject:twofaCategory];  [center setNotificationCategories:categories];}- (void)messaging:(FIRMessaging *)messaging    didReceiveRegistrationToken:(NSString *)fcmToken    NS_SWIFT_NAME(messaging(_:didReceiveRegistrationToken:)){  [self setToken:fcmToken];}- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler __API_AVAILABLE(macos(10.14), ios(10.0), watchos(3.0), tvos(10.0)){  completionHandler(UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionSound);}- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler __API_AVAILABLE(macos(10.14), ios(10.0), watchos(3.0)) __API_UNAVAILABLE(tvos){  BOOL is2FAConfirm = [response.actionIdentifier isEqualToString:TWOFA_NOTIFICATION_ACTION_CONFIRM_ID];  BOOL is2FADecline = [response.actionIdentifier isEqualToString:TWOFA_NOTIFICATION_ACTION_DECLINE_ID];  if (is2FAConfirm || is2FADecline) {    // Retrieve notification data    NSDictionary* userInfo = response.notification.request.content.userInfo;    NSString* sessionId = userInfo[TWOFA_NOTIFICATION_DATA_SESSIONID_KEY];    NSString* username = userInfo[TWOFA_NOTIFICATION_DATA_USERNAME_KEY];    NSString* stage = userInfo[TWOFA_NOTIFICATION_DATA_STAGE_KEY];    // Retrieve storage data    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];    NSString* authTokensString = [userDefaults valueForKey:STORAGE_KEY_AUTH_TOKENS];    NSData* authTokensData = [authTokensString dataUsingEncoding:NSUTF8StringEncoding];    NSInputStream* authTokensStream = [NSInputStream inputStreamWithData:authTokensData];    [authTokensStream open];    NSData* authTokens = [NSJSONSerialization JSONObjectWithStream:authTokensStream options:0 error:nil];    [authTokensStream close];    NSDictionary<NSString*, NSString*>* clientIds = [authTokens valueForKey:STORAGE_KEY_CLIENT_IDS];    NSString* clientId = [clientIds valueForKey:username];    NSURLSessionConfiguration* urlSessionConfiguration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:@"twoFAConfirmation"];    urlSessionConfiguration.networkServiceType = NSURLNetworkServiceTypeBackground;    urlSessionConfiguration.discretionary = NO;    urlSessionConfiguration.HTTPAdditionalHeaders = @{      @"Content-Type": @"application/json",      @"Accept": @"application/json",      @"X-Client-Type": @"mobile"    };    NSURLSession* urlSession = [NSURLSession sessionWithConfiguration:urlSessionConfiguration];    NSURL* url = [NSURL URLWithString:[API_URL stringByAppendingString:is2FAConfirm ? API_ENDPOINT_2FA_APPROVE : API_ENDPOINT_2FA_REJECT]];    NSMutableURLRequest* urlRequest = [NSMutableURLRequest requestWithURL:url];    urlRequest.HTTPMethod = @"POST";    urlRequest.allHTTPHeaderFields = @{      @"Content-Type": @"application/json",      @"Accept": @"application/json",      @"X-Client-Type": @"mobile"    };    if (is2FADecline) {      urlRequest.HTTPBody = [NSJSONSerialization dataWithJSONObject:@{        TWOFA_CONFIRMATION_REQUEST_KEY_SESSIONID: sessionId,        TWOFA_CONFIRMATION_REQUEST_KEY_AUTH_CLIENTID: clientId      } options:0 error:nil];      NSURLSessionUploadTask* rejectConfirmationTask = [urlSession uploadTaskWithStreamedRequest:urlRequest];      [rejectConfirmationTask resume];    } else if (is2FAConfirm) {      NSString* hotpSecretsString = [userDefaults valueForKey:STORAGE_KEY_HOTP_SECRETS];      NSData* hotpSecretsData = [hotpSecretsString dataUsingEncoding:NSUTF8StringEncoding];      NSInputStream* hotpSecretsStream = [NSInputStream inputStreamWithData:hotpSecretsData];      [hotpSecretsStream open];      NSData* hotpSecrets = [NSJSONSerialization JSONObjectWithStream:hotpSecretsStream options:0 error:nil];      [hotpSecretsStream close];      NSString* hotpSecret = [hotpSecrets valueForKey:username];      NSString* totpCode = [self getTotpCode:hotpSecret];      urlRequest.HTTPBody = [NSJSONSerialization dataWithJSONObject:@{        TWOFA_CONFIRMATION_REQUEST_KEY_SESSIONID: sessionId,        TWOFA_CONFIRMATION_REQUEST_KEY_AUTH_CLIENTID: clientId,        TWOFA_CONFIRMATION_REQUEST_KEY_TOKEN: totpCode      } options:0 error:nil];      NSURLSessionUploadTask* approveConfirmationTask = [urlSession uploadTaskWithStreamedRequest:urlRequest];      [approveConfirmationTask resume];    }  } else {     NSLog(@"Undefined type of action");  }  completionHandler();}/* Returns totp code for provided hotp secret. */- (NSString*)getTotpCode:(NSString*)hotpSecret{  NSString* hotpSecretDecoded = [NSString stringFromBase32String:hotpSecret];  const char *cKey = [hotpSecretDecoded cStringUsingEncoding:NSUTF8StringEncoding];  const uint64_t cData = CFSwapInt64([[NSDate date] timeIntervalSince1970] * 1000.0 / 30000);  unsigned char cHMAC[CC_SHA256_DIGEST_LENGTH];  CCHmac(kCCHmacAlgSHA256, cKey, strlen(cKey), &cData, sizeof(cData), cHMAC);  NSData* hash = [[NSData alloc] initWithBytes:cHMAC length:sizeof(cHMAC)];  int offset = *(int*)[[hash subdataWithRange:NSMakeRange([hash length] - 1, 1)] bytes] & 0x0f;  const long* dbc1 = [[hash subdataWithRange:NSMakeRange(offset, (offset + 4) - offset)] bytes];  long dbc2 = -(~CFSwapInt32(*dbc1) + 1) & 0x7fffffff;  long totp = dbc2 % (long)pow(10, TWOFA_OTP_LENGTH);  NSString* totpCode = @"";  NSString* totpCodeSource = [[NSNumber numberWithLong:totp] stringValue];  while (([totpCode length] + [totpCodeSource length]) < TWOFA_OTP_LENGTH) {    totpCode = [totpCode stringByAppendingString:@"0"];  }  return [totpCode stringByAppendingString:totpCodeSource];}/* Resolves with FCM registration token or rejected if token was not provided. */RCT_REMAP_METHOD(getToken, getTokenResolver:(RCTPromiseResolveBlock)resolve getTokenRejecter:(RCTPromiseRejectBlock)reject){  if (self.token) {    resolve(self.token);  } else {    reject(@"0", @"Failed on get token", [[NSError alloc] init]);  }}/* Resolves with FCM registration token or rejected if attempt to retrieve token will be failed. */RCT_REMAP_METHOD(retrieveToken, retrieveTokenResolver:(RCTPromiseResolveBlock)resolve retrieveTokenRejecter:(RCTPromiseRejectBlock)reject){  [[FIRInstanceID instanceID] instanceIDWithHandler:^(FIRInstanceIDResult * _Nullable result,                                                      NSError * _Nullable error) {    if (error != nil) {      reject(@"0", @"Failed to retrieve token", [[NSError alloc] init]);    } else {      resolve(result.token);    }  }];}@end

Any help would be appreciated!

React Native MapView rotate map with camera heading

$
0
0

I am trying to rotate a map in React Native's <MapView> but haven't been able to find a description on how to rotate a map according to the heading of the camera. The tutorial states:

When this property is set to true and a valid camera is associated with the map, the camera’s heading angle is used to rotate the plane of the map around its center point.

So I came as far as:

<MapView          style={styles.map}          onRegionChange={this._onRegionChange}          onRegionChangeComplete={this._onRegionChangeComplete}          region={this.state.mapRegion}          annotations={this.state.annotations}          rotateEnabled={true}

But there is no explanation on how a camera is associated with the map.

Can anyone help with this issue please?

React-native iOS build error after link command

$
0
0

I got the following error when I try to run the app. I noticed that this error happens after run 'npx react-native link'.

    Command line invocation:/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace MyApp.xcworkspace -configuration Debug -scheme MyApp -destination id=ED360224-1DF7-481F-BCE5-9700938E4533note: Using new build systemnote: Building targets in parallelnote: Planning buildnote: Constructing build descriptionBuild system informationerror: Multiple commands produce '/Users/vidolin/Library/Developer/Xcode/DerivedData/MyApp-gbsfowkzxjogwsdruwnezgcjnqvv/Build/Products/Debug-iphonesimulator/MyApp.app/Zocial.ttf':Target 'MyApp' (project 'MyApp') has copy command from '/Users/vidolin/development/MyApp/node_modules/react-native-vector-icons/Fonts/Zocial.ttf' to '/Users/vidolin/Library/DCommand line invocation:/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace MyApp.xcworkspace -configuration Debug -scheme MyApp -destination id=ED360224-1DF7-481F-BCE5-9700938E4533note: Using new build systemnote: Building targets in parallelnote: Planning buildnote: Constructing build descriptionBuild system informationerror: Multiple commands produce '/Users/vidolin/Library/Developer/Xcode/DerivedData/MyApp-gbsfowkzxjogwsdruwnezgcjnqvv/Build/Products/Debug-iphonesimulator/MyApp.app/Zocial.ttf':Target 'MyApp' (project 'MyApp') has copy command from '/Users/vidolin/development/MyApp/node_modules/react-native-vector-icons/Fonts/Zocial.ttf' to '/Users/vidolin/Library/D

Can anyone help me, pls?

Tks


users can't receive notification on updating the app

$
0
0

By mistake, I uploaded the GoogleService-info.plist from some other project with different bundle identifier in my latest release, to my AppStore. and now many people have downloaded the application from this release, and obviously they're not receiving any remote notifications. Now when I changed the GoogleService-info.plist to the actual project file and uploaded the app to test flight, when I update the app I still don't receive any notifications but when I uninstall and reinstall the app I start getting notifications. however, there're many users who are already using the app and now they'll just update the app and not re-install.any help in this will be highly appreciated.

React-Native [iOS] universal linking not working for different iOS versions

$
0
0

I am using universal linking for login in my react-native application but universal linking does work for some versions and for some it doesn't launch the application but open the url in safari.I have hosted apple-app-site-association on server. Users are using testflight for testing the app but sometime it works for iOS 13+ version and breaks for < 13 and today I got and feedback that its not working on 13.5.1.

Here is my apple-app-site-association

{"applinks": {"apps": [],"details": [      {"appIDs": ["XXXXXXXX.com.abc.xyz"        ],"appID": "XXXXXXXX.com.abc.xyz","components": [          {"/": "/verify/*","comment": ""          }        ],"paths": ["/verify/*"]      },     {"appID": "XXXXXXXX.com.abc.xyz","paths": ["/verify/*"]     }    ]  }}

Here is my entitlement file image

I need serious help for this I can provide more info if required.

Is there a way to integrate a packaged game (Unreal Engine 4) apk into an application that is developed using React-Native?

$
0
0

We are a video game developing comapny that uses Unreal Engine 4 to develop games.We have a client who has an application under development for both Android and the iOS on their own (we did are not the ones developing it for them). They are developing their application using React-Native.

We would like to develop a game for them using Unreal Engine 4. But, we would like it to be integrated into their application.

Is there a way to integrate a packaged game (Unreal Engine 4) apk into an application that is developed using React-Native?

Thank you

Pod install not working in react-native mac os catalina 10.15

$
0
0

Error: System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory

in mac os catalina

What does '...' in React-Native mean?

$
0
0

A piece of react-native code:

enderScene(route, navigator) {   let Component = route.component;   return (<Component {...route.params} navigator={navigator}></Component>   );}

this code returns a Component Object ,

But I don't understand this code ---> {...route.params}

Question:

  1. What is meant by '...' ?
  2. Can you tell me what is meant by " {...route.params}" ?
Viewing all 16565 articles
Browse latest View live


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