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

How do I open react-native's dev menu on real device

$
0
0

I have seen already a number of border cases and strange developer interface.

From the "shake your device", which is really impractical, specially with a tablet

To working around Android studio to simulate a button press.

Is there a consistent way to do it? Can't we use a intern API to have a debug button within our app to launch such menu as navigator.popUpDevMenu()?

And if not, how do you shake your tablet to get it working. This is intended to solve How To configure HMR on a real device, too. React native does improve the development experience, but I'd say that particular thing slows it a little bit.


Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_RCTImageLoader"

$
0
0

After a lot of tests, my app won't run on iOS.

I have this error :

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_RCTImageLoader", referenced from:
     objc-class-ref in libRCTImageResizer.a(RCTImageResizer.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I use :

react: 16.12.0
react-native: 0.60.6

CloudKit "Invalid value of null for entitlement "application-identifier" or "com.apple.developer.associated-application-identifier" on process app"

$
0
0

After moving to xcode 11(from 10) i got this error when try to call CloudKit fetchUserRecordID. I have all the same app settings that i have previously when i use xcode 10(i mean the same .entitlements file, have icloud with container enabled in capabilities and for identifier in dev account). Also this file is set in Build Settings Code Signing Entitlements. Everything was fine with Xcode 10, method worked and return right value.


Found out, that it works on real device, error is only on simulator with iOS 13.3. And also it worked on this simulator before i upgraded react-native from 0.59.10 to 0.61.5 - but it's weird, because this code look like not related to react-native, i use react-native-user-identity package(the same versions as it was with old react-native), but i also try to use cloudkit in self-written obj-c bridge module and got the same error.

[CK] Invalid value of "(null)" for entitlement "application-identifier" or "com.apple.developer.associated-application-identifier" on process "Wordgame". We expect TEAMID.BUNDLEID, and insist that TEAMID is exactly 10 characters long, consisting of [0-9][A-Z]. This is a permanent issue, and access to CloudKit will be denied until this is resolved

.entitlements file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN""http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>aps-environment</key>
    <string>development</string>
    <key>com.apple.developer.applesignin</key>
    <array>
        <string>Default</string>
    </array>
    <key>com.apple.developer.associated-domains</key>
    <array>
        <string>applinks:wordsjam.page.link</string>
    </array>
    <key>com.apple.developer.icloud-container-identifiers</key>
    <array>
        <string>iCloud.com.wordsjam</string>
    </array>
    <key>com.apple.developer.icloud-services</key>
    <array>
        <string>CloudKit</string>
    </array>
    <key>keychain-access-groups</key>
    <array>
        <string>$(AppIdentifierPrefix)com.wordsjam</string>
    </array>
</dict>
</plist>

How can I declare interface in AppDelegate.h in Xcode?

$
0
0

I'm using React Native to make an iOS Application.

I need to add some code to AppDelegate.h file.

However, after searching about this, I realized that it's impossible to declare two interfaces at the same time.

How can I integrate these two interfaces?

// here's the code in AppDelegate.h

@interface AppDelegate : UMAppDelegateWrapper <RCTBridgeDelegate>

    @property (nonatomic, strong) UMModuleRegistryAdapter *moduleRegistryAdapter;
    @property (nonatomic, strong) UIWindow *window;


@end


@interface AppDelegate : UIResponder <UIApplicationDelegate, AppsFlyerTrackerDelegate>
@end

How to disable react native dev mode in debug build configuration for iOS?

$
0
0

I'm trying to debug the application bootup and I want to skip the websocket server that downloads the js from the react native bundler.

Everything I've read on the internet just says to use release build configuration, but I need the debug configuration in order to debug my app.

I found this little bit in the documentation that prevents the bundle from re-building but it still connects to the websocket server to download the bundle instead of building it in.

https://facebook.github.io/react-native/docs/running-on-device.html#pro-tips

I also tried setting #define RCT_DEV 0 in RTCDefines.h but that caused other build errors importing RCTReconnectingWebsocket...

Any ideas how to do this?

How to output log to terminal from iOS simulator?

$
0
0

Logging to Chrome is extremely slow for me to the point of being unusable so I'm trying to get it to log to the terminal instead. They provide a command react-native log-ios for this but it gives me this error:

error Cannot read property 'udid' of null. Run CLI with --verbose flag for more details.

which, like 99% of React Native errors, makes no sense to me.

Any idea how I can get this command to work? Or is there any system command, similar to adb logcat for Android, that I can use directly to print iOS Simulator log to the terminal?

Expandable issue in React-native-final-treeview library. How can we resolve this?

$
0
0

I'm using the react-native-final-treeview library. I have set the constant JSON data. The expandable attribute does not work properly on this. On clicking on a node, all the parent nodes are expanded instead of the selected node. How can I reslove this?

Video stream receive in react native

$
0
0

I have a video stream from my home camera on rtsp protocol. Is it possible to play it on ios and android? I am trying to create

Versions:

  • npm: 6.13.4
  • node: v12.14.0
  • react: ^16.12.0
  • react-native: 0.61.5

I have tried packages:

  • react-native-vlc-player
  • react-native-vlcplayer
  • react-native-video -> on is the app crashes because of SIGABRT
  • react-native-live-stream -> this is always throwing build fail exceptions.

None of them working for me ...

I ran it in VLC Player on the computer, but not in the app.

Thank you for any suggestions.


Expo - Implementing Notifications Set App Icon Badge Number

$
0
0

Despite numerous attempts to implement the app icon badge number in our Expo app, the app icon badge number could not be set. The documentation on setting notifications app icon badge number is also very limited. We are trying to set app icon badge number to 1 when there is new push notification and then reset the app icon badge number to 0 after the user clicked on the notification.

Can anyone point out what’s wrong here?

The following is the callback function for the Notifications listener.

handleNotification = async (notification) => {
    const { origin, data, notificationId } = notification
    const notif = { id: notificationId, ...data }

    // set notifications badge count
    try {
      const setAppBadgeCount = await Notifications.setBadgeNumberAsync(1)
      console.log(`showing app badge number to 1 ${setAppBadgeCount}`)
    } catch (err) {
      console.log('did not manage to show notif app badge count!', err)
    }
    if (origin === 'selected') {
      this.navigateToNotificationScreen(data)
      try {
        const resetAppBadgeCount = await Notifications.setBadgeNumberAsync(0)
        console.log(`reset app badge count ${resetAppBadgeCount}`)
      } catch (err) {
        console.log('did not manage to reset notif app badge count!', err)
      }
    } else { // origin === 'received', show in-app
      const { dispatch } = this.props
      dispatch(setActiveNotifications([notif]))

      setTimeout(() => {
        dispatch(setInactiveNotifications([notif]))
      }, 10000)
    }
  }

Thanks in advance!

when uploading app from xcode to testflight got an error [closed]

$
0
0

ERROR ITMS-90022: "Missing required icon file. The bundle does not contain an app icon for iPhone / iPod Touch of exactly '120x120' pixels, in .png format for iOS versions >= 7.0."

Rotate image and save in React-Native

$
0
0

I am going to rotate the image in react–native and I would like to get base64 of rotated image. I used several libraries

  1. react-native-image-rotate: It's working well on Android but on iOS I get rct-image-store://1 as url so I tried getting base64 using rn-fetch-blob but it throws error that can't recognize that url.

  2. react-native-image-resizer: I used this but the response is not good in iOS. If I set -90 then rotate -180, if I set -180 then it's rotating as -270.

Please help me on this problem, how can I rotate the image in iOS.

I need to rotate the image as -90, -180, -270, -360(original).

React Native ios picker is always open

$
0
0

I have two pickers on my screen. Whenever I navigate to the screen in iOS app I find that the pickers are always open and all options are visible.

enter image description here

It works perfectly fine in Android where the options are visible only after we click on the picker.

Can somebody suggest a solution to fix this in iOS?

How to enable Live Reload in iOS Device running React Native app?

$
0
0

I'm trying to enable Live Reload mode, but there is no such item in Dev Menu: no item called 'Live Reload'

Can't get background tasks to work in React-Native

$
0
0

I need to frequently write into a text file, let's say write a timestamp into a file with react-native in iOS and android. I wrote an app by the help of the following libraries. On android, the app is working perfectly fine, but on iOS not working properly.

I tried to use these libraries:

  1. react-native-background-task
  2. react-native-background-fetch
  3. react-native-background-queue + react-native-background-task

But none of them works fine:

  1. with react-native-background-task: the file is written randomly 5-6 times a day or less
  2. with react-native-background-fetch: the file is written randomly 3-4 times a day or less
  3. react-native-background-queue + react-native-background-task: the file is not written AT ALL!

Would you please tell me if these behaviors are normal, and if not, what am I doing wrong???

Any help would be greatly appreciated.

Here are my codes:

In order to use react-native-background-task:

import React from 'react'
import Mytest from './test';
import BackgroundTask from 'react-native-background-task'
import {
    Text,
    View,
  } from 'react-native';

BackgroundTask.define(() => {
  console.log('Hello from a background task')
  Mytest.writeFiles()
  BackgroundTask.finish()
})

export default class MyApp extends React.Component {

  componentDidMount() {
    BackgroundTask.schedule()
  }

  render() {
    return(
     <View>
      <Text>Hello world</Text>
    </View>)
  }

}

In order to use react-native-background-fetch:

import React, { Component } from 'react';
import {
    Text,
    View,
    StyleSheet
  } from 'react-native';
import BackgroundFetch from "react-native-background-fetch";

var RNFS = require('react-native-fs');
var path = RNFS.DocumentDirectoryPath + '/fetch.txt';
var count = 0

export default class App extends Component {

  constructor(props) {
    super(props);
    this.state = {
      date: '',
    }
  }

  componentDidMount() {
    BackgroundFetch.configure({
      stopOnTerminate: false,
      startOnBoot: true,
      requiredNetworkType: BackgroundFetch.NETWORK_TYPE_NONE,
      requiresCharging: false,      // Default
      requiresDeviceIdle: false,    // Default
      requiresBatteryNotLow: false, // Default
      requiresStorageNotLow: false  // Default
    }, () => {
      console.log("[js] Received background-fetch event");
      this.writeFiles()
      BackgroundFetch.finish(BackgroundFetch.FETCH_RESULT_NEW_DATA);
    }, (error) => {
      console.log("[js] RNBackgroundFetch failed to start");
    });

    BackgroundFetch.status((status) => {
      switch(status) {
        case BackgroundFetch.STATUS_RESTRICTED:
          console.log("BackgroundFetch restricted");
          break;
        case BackgroundFetch.STATUS_DENIED:
          console.log("BackgroundFetch denied");
          break;
        case BackgroundFetch.STATUS_AVAILABLE:
          console.log("BackgroundFetch is enabled");
          break;
      }
    });
  }

  render() {
        return (
          <View style={styles.container}>
            <Text style={styles.welcome}>
              Welcome to React Native!
            </Text>
          </View>
        );
      }


  getDate() {
    var that = this;
    var date = new Date().getDate(); //Current Date
    var month = new Date().getMonth() + 1; //Current Month
    var year = new Date().getFullYear(); //Current Year
    var hours = new Date().getHours(); //Current Hours
    var min = new Date().getMinutes(); //Current Minutes
    var sec = new Date().getSeconds(); //Current Seconds
    that.setState({
      date:
        date + '/' + month + '/' + year + '' + hours + ':' + min + ':' + sec,
    });
  }


writeFiles = async () => {
  this.getDate()
    try {
      for(let i = 0; i < 1; i++){
        count = count + 1;
        console.log(count);
        RNFS.appendFile(path, '  \n  '+ count + '  \n  ' + this.state.date , 'utf8')
        .then((success) => {
        })
      }
    }catch (err) {
      console.warn("error", err);
    } 
}          

};

In order to use react-native-background-queue + react-native-background-task:

import React, { Component } from 'react';
import Mytest from './test';
import BackgroundTask from 'react-native-background-task'
import {Platform,...} from 'react-native';
import queueFactory from 'react-native-queue';

BackgroundTask.define(async () => {
  queue = await queueFactory();
  queue.addWorker('background-example', async (id, payload) => {
  if (payload.name == 'sima') {
     Mytest.writeFiles()
     console.log('Hello from a background task ')}
  });
  await queue.start(20000); 
  BackgroundTask.finish();
});

export default class App extends Component<{}> {

  constructor(props) {
    super(props);

    this.state = {
      queue: null,
      data: null,
    };

    this.init();

  }

  async init() {
    const queue = await queueFactory();
    queue.addWorker('background-example', async (id, payload) => {
    });

    this.setState({
      queue
    });

  }

  componentDidMount() {
    BackgroundTask.schedule(); 
  }

  makeJob(jobName, payload = {}) {
    console.log('job is created but will not execute until the above OS background task runs in ~15 min');
    this.state.queue.createJob(jobName, payload, {
     timeout: 5000
    }, false); 
  }


  render() {
    let output = 'No data loaded from OS background task yet.';
    if (this.state.data) {
      output = JSON.stringify(this.state.data);
    }

    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          Welcome to React Native!
        </Text>
        <Text>Click buttons below to add OS background task jobs.</Text>
        <Text>Then Close App (task will not fire if app is in focus).</Text>
        <Text>Job will exec in ~15 min in OS background.</Text>
        {this.state.queue && <Button title={"Press To Queue sima Job"} onPress={ () => { this.makeJob('background-example', { name: 'sima' }) } } /> }
        {this.state.queue && <Button title={"Press To Queue another Job"} onPress={ () => { this.makeJob('background-example', { name: 'simsim' }) } } /> }
        <Text>{output}</Text>
      </View>
    );

  }


}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
});

