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

How to place floating action button in bottom right in React Native

$
0
0

I am trying to place a floating action button in the lower right corner of my app but it is placing it in the top left way off screen.

Returned view:

<View><View style={{flexDirection: 'row'}}><TouchableOpacity onPress={this.onPress} activeOpacity={.5} ><Image              source={require('./assets/images/hamburger.png')}              style={{ width: 30, height: 25,  marginLeft: 15}}          /></TouchableOpacity></View><FloatingAction style={styles.bottom}/></View>

Styles:

const styles = StyleSheet.create({  bottom: {    flex: 1,    position: 'absolute',    bottom: 10,    right:10  },});

My current view displays a header and a bottom tab view. I am able to place multiple FAB's in each tab screen but that produces an undesirable behavior. Thank you for any help.

Edit:What I have:

What I want:


SSO google sign-in Couldn't sign

$
0
0

We are developing a react-native web assets app (for iOS & android patform). Which has SSO integration, When I press google login button. I will redirect to google sign-in page, after entered the mail-id, which is not taking me to password entering screen. I'm getting Couldn't sign you in (below error message in the screenshot).

enter image description here

Problems with ejected Expo app on IOS (React-Native)

$
0
0

I'm having troubles with my ejected Expo app for IOS.

Started building the app with Expo, but after some time I needed Bluetooth functionalities, so decided to eject, to use native code. Everything works fine, but when I try to load my app on an IOS-device (after building in xcode), it won't run the way it would like it to.

I would like to try the app, via a hotspot (4G), but it won't start. When there is no Wifi it will start but says 'Connect to Metro to develop Javascript'.

My question is: Can I make my app into a standalone app, without the Expo server running on a pc on the same wifi network?

How to handle push notification when app was force-quit by user? [iOS]

$
0
0

First of all, just to clarify...

I have done quite some searchings and readings on the existing sources (medium, stackoverflow, apple developer forum, etc.) before asking this "duplicate question" for confirming and concluding my knowledge is correct.

  1. Will iOS launch my app into the background if it was force-quit by the user?
  2. How to get the push notification payload when force-quit / swipe up to kill the iOS app without tapping on the banner/alert?
  3. https://medium.com/fenrir-inc/handling-ios-push-notifications-the-not-so-apparent-side-420891ddf10b
  4. Handling Push Notifications when App is Terminated
  5. https://developer.apple.com/forums/thread/62005#:~:text=In%20most%20cases%2C%20the%20system,force%20quit%20by%20the%20user.

Before we begin, just to put the terms in very precise manner. Here's what I'm referring when I mention

  1. Foreground - App is Active and running, user is basically interacting with the application
  2. Background - User tapped on home button after interacting. App remains in background, user can double tap on home button and find the app from App Switcher.
  3. Quit - App is actually in background, but it was terminated by the System itself.
  4. Kill - App is no longer in background, user double tap on home button and SWIPE the app away from App Switcher.

Use case i'm trying to tackle

App receive push notification in BACKGROUND, QUIT & KILL states then perform certain background actions (updating Application Badge + storing the Notification in device)

  1. For background - Yes I've managed to achieve this by having content-available = 1 sent together in APNS payload. Notification banner appear, background action executed!
  2. For QUIT - Yes I've managed to achieve this by having content-available = 1 sent together in APNS payload. Notification banner appear, background action executed!
  3. For KILL - Notification banner appear, BUT background action is not trigger.

My questions

  1. Whenever app is kill, it's not possible to awake the app to perform any background action when notification is receive?
  2. How does it works for messaging app like Whatsapp?
  3. How should I handle my cases when app is force quit?
  • ONLY if user tapped notification banner, my app gets to run those background actions (Increase badge count + storing the data).

  • Otherwise, if user choose to tap on App Icon to open my app. The pushed notification won't exist in my app at all, including badge count is not increase.

Below are what I've tested with Whatsapp

Background State

  1. Open Whatsapp, tap Home button (keep app in background)
  2. Send a text message in device, banner notification appear
  3. Open app by tapping app icon, message is there in app.

FORCE QUIT State

  1. Open Whatsapp, double tap Home button, swipe app away
  2. Send a text message in device, banner notification appear.
  3. Open app by tapping app icon, message is there in app.

FORCE QUIT State + WiFi & Cellular data turned OFF

  1. Open Whatsapp, double tap Home button, swipe app away
  2. Send a text message in device, banner notification appear
  3. Turn off WiFi & Cellular data is off. (Confirm and tried to access website via Safari)
  4. Open app by tapping app icon, message is there in app.

The tests with Whatsapp, basically concludes that it's possible to have your app awake to perform background actions (Especially with the case of FORCE QUIT State + WiFi & Cellular data turned OFF)

The only "explanation" I'm able to explain myself is, they are using PushKit notifications Framework instead of User Notification Framework.

Update 3 Nov - iOS 13 wakes app even in KILL state

Apparently on iOS 13, like what @hubsi has mentioned down at the comment as well as some comments from Apple forum. iOS 13 does wakes my app even the app was manually killed by the user.

react native pod install fails with firebase

$
0
0

