microsoft / appcenter-sdk-react-native

Development repository for the App Center SDK for React Native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash analytics data for React-Native ios not getting reported in App-center

rg224 opened this issue · comments

Description

Crash analytics data for React-Native ios not getting reported in appcenter.
await Crashes.isEnabled is returning false

Details

  1. Which version of the App Center SDK are you using?
    • 4.3.0
  2. Which OS version did you experience the issue on?
    • iOS 15
  3. What device version did you see this error on? Were you using an emulator or a physical device?
    • iPhone 13 simulator
  4. What third party libraries are you using?
    • example
  5. Run the following command and paste the output below: react-native info
System:
    OS: macOS 12.3.1
    CPU: (8) arm64 Apple M1
    Memory: 96.25 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.3.0 - /var/folders/vc/qr52wmxd6zn37ry72ngft94c0000gn/T/yarn--1659075042095-0.1542682838618641/node
    Yarn: 1.22.10 - /var/folders/vc/qr52wmxd6zn37ry72ngft94c0000gn/T/yarn--1659075042095-0.1542682838618641/yarn
    npm: 7.15.1 - /opt/homebrew/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.11.2 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 13.3.1/13E500a - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_292 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: ^17.0.2 => 17.0.2 
    react-native: 0.66.3 => 0.66.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
  1. If you're developing for React Native iOS, run the following command and paste the output below: pod --version
    • 1.11.2

Hello @rg224.
We will take a look at this issue and write you back as soon as there will be update.

commented

Hi @sahilmahajanpikup , please share your verbose logs.
The code snippet of your AppCenter SDK initialization and sending analytics data would also be helpful.

Hi @DmitriyKirakosyan we do not send analytics data, all we want is to track crashes.

here is the Code snippet of AppCenter SDK initialization for ios:
Screenshot 2022-08-01 at 11 35 42 AM

Screenshot 2022-08-01 at 11 34 49 AM

commented

Hi @rg224 , I would still check the verbose logs if possible. Are you testing crashes locally? If so, try to call Crashes.generateTestCrash() (see docs). Make sure the debugger is not attached. Also keep in mind that the crash is sending on the next app launch, after the crash happened.

@DmitriyKirakosyan below are verbose logs and when I tried using Crashes.generateTestCrash() app isn't getting crashed (debugger wan't connected)

Verbose logs:

2022-08-01 17:13:41.452778+0530 runerra[39760:4167841] [AppCenter] VERBOSE: -[MSACChannelUnitDefault pauseWithIdentifyingObjectSync:]/480 Identifying object <MSACAppCenter: 0x6000027f0540> added to pause lane for channel AppCenter.
2022-08-01 17:13:41.465166+0530 runerra[39760:4167841] [AppCenter] VERBOSE: -[MSACChannelUnitDefault pauseWithIdentifyingObjectSync:]/480 Identifying object <MSACAppCenter: 0x6000027f0540> added to pause lane for channel AppCenter/one.
2022-08-01 17:13:41.465506+0530 runerra[39760:4167841] [AppCenter] VERBOSE: -[MSACChannelUnitDefault pauseWithIdentifyingObjectSync:]/480 Identifying object <MSACAppCenter: 0x6000027f0540> added to pause lane for channel Analytics.
2022-08-01 17:13:41.466432+0530 runerra[39760:4167841] [AppCenter] VERBOSE: -[MSACChannelUnitDefault pauseWithIdentifyingObjectSync:]/480 Identifying object <MSACAppCenter: 0x6000027f0540> added to pause lane for channel Analytics/one.
2022-08-01 17:13:41.466621+0530 runerra[39760:4167841] [AppCenter] VERBOSE: -[MSACChannelUnitDefault pauseWithIdentifyingObjectSync:]/480 Identifying object <MSACAppCenter: 0x6000027f0540> added to pause lane for channel Analytics_critical.
2022-08-01 17:13:41.467170+0530 runerra[39760:4167841] [AppCenter] VERBOSE: -[MSACChannelUnitDefault pauseWithIdentifyingObjectSync:]/480 Identifying object <MSACAppCenter: 0x6000027f0540> added to pause lane for channel Analytics_critical/one.
2022-08-01 17:13:41.467488+0530 runerra[39760:4167841] [AppCenter] VERBOSE: -[MSACChannelUnitDefault pauseWithIdentifyingObjectSync:]/480 Identifying object <MSACAppCenter: 0x6000027f0540> added to pause lane for channel AppCenter/one.
2022-08-01 17:13:41.467688+0530 runerra[39760:4167841] [AppCenter] VERBOSE: -[MSACChannelUnitDefault pauseWithIdentifyingObjectSync:]/480 Identifying object <MSACAppCenter: 0x6000027f0540> added to pause lane for channel Analytics/one.
2022-08-01 17:13:41.468416+0530 runerra[39760:4167841] [AppCenter] VERBOSE: -[MSACChannelUnitDefault pauseWithIdentifyingObjectSync:]/480 Identifying object <MSACAppCenter: 0x6000027f0540> added to pause lane for channel Analytics_critical/one.
commented