And here is test.js:

var RNFS = require('react-native-fs');
var path = RNFS.DocumentDirectoryPath + '/test.txt';
var count = 0;

const Mytest = {

  writeFiles: () => {
    var that = this;
    var date = new Date().getDate(); //Current Date
    var month = new Date().getMonth() + 1; //Current Month
    var year = new Date().getFullYear(); //Current Year
    var hours = new Date().getHours(); //Current Hours
    var min = new Date().getMinutes(); //Current Minutes
    var sec = new Date().getSeconds(); //Current Seconds
    var date = date + '/' + month + '/' + year + '' + hours + ':' + min + ':' + sec

      try {
        for(let i = 0; i < 1; i++){
          count = count + 1;
          console.log(count);
          RNFS.appendFile(path, '  \n  '+ count + '  \n  ' + date , 'utf8')
          .then((success) => {
            console.log('FILE WRITTEN!');
          })
        }
      }catch (err) {
        console.warn("error", err);
      } 
  }
  }
  export default Mytest;

Avoid status bar overlap on all screens


How solve 'Undefined symbols for architecture armv7' in React Native iOS?

$
0
0

I get a problem to build release react native ios, I try to look for many examples, but fail all.

This is the error message :

Undefined symbols for architecture armv7:
  "_RCTDefaultLogFunction", referenced from:
      -[momsindonesiaTests testRendersWelcomeScreen] in momsindonesiaTests.o
  "_RCTSharedApplication", referenced from:
      -[momsindonesiaTests testRendersWelcomeScreen] in momsindonesiaTests.o
  "_RCTSetLogFunction", referenced from:
      -[momsindonesiaTests testRendersWelcomeScreen] in momsindonesiaTests.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I don't know how to solve this error again, please help me to solve this problem.