When Trying to run pod install for react native project , I got the following error

[!] Error installing Firebase――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――### Command

C:/Ruby30-x64/bin/pod install

### Report* What did you do?* What did you expect to happen?* What happened instead?### Stack

CocoaPods : 1.10.1Ruby : ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x64-mingw32]RubyGems : 3.2.15Host : Unable to find an executable (No such file or directory - sw_vers) ()Xcode : -version) ()Git : git version 2.23.0.windows.1Ruby lib dir : C:/Ruby30-x64/libRepositories : cocoapods - git - https://github.com/CocoaPods/Specs.git @ f587e47de45e30c653e2d258a78c364cbec08bb6

### Plugins

cocoapods-deintegrate : 1.0.4cocoapods-plugins : 1.0.0cocoapods-search : 1.0.0cocoapods-trunk : 1.5.0cocoapods-try : 1.2.0

### Podfile```rubyrequire_relative '../node_modules/react-native/scripts/react_native_pods'require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'platform :ios, '11.0'source 'https://github.com/CocoaPods/Specs.git'target 'BankSms' do  config = use_native_modules!  use_react_native!(    :path => config[:reactNativePath],    # to enable hermes on iOS, change `false` to `true` and then install pods    :hermes_enabled => false  )  target 'BankSmsTests' do    inherit! :complete    # Pods for testing  end  # Enables Flipper.  #  # Note that if you have use_frameworks! enabled, Flipper will not work and  # you should disable the next line.  use_flipper!()  post_install do |installer|    react_native_post_install(installer)  endend

Error

Errno::ENOENT - No such file or directory @ dir_s_mkdir - /Caches/CocoaPods/Pods/Release/Firebase/7.11.0-c121f/FirebaseInAppMessaging/Tests/Integration/FunctionalTestApp/ExternalAppExample/fiam-external-ios-testing-app/fiam-external-ios-testing-app/Assets.xcassets/AppIcon.appiconset

How to bypass that error ??

React Native - How to create jewellery virtual try on app (rings, bracelets, earrings, necklaces, glasses...)

$
0
0

I am trying to build virtual try on app in React Native, any help is very much appreciated. If there is any way to do this in React Native or even by building native modules in Swift and Java please let me know.

Not able to receive notification in any app state using PushNotificationIOS(react-native-ios)

$
0
0

I have update my react native firebase to v6 and used this package to show notification on iOS. But I am not receiving notification in any of the state: foreground, background and when app is in closed state.

This is my AppDelegate.h file::

#import <React/RCTBridgeDelegate.h>#import <UIKit/UIKit.h>#import <UserNotifications/UNUserNotificationCenter.h>@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate, UNUserNotificationCenterDelegate>@property (nonatomic, strong) UIWindow *window;@end

AppDelegate.m file::

#import "AppDelegate.h"#import <React/RCTBridge.h>#import <React/RCTBundleURLProvider.h>#import <React/RCTRootView.h>#import <ReactNativeNavigation/ReactNativeNavigation.h>#import "RNSplashScreen.h"#import <Firebase.h>#import "SDImageCodersManager.h"#import <SDWebImageWebPCoder/SDImageWebPCoder.h>#import <UserNotifications/UserNotifications.h>#import <RNCPushNotificationIOS.h>@implementation AppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{  NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];    [ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];//    if ([FIRApp defaultApp] == nil) {        [FIRApp configure];//    }    // show splash screen    [RNSplashScreen show];    // Register support for WebP images.    [SDImageCodersManager.sharedManager addCoder:SDImageWebPCoder.sharedCoder];    // Define UNUserNotificationCenter    UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];    center.delegate = self;    return YES;}- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge{#if DEBUG  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];#else  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];#endif}// Required for the register event.- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{ [RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];}// Required for the notification event. You must call the completion handler after handling the remote notification.- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfofetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{  [RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];}// Required for the registrationError event.- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error{ [RNCPushNotificationIOS didFailToRegisterForRemoteNotificationsWithError:error];}// Required for localNotification event- (void)userNotificationCenter:(UNUserNotificationCenter *)centerdidReceiveNotificationResponse:(UNNotificationResponse *)response         withCompletionHandler:(void (^)(void))completionHandler{  [RNCPushNotificationIOS didReceiveNotificationResponse:response];}//Called when a notification is delivered to a foreground app.-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler{  completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge);}@end

After this inside my App.js file I called this function inside constructor::

NotificationService.getInstance().initializeNotificationServiceForIOS();

I have created one service file where I have written the notification logic for android and iOS. Push notifications working fine on android but not getting in case of iOS. This is a code inside my service file for iOS.