@rg224 , just tested this myself on a sample app and it worked as expected. Here is what I did:

  1. Added [MSACAppCenter setLogLevel: MSACLogLevelVerbose]; before the [AppCenterReactNative register]; call.
  2. Added a button in JS code: { text: "Crash App", onPress: () => Crashes.generateTestCrash() }
  3. Launched the app from Xcode with debug executable: false
  4. Crashes the app by clicking the button
  5. Relaunched the app from Xcode and made sure the crash log was sent by checking the logs.

Please make sure you didn't miss anything from these steps. If you find the text Cannot start service MSACCrashes. App Center was started without app secret, but the service requires it., then make sure you configured the app secret in the AppCenter-Config.plist file as described here.

@DmitriyKirakosyan ok sure, I'll again follow these steps and inform you

@DmitriyKirakosyan can you tell me steps of how I can perform debug executable: false (as I am unable to find the checkbox to disable debugging in Xcode)

Although on clicking btn for crashing the app I am getting following message:
[AppCenter] ERROR: -[MSACServiceAbstract canBeUsed]/58 Crashes service hasn't been started. You need to call [MSACAppCenter start:YOUR_APP_SECRET withServices:LIST_OF_SERVICES] first.

commented

Crashes service hasn't been started. You need to call [MSACAppCenter start:YOUR_APP_SECRET withServices:LIST_OF_SERVICES] first

@rg224 , this means you haven't initialized AppCenter SDK properly. Have you created AppCenter-Config.plist, added app secret to it as described here, and (important) added the file in Xcode?

can you tell me steps of how I can perform debug executable: false (as I am unable to find the checkbox to disable debugging in Xcode)

Click on your selected scheme, then Edit Scheme... -> Run -> Debug executable (checkbox)

commented

@rg224 you can use this repo as a reference and example: https://github.com/microsoft/appcenter-sampleapp-react-native, or DemoApp inside this repository.

ok sure will reference it @DmitriyKirakosyan
Thanks!

Crashes service hasn't been started. You need to call [MSACAppCenter start:YOUR_APP_SECRET withServices:LIST_OF_SERVICES] first

@rg224 , this means you haven't initialized AppCenter SDK properly. Have you created AppCenter-Config.plist, added app secret to it as described here, and (important) added the file in Xcode?

can you tell me steps of how I can perform debug executable: false (as I am unable to find the checkbox to disable debugging in Xcode)

Click on your selected scheme, then Edit Scheme... -> Run -> Debug executable (checkbox)

after following all the steps mentioned above, it seems that AppCenter-Config.plist wasn't added in Xcode, because of which crashes were not getting generated.
But now they are.
Thankyou @DmitriyKirakosyan