Thanks.

React native FCM iOS push notification not delivered

$
0
0

first of all environment is React native, I try to setup push notification in iOS following instruction from rnfirebase package here what step i do and I do testing on Real iPhone Device

  1. create key

enter image description here

  1. then add to firebase

enter image description here

  1. add Google-service.plist and add setup following from firebase doc

enter image description here

and acivate capabillity enter image description here

  1. then I install pod package

enter image description here

  1. run app got token

enter image description here

  1. use token send on cloud messaging console

notification not delivered I didn't know what wrong because message also send from FCM and what happens on APNS where I get an error just confused

thank for advance

and also try by connecting directly with pusher enter image description here

and also not received again

then try to use Onesignal with same certificate with Firebase is work even on the test message

react-native-image-crop-picker call to openCropper causes crash on ios only

$
0
0

I'm trying to implement react-native-image-crop-picker into a react-native app. Everything works fine on Android, it's just ios that causes the problem. I narrowed it down to the openCropper method. I was able to fix part of the problem, but I'm stuck on the last little bit.

The code inside of react-native that I'm using is:

ImagePicker.openPicker({
  mediaType: 'photo',
  writeTempFile: true,
  includeExif: true,
})
  .then(image => {
    this.setState({ modalOpen: false });
    console.log('returned from openPicker');
    // Remove the Promise All for the ImagePicker
    ImagePicker.openCropper({
      path: (image as PickerImage).path,
      width: 400,
      height: 400,
      writeTempFile: false,
      includeExif: true
    })
      .then(croppedImage => {
        console.log('returned from openCropper');

      })
      .catch(e => { console.log('Error in openCropper: ' + e) });
  })
  .catch(e => { console.log('Error in openPicker: ' + e) });