import { Alert } from "react-native"; import PushNotification from 'react-native-push-notification'; import messaging from '@react-native-firebase/messaging'; import NotificationHandler from './NotificationHandler'; import PushNotificationIOS from '@react-native-community/push-notification-ios'; import AsyncStorage from '@react-native-community/async-storage'; //constants import { androidNotificationChannelId, isIOS } from '../../constants'; import LocalStorageKeys from '../../constants/LocalStorageKeys'; export default class NotificationService {     /**      * @returns {NotificationService}      */     static getInstance() {         if (NotificationService.myInstance == null) {             NotificationService.myInstance = new NotificationService();         }         return this.myInstance;     }     initializeNotificationServiceForIOS() {         PushNotificationIOS.addEventListener('register', this.onRegistered);         PushNotificationIOS.addEventListener('registrationError', this.onRegistrationError);         PushNotificationIOS.addEventListener('notification', this.onRemoteNotification);         PushNotificationIOS.addEventListener('localNotification', this.onLocalNotification);         PushNotificationIOS.requestPermissions().then(             (data) => {                 console.log('PushNotificationIOS.requestPermissions', data);             },             (data) => {                 console.log('PushNotificationIOS.requestPermissions failed', data);             },         );    }     onRegistered = (deviceToken) => {         console.log("ios deviceToken", deviceToken)         AsyncStorage.setItem(LocalStorageKeys.DEVICE_TOKEN, deviceToken);      };     onRegistrationError = (error) => {         Alert.alert('Failed To Register For Remote Push',            `Error (${error.code}): ${error.message}`,            [              {                 text: 'Dismiss',                 onPress: null,              },            ],         );      };     onRemoteNotification = (notification) => {         const isClicked = notification.getData().userInteraction === 1;         const result = `            Title:  ${notification.getTitle()};\n            Subtitle:  ${notification.getSubtitle()};\n            Message: ${notification.getMessage()};\n            badge: ${notification.getBadgeCount()};\n            sound: ${notification.getSound()};\n            category: ${notification.getCategory()};\n            content-available: ${notification.getContentAvailable()};\n            Notification is clicked: ${String(isClicked)}.`;         if (notification.getTitle() == undefined) {            Alert.alert('Silent push notification Received', result, [              {                 text: 'Send local push',                 onPress: sendLocalNotification,              },            ]);         } else {            Alert.alert('Push Notification Received', result, [              {                 text: 'Dismiss',                 onPress: null,              },            ]);         }     };     onLocalNotification = (notification) => {         const isClicked = notification.getData().userInteraction === 1;         Alert.alert('Local Notification Received',            `Alert title:  ${notification.getTitle()},            Alert subtitle:  ${notification.getSubtitle()},            Alert message:  ${notification.getMessage()},            Badge: ${notification.getBadgeCount()},            Sound: ${notification.getSound()},            Thread Id:  ${notification.getThreadID()},            Action Id:  ${notification.getActionIdentifier()},            User Text:  ${notification.getUserText()},            Notification is clicked: ${String(isClicked)}.`,            [              {                 text: 'Dismiss',                 onPress: null,              },            ],         );     }; }

I have added console inside the "onRemoteNotification" and "onLocalNotification" but nothing happened after sending notification. Also I rechecked the apns certificate and other setting on firebase, this is completed still i am not getting any test sms from firebase and also on any event while sending notification remotely.

Please help and suggest something because I stuck here.

React Native Unrecognized font family not fixing

$
0
0

The fonts are in my asset folder, they are also inside xcode copy bundle resources, and also inside resource folder. I already also ran react-native link, but it still doesn't find the font. Is there something I missed? Please see attached images for reference:

enter image description here

enter image description here

enter image description hereenter image description here

enter image description here

enter image description here


APNS device token not set before retrieving FCM Token for Sender ID - React Native Firebase

$
0
0

I have been following this tutorial to set-up Remote Push notifications on my react-native application using react-native-firebase Version 5.2.0. After I configured everything and ran the application I get an error as:

APNS device token not set before retrieving FCM Token for Sender ID ''. Notifications to this FCM Token will not be delievered over APNS. Be sure to re-retrieve the FCM token once the APNS token is set.

Been trying to figure out how to solve this issue but wasn't quite successful.Running on react-native : 0.61.2, react-native-firebase: 5.2.0

Following is my AppDelegate.m

#import "AppDelegate.h"#import <React/RCTBridge.h>#import <React/RCTBundleURLProvider.h>#import <React/RCTRootView.h>#import <RNCPushNotificationIOS.h>#import <UserNotifications/UserNotifications.h>#import <Firebase.h>@import Firebase;@implementation AppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{  [FIRApp configure];  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge                                                   moduleName:@"helloworld"                                            initialProperties:nil];  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];  UIViewController *rootViewController = [UIViewController new];  rootViewController.view = rootView;  self.window.rootViewController = rootViewController;  [self.window makeKeyAndVisible];  // define UNUserNotificationCenter  UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];  center.delegate = self;  return YES;}- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge{#if DEBUG  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];#else  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];#endif}// Required to register for notifications- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings{  [RNCPushNotificationIOS didRegisterUserNotificationSettings:notificationSettings];}// Required for the register event.- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{  [RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];}// Required for the notification event. You must call the completion handler after handling the remote notification.- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfofetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{  [RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];}// Required for the registrationError event.- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error{  [RNCPushNotificationIOS didFailToRegisterForRemoteNotificationsWithError:error];}// Required for the localNotification event.- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{  [RNCPushNotificationIOS didReceiveLocalNotification:notification];}//Called when a notification is delivered to a foreground app.-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler{  NSLog(@"User Info : %@",notification.request.content.userInfo);  completionHandler(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge);}@end

and token retrieval on my App.js:

const messaging = firebase.messaging();messaging.hasPermission()  .then((enabled) => {    if (enabled) {      messaging.getToken()        .then(token => { console.log("+++++ TOKEN ++++++"+ token) })        .catch(error => { console.log("+++++ ERROR GT +++++"+ error) })    } else {      messaging.requestPermission()        .then(() => { console.log("+++ PERMISSION REQUESTED +++++") })        .catch(error => { console.log("+++++ ERROR RP ++++"+ error) })    }  })  .catch(error => { console.log("+++++ ERROR +++++"+ error) });

Any help would be much appreciated! Thanks!

How to make react-native Picker stay at newly selected option?

$
0
0

I have a picker that I'm testing on iOS right now with two options. Every time I drag down from the first option to the second option, the picker immediately returns to the first option.

This is what my the code for my picker looks like.

<Picker       style={{        width: 100,      }}      selectedValue={(this.state && this.state.pickerValue) || 'a'}      onValueChange={(value) => {        this.setState({value});      }} itemStyle={{color: 'white'}}><Picker.Item label={'Hello'} value={'a'} /><Picker.Item label={'World'} value={'b'} /></Picker>

I want the selector to stay at the newly scrolled-to option. I've also removed the || 'a' part of the selectedValue attribute but that didn't solve the issue either.

Error React Native IOS Exception '-[__NSDictionaryM length]: unrecognised selector sent to

$
0
0

I am new to IOS development and i have developed and build an app for IOS & Android in React Native and the app is fully working in Android. I have also installed the app on the iPhone simulator for testing, and after successfull build when the apps opens then it crashes and Xcode shows the stack of error.

Stack Trace