The first issue I had was an exception in the ImageCropPicker.m file. The exception I got was:

2020-01-16 20:02:30.801198-0600 PolyAmDate[58570:2930766] [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=7 "(null)""
2020-01-16 20:02:38.134199-0600 PolyAmDate[58570:2930766] id: 744BEFC9-7B2C-4103-A7EE-9B4FD80FE700/L0/001 filename: IMG_0005.HEIC
2020-01-16 20:02:39.144 [info][tid:com.apple.root.default-qos][RCTImageLoader.mm:738] [PERF ASSETS] Loading image at size {3024, 4032}, which is larger than the screen size {750, 1334}
2020-01-16 20:02:39.147 [info][tid:com.apple.root.default-qos][RCTImageLoader.mm:738] [PERF ASSETS] Loading image at size {3024, 4032}, which is larger than the screen size {750, 1334}
=================================================================
Main Thread Checker: UI API called on a background thread: -[UIViewController init]
PID: 58570, TID: 2931117, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 0
Backtrace:
4   PolyAmDate                          0x0000000100ddcf54 -[RSKImageCropViewController init] + 80
5   PolyAmDate                          0x0000000100ddd224 -[RSKImageCropViewController initWithImage:] + 80
6   PolyAmDate                          0x0000000100dacc58 -[ImageCropPicker startCropping:] + 80
7   PolyAmDate                          0x0000000100dacbcc __49-[ImageCropPicker openCropper:resolver:rejecter:]_block_invoke + 280
8   PolyAmDate                          0x0000000100f45960 __119-[RCTImageLoader loadImageWithURLRequest:size:scale:clipped:resizeMode:progressBlock:partialLoadBlock:completionBlock:]_block_invoke_3 + 556
9   PolyAmDate                          0x0000000100f4668c __80-[RCTImageLoader decodeImageData:size:scale:clipped:resizeMode:completionBlock:]_block_invoke_2 + 700
10  PolyAmDate                          0x0000000100f471d8 __80-[RCTImageLoader decodeImageData:size:scale:clipped:resizeMode:completionBlock:]_block_invoke_3.264 + 604
11  libdispatch.dylib                   0x00000001026097fc _dispatch_call_block_and_release + 24
12  libdispatch.dylib                   0x000000010260abd8 _dispatch_client_callout + 16
13  libdispatch.dylib                   0x000000010260d2d4 _dispatch_queue_override_invoke + 872
14  libdispatch.dylib                   0x000000010261c160 _dispatch_root_queue_drain + 376
15  libdispatch.dylib                   0x000000010261ca88 _dispatch_worker_thread2 + 156
16  libsystem_pthread.dylib             0x00000001889f6b48 _pthread_wqthread + 212
17  libsystem_pthread.dylib             0x00000001889f9760 start_wqthread + 8
2020-01-16 20:02:39.168687-0600 PolyAmDate[58570:2931117] [reports] Main Thread Checker: UI API called on a background thread: -[UIViewController init]
PID: 58570, TID: 2931117, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 0
Backtrace:
4   PolyAmDate                          0x0000000100ddcf54 -[RSKImageCropViewController init] + 80
5   PolyAmDate                          0x0000000100ddd224 -[RSKImageCropViewController initWithImage:] + 80
6   PolyAmDate                          0x0000000100dacc58 -[ImageCropPicker startCropping:] + 80
7   PolyAmDate                          0x0000000100dacbcc __49-[ImageCropPicker openCropper:resolver:rejecter:]_block_invoke + 280
8   PolyAmDate                          0x0000000100f45960 __119-[RCTImageLoader loadImageWithURLRequest:size:scale:clipped:resizeMode:progressBlock:partialLoadBlock:completionBlock:]_block_invoke_3 + 556
9   PolyAmDate                          0x0000000100f4668c __80-[RCTImageLoader decodeImageData:size:scale:clipped:resizeMode:completionBlock:]_block_invoke_2 + 700
10  PolyAmDate                          0x0000000100f471d8 __80-[RCTImageLoader decodeImageData:size:scale:clipped:resizeMode:completionBlock:]_block_invoke_3.264 + 604
11  libdispatch.dylib                   0x00000001026097fc _dispatch_call_block_and_release + 24
12  libdispatch.dylib                   0x000000010260abd8 _dispatch_client_callout + 16
13  libdispatch.dylib                   0x000000010260d2d4 _dispatch_queue_override_invoke + 872
14  libdispatch.dylib                   0x000000010261c160 _dispatch_root_queue_drain + 376
15  libdispatch.dylib                   0x000000010261ca88 _dispatch_worker_thread2 + 156
16  libsystem_pthread.dylib             0x00000001889f6b48 _pthread_wqthread + 212
17  libsystem_pthread.dylib             0x00000001889f9760 start_wqthread + 8
=================================================================
Main Thread Checker: UI API called on a background thread: -[UIView init]
PID: 58570, TID: 2931117, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 0
Backtrace:
4   PolyAmDate                          0x0000000100ddeff0 -[RSKImageCropViewController imageScrollView] + 96
5   PolyAmDate                          0x0000000100de1408 -[RSKImageCropViewController setCropMode:] + 112
6   PolyAmDate                          0x0000000100dacd24 -[ImageCropPicker startCropping:] + 284
7   PolyAmDate                          0x0000000100dacbcc __49-[ImageCropPicker openCropper:resolver:rejecter:]_block_invoke + 280
8   PolyAmDate                          0x0000000100f45960 __119-[RCTImageLoader loadImageWithURLRequest:size:scale:clipped:resizeMode:progressBlock:partialLoadBlock:completionBlock:]_block_invoke_3 + 556
9   PolyAmDate                          0x0000000100f4668c __80-[RCTImageLoader decodeImageData:size:scale:clipped:resizeMode:completionBlock:]_block_invoke_2 + 700
10  PolyAmDate                          0x0000000100f471d8 __80-[RCTImageLoader decodeImageData:size:scale:clipped:resizeMode:completionBlock:]_block_invoke_3.264 + 604
11  libdispatch.dylib                   0x00000001026097fc _dispatch_call_block_and_release + 24
12  libdispatch.dylib                   0x000000010260abd8 _dispatch_client_callout + 16
13  libdispatch.dylib                   0x000000010260d2d4 _dispatch_queue_override_invoke + 872
14  libdispatch.dylib                   0x000000010261c160 _dispatch_root_queue_drain + 376
15  libdispatch.dylib                   0x000000010261ca88 _dispatch_worker_thread2 + 156
16  libsystem_pthread.dylib             0x00000001889f6b48 _pthread_wqthread + 212
17  libsystem_pthread.dylib             0x00000001889f9760 start_wqthread + 8
2020-01-16 20:02:46.960940-0600 PolyAmDate[58570:2931117] [reports] Main Thread Checker: UI API called on a background thread: -[UIView init]
PID: 58570, TID: 2931117, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 0
Backtrace:
4   PolyAmDate                          0x0000000100ddeff0 -[RSKImageCropViewController imageScrollView] + 96
5   PolyAmDate                          0x0000000100de1408 -[RSKImageCropViewController setCropMode:] + 112
6   PolyAmDate                          0x0000000100dacd24 -[ImageCropPicker startCropping:] + 284
7   PolyAmDate                          0x0000000100dacbcc __49-[ImageCropPicker openCropper:resolver:rejecter:]_block_invoke + 280
8   PolyAmDate                          0x0000000100f45960 __119-[RCTImageLoader loadImageWithURLRequest:size:scale:clipped:resizeMode:progressBlock:partialLoadBlock:completionBlock:]_block_invoke_3 + 556
9   PolyAmDate                          0x0000000100f4668c __80-[RCTImageLoader decodeImageData:size:scale:clipped:resizeMode:completionBlock:]_block_invoke_2 + 700
10  PolyAmDate                          0x0000000100f471d8 __80-[RCTImageLoader decodeImageData:size:scale:clipped:resizeMode:completionBlock:]_block_invoke_3.264 + 604
11  libdispatch.dylib                   0x00000001026097fc _dispatch_call_block_and_release + 24
12  libdispatch.dylib                   0x000000010260abd8 _dispatch_client_callout + 16
13  libdispatch.dylib                   0x000000010260d2d4 _dispatch_queue_override_invoke + 872
14  libdispatch.dylib                   0x000000010261c160 _dispatch_root_queue_drain + 376
15  libdispatch.dylib                   0x000000010261ca88 _dispatch_worker_thread2 + 156
16  libsystem_pthread.dylib             0x00000001889f6b48 _pthread_wqthread + 212
17  libsystem_pthread.dylib             0x00000001889f9760 start_wqthread + 8
=================================================================
Main Thread Checker: UI API called on a background thread: -[UIScrollView initWithFrame:]
PID: 58570, TID: 2931117, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 0
Backtrace:
4   PolyAmDate                          0x0000000100de68c4 -[RSKImageScrollView initWithFrame:] + 108
5   PolyAmDate                          0x0000000100ddeff0 -[RSKImageCropViewController imageScrollView] + 96
6   PolyAmDate                          0x0000000100de1408 -[RSKImageCropViewController setCropMode:] + 112
7   PolyAmDate                          0x0000000100dacd24 -[ImageCropPicker startCropping:] + 284
8   PolyAmDate                          0x0000000100dacbcc __49-[ImageCropPicker openCropper:resolver:rejecter:]_block_invoke + 280
9   PolyAmDate                          0x0000000100f45960 __119-[RCTImageLoader loadImageWithURLRequest:size:scale:clipped:resizeMode:progressBlock:partialLoadBlock:completionBlock:]_block_invoke_3 + 556
10  PolyAmDate                          0x0000000100f4668c __80-[RCTImageLoader decodeImageData:size:scale:clipped:resizeMode:completionBlock:]_block_invoke_2 + 700
11  PolyAmDate                          0x0000000100f471d8 __80-[RCTImageLoader decodeImageData:size:scale:clipped:resizeMode:completionBlock:]_block_invoke_3.264 + 604
12  libdispatch.dylib                   0x00000001026097fc _dispatch_call_block_and_release + 24
13  libdispatch.dylib                   0x000000010260abd8 _dispatch_client_callout + 16
14  libdispatch.dylib                   0x000000010260d2d4 _dispatch_queue_override_invoke + 872
15  libdispatch.dylib                   0x000000010261c160 _dispatch_root_queue_drain + 376
16  libdispatch.dylib                   0x000000010261ca88 _dispatch_worker_thread2 + 156
17  libsystem_pthread.dylib             0x00000001889f6b48 _pthread_wqthread + 212
18  libsystem_pthread.dylib             0x00000001889f9760 start_wqthread + 8
2020-01-16 20:02:47.056606-0600 PolyAmDate[58570:2931117] [reports] Main Thread Checker: UI API called on a background thread: -[UIScrollView initWithFrame:]
PID: 58570, TID: 2931117, Thread name: (none), Queue name: com.apple.root.default-qos, QoS: 0
Backtrace:
4   PolyAmDate                          0x0000000100de68c4 -[RSKImageScrollView initWithFrame:] + 108
5   PolyAmDate                          0x0000000100ddeff0 -[RSKImageCropViewController imageScrollView] + 96
6   PolyAmDate                          0x0000000100de1408 -[RSKImageCropViewController setCropMode:] + 112
7   PolyAmDate                          0x0000000100dacd24 -[ImageCropPicker startCropping:] + 284
8   PolyAmDate                          0x0000000100dacbcc __49-[ImageCropPicker openCropper:resolver:rejecter:]_block_invoke + 280
9   PolyAmDate                          0x0000000100f45960 __119-[RCTImageLoader loadImageWithURLRequest:size:scale:clipped:resizeMode:progressBlock:partialLoadBlock:completionBlock:]_block_invoke_3 + 556
10  PolyAmDate                          0x0000000100f4668c __80-[RCTImageLoader decodeImageData:size:scale:clipped:resizeMode:completionBlock:]_block_invoke_2 + 700
11  PolyAmDate                          0x0000000100f471d8 __80-[RCTImageLoader decodeImageData:size:scale:clipped:resizeMode:completionBlock:]_block_invoke_3.264 + 604
12  libdispatch.dylib                   0x00000001026097fc _dispatch_call_block_and_release + 24
13  libdispatch.dylib                   0x000000010260abd8 _dispatch_client_callout + 16
14  libdispatch.dylib                   0x000000010260d2d4 _dispatch_queue_override_invoke + 872
15  libdispatch.dylib                   0x000000010261c160 _dispatch_root_queue_drain + 376
16  libdispatch.dylib                   0x000000010261ca88 _dispatch_worker_thread2 + 156
17  libsystem_pthread.dylib             0x00000001889f6b48 _pthread_wqthread + 212
18  libsystem_pthread.dylib             0x00000001889f9760 start_wqthread + 8

Debugging pointed me to the startCropping. The call to initWithImage was causing the error. I enclosed the entire block in a dispatch_async call and that stopped the exception.

However, now what happens is after choosing a file (or taking a picture), I can see it pop up on the screen for just a moment, then it disappears. I'm guessing that it has to do with putting the cropping overlay onto the view, but I can't find that anywhere to test...and it's not throwing an exception.

How do you check/change iOS version in React Native?

$
0
0

I heard that a new version of iOS came out the other day, and wanted to know if my React Native project would be using that version by default when I build it with XCode, and if not, how can I force it to?

My Questions Are:

1) How do you check what version of iOS a React Native app is using?