2018-03-26 17:18:59.537548+0530 VwWoocommerceAppMain[57934:681649] -[__NSDictionaryM length]: unrecognized selector sent to instance 0x60000023abc02018-03-26 17:18:59.555 [fatal][tid:com.facebook.react.AsyncLocalStorageQueue] Exception '-[__NSDictionaryM length]: unrecognized selector sent to instance 0x60000023abc0' was thrown while invoking multiSet on target AsyncLocalStorage with params (        (                (            cart,                        {            }        )    ),    5873)callstack: (0   CoreFoundation                      0x0000000103f8212b __exceptionPreprocess + 1711   libobjc.A.dylib                     0x0000000102874f41 objc_exception_throw + 482   CoreFoundation                      0x0000000104003024 -[NSObject(NSObject) doesNotRecognizeSelector:] + 1323   CoreFoundation                      0x0000000103f04f78 ___forwarding___ + 14324   CoreFoundation                      0x0000000103f04958 _CF_forwarding_prep_0 + 1205   VwWoocommerceAppMain                0x0000000101956824 -[RCTAsyncLocalStorage _writeEntry:changedManifest:] + 2586   VwWoocommerceAppMain                0x0000000101957104 -[RCTAsyncLocalStorage multiSet:callback:] + 4367   CoreFoundation                      0x0000000103f0636c __invoking___ + 1408   CoreFoundation                      0x0000000103f06240 -[NSInvocation invoke] + 3209   CoreFoundation                      0x0000000103f1ec26 -[NSInvocation invokeWithTarget:] + 5410  VwWoocommerceAppMain                0x0000000101966929 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 60211  VwWoocommerceAppMain                0x00000001019ac7a8 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 26612  VwWoocommerceAppMain                0x00000001019ac522 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 7813  libdispatch.dylib                   0x0000000108bf32f7 _dispatch_call_block_and_release + 1214  libdispatch.dylib                   0x0000000108bf433d _dispatch_client_callout + 815  libdispatch.dylib                   0x0000000108bfc855 _dispatch_queue_serial_drain + 116216  libdispatch.dylib                   0x0000000108bfd1ea _dispatch_queue_invoke + 33617  libdispatch.dylib                   0x0000000108bf8f7c _dispatch_queue_override_invoke + 73318  libdispatch.dylib                   0x0000000108c00102 _dispatch_root_queue_drain + 77219  libdispatch.dylib                   0x0000000108bffda0 _dispatch_worker_thread3 + 13220  libsystem_pthread.dylib             0x00000001091465a2 _pthread_wqthread + 129921  libsystem_pthread.dylib             0x000000010914607d start_wqthread + 13)2018-03-26 17:18:59.558030+0530 VwWoocommerceAppMain[57934:681649] Exception '-[__NSDictionaryM length]: unrecognized selector sent to instance 0x60000023abc0' was thrown while invoking multiSet on target AsyncLocalStorage with params (        (                (            cart,                        {            }        )    ),    5873)callstack: (0   CoreFoundation                      0x0000000103f8212b __exceptionPreprocess + 1711   libobjc.A.dylib                     0x0000000102874f41 objc_exception_throw + 482   CoreFoundation                      0x0000000104003024 -[NSObject(NSObject) doesNotRecognizeSelector:] + 1323   CoreFoundation                      0x0000000103f04f78 ___forwarding___ + 14324   CoreFoundation                      0x0000000103f04958 _CF_forwarding_prep_0 + 1205   VwWoocommerceAppMain                0x0000000101956824 -[RCTAsyncLocalStorage _writeEntry:changedManifest:] + 2586   VwWoocommerceAppMain                0x0000000101957104 -[RCTAsyncLocalStorage multiSet:callback:] + 4367   CoreFoundation                      0x0000000103f0636c __invoking___ + 1408   CoreFoundation                      0x0000000103f06240 -[NSInvocation invoke] + 3209   CoreFoundation                      0x0000000103f1ec26 -[NSInvocation invokeWithTarget:] + 5410  VwWoocommerceAppMain                0x0000000101966929 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 60211  VwWoocommerceAppMain                0x00000001019ac7a8 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 26612  VwWoocommerceAppMain                0x00000001019ac522 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 7813  libdispatch.dylib                   0x0000000108bf32f7 _dispatch_call_block_and_release + 1214  libdispatch.dylib                   0x0000000108bf433d _dispatch_client_callout + 815  libdispatch.dylib                   0x0000000108bfc855 _dispatch_queue_serial_drain + 116216  libdispatch.dylib                   0x0000000108bfd1ea _dispatch_queue_invoke + 33617  libdispatch.dylib                   0x0000000108bf8f7c _dispatch_queue_override_invoke + 73318  libdispatch.dylib                   0x0000000108c00102 _dispatch_root_queue_drain + 77219  libdispatch.dylib                   0x0000000108bffda0 _dispatch_worker_thread3 + 13220  libsystem_pthread.dylib             0x00000001091465a2 _pthread_wqthread + 129921  libsystem_pthread.dylib             0x000000010914607d start_wqthread + 13)2018-03-26 17:18:59.561965+0530 VwWoocommerceAppMain[57934:681649] *** Terminating app due to uncaught exception 'RCTFatalException: Exception '-[__NSDictionaryM length]: unrecognized selector sent to instance 0x60000023abc0' was thrown while invoking multiSet on target AsyncLocalStorage with params (        (                (            cart,                        {            }        )    ),    5873)callstack: (0   CoreFoundation                      0x0000000103f8212b __exceptionPreprocess + 1711   libobjc.A.dylib                     0x0000000102874f41 objc_exception_throw + 482   CoreFoundation                      0x0000000104003024 -[NSObject(NSObject) doesNotRecognizeSelector:] + 1323   CoreFoundation                      0x0000000103f04f78 ___forwarding___ + 14324   CoreFoundation                      0x0000000103f04958 _CF_forwarding_prep_0 + 1205   VwWoocommerceAppMain                0x0000000101956824 -[RCTAsyncLocalStorage _writeEntry:changedManifest:] + 2586   VwWoocommerceAppMain                0x0000000101957104 -[RCTAsyncLocalStorage multiSet:callback:] + 4367   CoreFoundation                      0x0000000103f0636c __invoking___ + 1408   CoreFoundation                      0x0000000103f06240 -[NSInvocation invoke] + 3209   CoreFoundation                      0x0000000103f1ec26 -[NSInvocation invokeWithTarget:] + 5410  VwWoocommerceAppMain                0x0000000101966929 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 60211  VwWoocommerceAppMain                0x00000001019ac7a8 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 26612  VwWoocommerceAppMain                0x00000001019ac522 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 7813  libdispatch.dylib                   0x0000000108bf32f7 _dispatch_call_block_and_release + 1214  libdispatch.dylib                   0x0000000108bf433d _dispatch_client_callout + 815  libdispatch.dylib                   0x0000000108bfc855 _dispatch_queue_serial_drain + 116216  libdispatch.dylib                   0x0000000108bfd1ea _dispatch_queue_invoke + 33617  libdispatch.dylib                   0x0000000108bf8f7c _dispatch_queue_override_invoke + 73318  libdispatch.dylib                   0x0000000108c00102 _dispatch_root_queue_drain + 77219  libdispatch.dylib                   0x0000000108bffda0 _dispatch_worker_thread3 + 13220  libsystem_pthread.dylib             0x00000001091465a2 _pthread_wqthread + 129921  libsystem_pthread.dylib             0x000000010914607d start_wqthread + 13)', reason: 'Exception '-[__NSDictionaryM length]: unrecognized selector sent to instanc...'*** First throw call stack:(0   CoreFoundation                      0x0000000103f8212b __exceptionPreprocess + 1711   libobjc.A.dylib                     0x0000000102874f41 objc_exception_throw + 482   VwWoocommerceAppMain                0x0000000101953a22 RCTFormatError + 03   VwWoocommerceAppMain                0x00000001019ac9bc _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 7984   VwWoocommerceAppMain                0x00000001019ac522 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 785   libdispatch.dylib                   0x0000000108bf32f7 _dispatch_call_block_and_release + 126   libdispatch.dylib                   0x0000000108bf433d _dispatch_client_callout + 87   libdispatch.dylib                   0x0000000108bfc855 _dispatch_queue_serial_drain + 11628   libdispatch.dylib                   0x0000000108bfd1ea _dispatch_queue_invoke + 3369   libdispatch.dylib                   0x0000000108bf8f7c _dispatch_queue_override_invoke + 73310  libdispatch.dylib                   0x0000000108c00102 _dispatch_root_queue_drain + 77211  libdispatch.dylib                   0x0000000108bffda0 _dispatch_worker_thread3 + 13212  libsystem_pthread.dylib             0x00000001091465a2 _pthread_wqthread + 129913  libsystem_pthread.dylib             0x000000010914607d start_wqthread + 13)libc++abi.dylib: terminating with uncaught exception of type NSException(lldb) 

If anyone knows please help.

How to use ATTrackingManager in Expo

$
0
0

According to recent apple update, ALL apps published to AppStore since 26.4.2021, are required to use App Tracking Transparency framework, if they are requiring user name, email, phone or any user generated content.

Our app requires user name, email and phone number to register user into the app in order to use it. We are not using Segment, AdMob or FacebookAds in our app, but since these libraries can be used in expo managed, we are obliged to check the boxes which custom user content we use, when deploying the app to the AppStore. (https://docs.expo.io/distribution/app-stores/#ios-specific-guidelines)

According to Apple Tracking Transparency I have set the infoPlist key (NSUserTrackingUsageDescription)in app.json, but can't figure out how to show the alert dialog, since ATTrackingManager class, which prompts the user permission is not present in expo and haven't found this type of permission in expo-permissions either. Any clue on how to approach this issue? Thanks a bunch.

Display PDF in React Native using Forms Field value not showing on IOS

$
0
0

Im trying to create a viewer on our app using the react-native-pdf and tried react-native-view-pdf but i have problems with the PDF Forms field on IOS the values/data aren't showing. But when the field is focused/tapped it will show the value/data. on Android the Forms field data is showing as expected. Image on IOS shown below:

IOS PDF first load

IOS PDF Field tapped/focused

If anyone encountered this and resolve this issue Please help me with this would appreciate it. Thank you.

Using react-native-pdf:

<View style={{ flex: 1 }}><Pdf        minScale={1.0}        maxScale={1.0}        scale={1.0}        spacing={0}        fitPolicy={2}        enablePaging={true}     // onTouchStart={(e) => {     //     console.log('touchMove', e.nativeEvent);     //     if (this.state.pdfEditMode) {     //         this.setState({ showDraggrable: false, cxValue: e.nativeEvent.locationX, cyValue: e.nativeEvent.locationY, xValue: e.nativeEvent.locationX, yValue: e.nativeEvent.locationY }, () => {     //             setTimeout(() => {     //                 this.setState({ showDraggrable: true, })     //             }, 0)     //         })     //     }     // }}        usePDFKit={false}        source={{ uri: `data:application/pdf;base64,${this.state.pdfBase64}` }}        onLoadComplete={(numberOfPages, filePath, { width, height }) => { this.setPageWH(width, height) }}        onPageChanged={(page, numberOfPages) => {            console.log(`current page: ${page}`);            this.setState({ pageNumber: page });        }}        onError={(error) => {            console.log(error);        }}        onPressLink={(uri) => {            console.log(`Link presse: ${uri}`)        }}       // onPageSingleTap={(page, x, y) => {       //     console.log(x, y)       //     this.handleSingleTap(page, x, y);       // }}         style={styles.pdf}/> </View>

Using react-native-view-pdf

<View style={{ flex: 1}}>     <PDFView        fadeInDuration={250.0}        style={styles.pdf}        resource={this.state.pdfBase64}        resourceType={'base64'}        onLoad={() => console.log(`PDF rendered from base64}`)}        onError={(error) => console.log('Cannot render PDF', error)}/> </View>

Libraries Version:"react": "16.6.3","react-native": "0.58.1","react-native-pdf": "^5.1.7","react-native-view-pdf": "^0.11.0",

After expo eject, iOS app get in stuck at splash screen

$
0
0

I started a react-native app using expo, but due to some native functionality I had to eject my app from expo. Still I have the app.json file having a splash field in which I have defined some parameter. The point is that after ejecting my app, if I run react-native run-android it works fine, the app shows me a splash screen and then goes on without any problem. If I do the same on iOS, meaning that I run my app on my iPhone through xcode, the app starts but gets in stuck on the splash screen and it doesn't go on. The only log I can get on the metro terminal is:

No native splash screen registered for given view controller. Call 'SplashScreen.show' for given view controller first.

But I have no idea what that means, I don't even know whether it is related to my problem or not. Moreover, within the iOS folder, the .storyboard file only shows the splash screen and nothing else. Is that normal?

Please help me, I can't find any useful information online.

Getting a filesystem URI from assets in Expo/RN

$
0
0

On iOS, using MediaLibrary.getAssetsAsync() returns assets with assets-library://.... uri.

But a lot of the Expo/ReactNative APIs require a file:// uri, e.g. face detector module and sharing module

To solve this, I ended up just copying the asset using FileSystem.copyAsset() to the apps cache directory. Is there a better way? Why is this necessary?

const localUri = FileSystem.copyAsset(FileSystem.cacheDirectory +'/'+ asset.filename)

Importing Swift ViewController to React Native

$
0
0

I'm trying to integrate this feature https://github.com/heinrisch/faceid-to-stl into my react native app. The repo is written in swift and I basically want to display the ViewController class into my react native app but I'm not sure how to. Wanted to try this out first and then eventually I want to integrate the StandardCyborg SDK https://standardcyborg.com/ instead to do 3D face scanning for a React Native app.

I've tried multiple posts about bridging native modules and functions and I've been able to do that. But I'm thinking ViewControllers are a bit different since they're not UI Components? Or are they? Very new to bridging native modules and not familiar with swift. Any help is much appreciated.

ViewController.m

#import <Foundation/Foundation.h>#import <React/RCTBridgeModule.h>#import <React/RCTViewManager.h>#import <React/RCTEventEmitter.h>@interface RCT_EXTERN_MODULE(Mask, NSObject)RCT_EXTERN_METHOD(init)RCT_EXTERN_METHOD(init?)RCT_EXTERN_METHOD(update)@end@interface RCT_EXTERN_MODULE(ViewController, NSObject)RCT_EXTERN_METHOD(viewDidLoad)RCT_EXTERN_METHOD(renderer)RCT_EXTERN_METHOD(renderer)RCT_EXTERN_METHOD(startSession)RCT_EXTERN_METHOD(capture)RCT_EXTERN_METHOD(presentShareSheet)RCT_EXTERN_METHOD(createSTL)RCT_EXTERN_METHOD(generateURL)@end

oxygen-Bridging-Header.h

#import <React/RCTBridgeModule.h>

AppDelegate.m

#import "AppDelegate.h"#import <React/RCTBridge.h>#import <React/RCTBundleURLProvider.h>#import <React/RCTRootView.h>@implementation AppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge                                                   moduleName:@"oxygen"                                            initialProperties:nil];  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];  UIViewController *rootViewController = [UIViewController new];  rootViewController.view = rootView;  self.window.rootViewController = rootViewController;  [self.window makeKeyAndVisible];  return YES;}- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge{#if DEBUG  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];#else  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];#endif}@end

AppDelegate.h

#import <React/RCTBridgeDelegate.h>#import <UIKit/UIKit.h>@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>@property (nonatomic, strong) UIWindow *window;@end

ViewController.swift

@objc(ViewController)class ViewController: UIViewController, ARSCNViewDelegate {  @objc @IBOutlet var sceneView: ARSCNView!  @objc private var isPresentingShareSheet = false  @objc private var mask: Mask?  @objc private var lastFaceAnchor: ARFaceAnchor?  @objc  static func requiresMainQueueSetup() -> Bool {    return true  }  @objc  override func viewDidLoad() {    print("ViewController loaded...")    super.viewDidLoad()    sceneView.delegate = self    startSession()    let button = UIButton(type: .custom)    button.setTitle("Capture", for: .normal)    button.tintColor = .black    button.titleLabel?.textColor = .black    button.backgroundColor = .lightGray    button.addTarget(self, action: #selector(capture), for: .touchUpInside)    button.layer.cornerRadius = 12    view.addSubview(button)    button.translatesAutoresizingMaskIntoConstraints = false    let constraints: [NSLayoutConstraint] = [      button.centerXAnchor.constraint(equalTo: view.centerXAnchor),      button.widthAnchor.constraint(equalTo: view.widthAnchor, constant: -40),      button.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor),      button.heightAnchor.constraint(equalToConstant: 55)    ]    view.addConstraints(constraints)  }  @objc  func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) {    //        let device = sceneView.device!    //        let maskGeometry = ARSCNFaceGeometry(device: device)!    //        mask = Mask(geometry: maskGeometry)    let device = MTLCreateSystemDefaultDevice()    let maskGeometry = ARSCNFaceGeometry(device: device!)!    mask = Mask(geometry: maskGeometry)    node.addChildNode(mask!)  }  @objc  func renderer(_ renderer: SCNSceneRenderer, didUpdate node: SCNNode, for anchor: ARAnchor) {    guard let faceAnchor = anchor as? ARFaceAnchor else { return }    mask?.update(withFaceAnchor: faceAnchor)    if let faceAnchor = anchor as? ARFaceAnchor {      lastFaceAnchor = faceAnchor    }  }  @objc  private func startSession() {    sceneView.scene.rootNode.childNodes.forEach {      $0.removeFromParentNode()    }    let configuration = ARFaceTrackingConfiguration()    configuration.isLightEstimationEnabled = true    sceneView.session.run(configuration, options: [.resetTracking, .removeExistingAnchors])  }  @objc  private func capture() {    guard let faceAnchor = lastFaceAnchor else {      return    }    let data = createSTL(from: faceAnchor)    let url = generateURL(for: data)    presentShareSheet(with: url)  }  @objc  private func createSTL(from faceAnchor: ARFaceAnchor) -> Data {    let mapped = faceAnchor.geometry.triangleIndices.map { i in      return faceAnchor.geometry.vertices[Int(i)]    }    var out: [String] = ["solid face"]    mapped.enumerated().forEach { i, vertex in      if i % 3 == 0 {        out.append("facet normal 0 0 0")        out.append("\touter loop")      }      out.append("\t\tvertex \(vertex.x) \(vertex.y) \(vertex.z)")      if i % 3 == 2 {        out.append("\tendloop")      }    }    out.append("endsolid face")    let file = out.joined(separator: "\n")    let data = file.data(using: .ascii)!    return data  }  @objc  private func generateURL(for data: Data) -> URL {    let url = URL(fileURLWithPath: NSTemporaryDirectory() +"face.stl")    try! data.write(to: url)    return url  }  @objc  private func presentShareSheet(with url: URL) {    self.isPresentingShareSheet = true    DispatchQueue.main.async {      let activityViewController = UIActivityViewController(activityItems: [url], applicationActivities: nil)      activityViewController.completionWithItemsHandler = { _, _, _, _ in        self.isPresentingShareSheet = false      }      self.present(activityViewController, animated: true, completion: nil)    }  }}

Do both the developer and account holder need paid Apple Developer accounts?

$
0
0

Questions:

  • What is the correct procedure here?
  • Do I also need a paid account?
  • How will I ever be able to deploy the app if my customer does not have a business account?

Context:

  • I'm trying to build my first iOS app with Expo.
  • I tried to run expo build:ios and got You have no team associated with your Apple account, cannot proceed.
  • I have an unpaid Apple ID
  • My customer created a paid developer account of type 'individual'.
  • He added me to his team and gave me the 'Admin' role.
  • The checkbox to give me access to certificates was grayed out. Apparently (according to Stack Overflow) because his account is of type 'individual'
  • I know I am part of a team because I can log in to App Store Connect and manage everything in my customer's account (except certificates).

Expo output:

reto@Retos-Mac-mini test1 % expo build:ios✔ Choose the build type you would like: › archiveChecking if there is a build in progress...Accessing credentials for ****** in project test1✔ Do you have access to the Apple account that will be used for submitting this app to the App Store? … yes› Log in to your Apple Developer account to continue✔ Apple ID: … ******› Restoring session ******› Session expired Local session› Using password for ****** from your local Keychain  Learn more: https://docs.expo.io/distribution/security#keychain✔ Logged in New sessionAuthentication with Apple Developer Portal failed!You have no team associated with your Apple account, cannot proceed.(Do you have a paid Apple Developer account?)Error: You have no team associated with your Apple account, cannot proceed.(Do you have a paid Apple Developer account?)...

Outcome

Based on all the answers, I will:

  • not create another paid account
  • customer will change his Apple ID password and give me complete access to his Apple Developer account
  • use customer's Apple Developer account to run expo-cli build:ios and let expo handle all the certificate and profile generation (which I have never done before).
  • maybe export all the necessary certificates and keys so I can give back control of the Apple ID and still deploy in the future (hopefully)

Deploying a React Native App for iOS without App Store

$
0
0

I am creating an app for iPad on React Native. I am working on a macbook.

I want to test the app on a physical iPad with a deployed production build of the app.

I don't seem to understand how am I supossed to do that. I'm finding a lot of info on how to deploy to the App Store, but that's not what I need.

I used to use expo for Android and build an APK and just install it on a physical device, now I want to do something similar.

This time I'm not using Expo, just react-native-cli and XCode. I tried the app on a simulator and it works, but now I want to send it to a different person so he can test it on a physical device and not on debug mode, but on an actual production build of the app.

How can I achieve that?

What API/SDK to print automatically to thermal printer (e.g. Brother QL) with my React Native iPhone app without interaction?

$
0
0

I've been looking into different API/SDKs that would be best and easiest to integrate with my React Native iPhone app. This is an internal employee app, that once a form is submitted I would like to automatically print out a label from a thermal printer (e.g. Brother QL1110NWB).

Some options I found are:

React Native:

Brother SDK:

Apple AirPrint:

Does anyone have experience with any of these API/SDKs and can recommend best method for easy integration and be able to print directly without interaction?

Thank you!

error: Multiple commands produce (after eject react-native)

$
0
0

I wanted to change the application name so I changed it and deleted the iOS & android folders then I run react-native eject then I tried to build the project but I am facing 16 error from vector-icon

enter image description here

and I have the UIAppFonts in the iOS/projectName/Info.plist

<key>UIAppFonts</key><array><string>AntDesign.ttf</string><string>Entypo.ttf</string><string>EvilIcons.ttf</string><string>Feather.ttf</string><string>FontAwesome.ttf</string><string>FontAwesome5_Brands.ttf</string><string>FontAwesome5_Regular.ttf</string><string>FontAwesome5_Solid.ttf</string><string>Fontisto.ttf</string><string>Foundation.ttf</string><string>Ionicons.ttf</string><string>MaterialCommunityIcons.ttf</string><string>MaterialIcons.ttf</string><string>Octicons.ttf</string><string>SimpleLineIcons.ttf</string><string>Zocial.ttf</string></array>
Viewing all 16907 articles
Browse latest View live


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