2) How do you update the version of iOS in a React Native app?

UPDATE:

Based on @Simon's answer, I have one more question:

3) What determines the default version that a given project has?

Losing Device Registration/Instance Id on App Update - Firebase Cloud Messaging iOS/React Native Firebase

$
0
0

Been doing a lot of research on this issue, first my setup:

My issue quite simple and straight forward though I do not seem to be able to find a clear way to resolve the issue.

I deployed version 4.2 of my app. Firebase Cloud Messaging (FCM) in iOS works just dandy. I then deployed 4.3 to TestFlight to begin testing. Installed 4.3 via TestFlight and FCM stopped working, no push notifications. If I delete the app and install 4.3 via TestFlight push notifications work again, the device is registered.

I can also reproduce this issue updating the installed version of my app from the App Store published latest, no surprise there.

I know that the InstanceId/device token is based on the app build+device so it makes sense that the token changes when the app Updates but my token is the same when I update from 4.2 to 4.3:

const fcmToken = await firebase.messaging().getToken(); //same whether 4.2 or 4.3

And yes firebase.messaging().getToken() is cached on initial creation.

So I am wired up to listen to token change events:

firebase.messaging().onTokenRefresh(async () => {
  console.log('======onTokenRefresh=========');
  AsyncStorage.removeItem(FCM_TOKEN_KEY);
  await getToken();
});

That never seems to fire. I have even added a button to my app to try and force a new InstanceId and register with FCM after updating the version from TestFlight or the AppStore, this does not help:

export async function forceRefresh() {
  console.log('================force a new registration!!!==========');
  AsyncStorage.removeItem(FCM_TOKEN_KEY);
  firebase.messaging().deleteToken();
  firebase.iid().deleteToken();
  registerForPushNotificationsAsync(true);
} 

Nah, doesn't work.

So the moral of the story is, when I update the version of my app, my customers, whom's push notifications were working dandy, will no longer be registered for push notifications when they update their app to the next version.

References that might be leads I have been studying:

Interesting on app update start, where push notifications will stop working because of the app update I see two different tokens, perhaps this first one is the APN token from Apple:

2020-01-17 18:48:09.371741-0800 whistlenative[4462:1287461] -[RNFirebaseMessaging messaging:didReceiveRegistrationToken:] [Line 86] Received new FCM token: eBBgznWj1FU:APA91bF8vTmpkwcojp4oDSKFzlPDp6ylEIe_WGNzu24SKHS6RR-3xPu2-cX-Qyc8rrMIQMvkCJftT9711ll1WdshBWS4iEpZ3XpiPeTynqM-nvDjpAUUUWJpfT5aeo6G_scDsN9iipwI
2020-01-17 18:48:09.378382-0800 whistlenative[4462:1287621] 6.15.0 - [Firebase/InstanceID][I-IID014012] Invalidating cached token for 255558254149 (*) due to token is no longer fresh.

Then a bit later my prior token from the previous version of the app where push notifications working is loaded I and see the work "default token" in the logs:

2020-01-17 18:48:09.987571-0800 whistlenative[4462:1287610] 6.15.0 - [Firebase/InstanceID][I-IID014001] Token fetch successful, token: dUY5psWDnkv2td1kB_t6Gs:APA91bEaREBt07CWiEyGvP4YAGjxmVQmF0IcXgef5XcvL5KWrHsqcxZZ8L9PqwGzKTPFGy6cdmuVXSvg6kDQjj-652jt5_jbbKMhUFTcam_-FeBp2vGZvBjaBd4aAOtQf1m48htQ8d6B, authorizedEntity: 255558254149, scope:*
2020-01-17 18:48:09.987764-0800 whistlenative[4462:1287461] -[RNFirebaseMessaging messaging:didReceiveRegistrationToken:] [Line 86] Received new FCM token: dUY5psWDnkv2td1kB_t6Gs:APA91bEaREBt07CWiEyGvP4YAGjxmVQmF0IcXgef5XcvL5KWrHsqcxZZ8L9PqwGzKTPFGy6cdmuVXSvg6kDQjj-652jt5_jbbKMhUFTcam_-FeBp2vGZvBjaBd4aAOtQf1m48htQ8d6B
2020-01-17 18:48:09.993088-0800 whistlenative[4462:1287610] 6.15.0 - [Firebase/InstanceID][I-IID003010] Successfully fetched default token.
2020-01-17 18:48:09.993755-0800 whistlenative[4462:1287610] 6.15.0 - [Firebase/InstanceID][I-IID003008] Got default token dUY5psWDnkv2td1kB_t6Gs:APA91bEaREBt07CWiEyGvP4YAGjxmVQmF0IcXgef5XcvL5KWrHsqcxZZ8L9PqwGzKTPFGy6cdmuVXSvg6kDQjj-652jt5_jbbKMhUFTcam_-FeBp2vGZvBjaBd4aAOtQf1m48htQ8d6B

As interesting, after deleting the current version app and installing the latest version (in previous log it was the update version) we can see the same process in reverse, first my current token is found and is considered no longer fresh:

messaging:didReceiveRegistrationToken:] [Line 86] Received new FCM token: dUY5psWDnkv2td1kB_t6Gs:APA91bEaREBt07CWiEyGvP4YAGjxmVQmF0IcXgef5XcvL5KWrHsqcxZZ8L9PqwGzKTPFGy6cdmuVXSvg6kDQjj-652jt5_jbbKMhUFTcam_-FeBp2vGZvBjaBd4aAOtQf1m48htQ8d6B
2020-01-17 19:03:06.651179-0800 whistlenative[4475:1291698] 6.15.0 - [Firebase/InstanceID][I-IID014012] Invalidating cached token for 255558254149 (*) due to token is no longer fresh.

Subsequently the new token is loaded and is considered the default token and my new install receives FCM notifications right away:

2020-01-17 19:03:07.997209-0800 whistlenative[4475:1291564] -[RNFirebaseMessaging messaging:didReceiveRegistrationToken:] [Line 86] Received new FCM token: ebz2ACPpBkg0kGsgs9yF7_:APA91bGErCaPMuLyRk-_BLZXUk8_U6FyxvKHbI0NPgddFWl_-nLZuCc6HbHg8kaLMDJiO7sHFS8THAuV132xgri8uQ9YV4g8zDXJySrKsSTNiDq9HcXpzUQXQlPy8bTaxZ3gyRxyCy3p
2020-01-17 19:03:08.018870-0800 whistlenative[4475:1291684] 6.15.0 - [Firebase/InstanceID][I-IID014001] Token fetch successful, token: ebz2ACPpBkg0kGsgs9yF7_:APA91bGErCaPMuLyRk-_BLZXUk8_U6FyxvKHbI0NPgddFWl_-nLZuCc6HbHg8kaLMDJiO7sHFS8THAuV132xgri8uQ9YV4g8zDXJySrKsSTNiDq9HcXpzUQXQlPy8bTaxZ3gyRxyCy3p, authorizedEntity: 255558254149, scope:*
2020-01-17 19:03:08.019018-0800 whistlenative[4475:1291684] 6.15.0 - [Firebase/InstanceID][I-IID003010] Successfully fetched default token.
2020-01-17 19:03:08.019065-0800 whistlenative[4475:1291684] 6.15.0 - [Firebase/InstanceID][I-IID003008] Got default token ebz2ACPpBkg0kGsgs9yF7_:APA91bGErCaPMuLyRk-_BLZXUk8_U6FyxvKHbI0NPgddFWl_-nLZuCc6HbHg8kaLMDJiO7sHFS8THAuV132xgri8uQ9YV4g8zDXJySrKsSTNiDq9HcXpzUQXQlPy8bTaxZ3gyRxyCy3p

Just found this interest statement in the logs:

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

It is hard to believe this is happening so consistently but it does certainly seem to be the case, any help would be greatly appreciated.

Viewing all 16558 articles
Browse latest View live


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