Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random error when running in ios #680

Open
1 task done
vishnuc opened this issue Jan 3, 2025 · 8 comments
Open
1 task done

Random error when running in ios #680

vishnuc opened this issue Jan 3, 2025 · 8 comments
Labels
help wanted Extra attention is needed

Comments

@vishnuc
Copy link

vishnuc commented Jan 3, 2025

What happened?

I keep getting this error when i use only react-native-google-mobile-ads

(NOBRIDGE) LOG AdMob initialized successfully
(NOBRIDGE) LOG Adapter statuses: [{"description": "<GADAdapterStatus: 0x6000017bb080; state = Ready>", "name": "GADMobileAds", "state": 1}]
[BrowserEngineKit] Failed to terminate process: Error
Domain=com.apple.extensionKit.errorDomain Code=18 "(null)"
UserInfo={NSUnderlyingError=0x600000c72400 {Error
Domain=RBSRequestErrorDomain Code=3 "No such process found"
UserInfo={NSLocalizedFailureReason=No such process found}}}

I use below code


import Constants from "expo-constants";
import { Platform, View, Text } from "react-native";

// Define the type for mobileAds to handle potential undefined case
let mobileAds: any = undefined;
let BannerAd: any = undefined;
let BannerAdSize: any = undefined;
let TestIds: any = undefined;

// Only load the module if we're not in Expo Go
if (Constants.executionEnvironment !== "storeClient") {
  // Using require instead of import for conditional loading
  const ads = require("react-native-google-mobile-ads");
  mobileAds = ads.default;
  BannerAd = ads.BannerAd;
  BannerAdSize = ads.BannerAdSize;
  TestIds = ads.TestIds;
}

export const initAdmob = async () => {
  console.log("Execution Environment:", Constants.executionEnvironment);
  console.log("Dev Environment", __DEV__);

  if (Constants.executionEnvironment !== "storeClient" && mobileAds) {
    try {
      const adapterStatuses = await mobileAds().initialize();
      console.log("AdMob initialized successfully");
      console.log("Adapter statuses:", adapterStatuses);
    } catch (error) {
      console.error("Failed to initialize AdMob:", error);
    }
  } else {
    console.log("Skipping AdMob initialization in Expo Go");
  }
};

// Banner Ad Component
import React, { useRef, useEffect } from "react";

const BANNER_AD_UNIT_ID = __DEV__
  ? (TestIds?.BANNER ?? "")
  : Platform.select({
      ios: "ca-app-pub-2399707265097616/6526811132",
      android: "ca-app-pub-2399707265097616/4989565851",
      default: "", // Fallback empty string for other platforms
    });

// Dummy Ad Component for development
const DummyAd = () => {
  return (
    <View className="h-[50px] w-full items-center justify-center border border-input bg-muted">
      <View className="text-muted-foreground">
        <Text className="text-sm text-muted-foreground">Ad Placeholder</Text>
      </View>
    </View>
  );
};

export const BannerAdComponent = () => {
  const bannerRef = useRef(null);

  if (Constants.executionEnvironment === "storeClient" || !BannerAd) {
    return <DummyAd />; // Return dummy ad in Expo Go or if BannerAd is not available
  }

  return (
    <View className="w-full items-center justify-center">
      <BannerAd
        ref={bannerRef}
        unitId={BANNER_AD_UNIT_ID}
        size={BannerAdSize.ANCHORED_ADAPTIVE_BANNER}
      />
    </View>
  );
};

Platforms

iOS, but have not tested behavior on Android

React Native Info

expo

Are your using Typescript?

  • My project is using Typescript

package.json

{
  "name": "my-app",
  "main": "expo-router/entry",
  "version": "1.0.0",
  "scripts": {
    "z": "expo start",
    "reset-project": "node ./scripts/reset-project.js",
    "android": "echo \"sdk.dir=$HOME/Library/Android/sdk\" > android/local.properties && expo run:android",
    "androidd": "echo \"sdk.dir=$HOME/Library/Android/sdk\" > android/local.properties && expo run:android --device",
    "ios": "expo run:ios",
    "iosd": "expo run:ios --device",
    "web": "expo start --web",
    "test": "jest --watchAll",
    "buildc": "expo prebuild --clean",
    "build": "expo prebuild",
    "lint": "expo lint",
    "up": "node push.cjs"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@expo/vector-icons": "^14.0.2",
    "@react-native-async-storage/async-storage": "1.23.1",
    "@react-native-picker/picker": "2.9.0",
    "@react-navigation/bottom-tabs": "^7.2.0",
    "@react-navigation/native": "^7.0.14",
    "clsx": "^2.1.1",
    "expo": "~52.0.23",
    "expo-application": "~6.0.1",
    "expo-blur": "~14.0.1",
    "expo-build-properties": "^0.13.1",
    "expo-constants": "~17.0.3",
    "expo-font": "~13.0.2",
    "expo-haptics": "~14.0.0",
    "expo-linking": "~7.0.3",
    "expo-router": "~4.0.15",
    "expo-splash-screen": "~0.29.18",
    "expo-status-bar": "~2.0.0",
    "expo-symbols": "~0.2.0",
    "expo-system-ui": "~4.0.6",
    "expo-web-browser": "~14.0.1",
    "nativewind": "^4.1.23",
    "react": "18.3.1",
    "react-dom": "18.3.1",
    "react-native": "0.76.5",
    "react-native-gesture-handler": "~2.20.2",
    "react-native-google-mobile-ads": "^14.8.0",
    "react-native-reanimated": "~3.16.1",
    "react-native-safe-area-context": "^4.12.0",
    "react-native-screens": "~4.4.0",
    "react-native-toast-message": "^2.2.1",
    "react-native-web": "~0.19.13",
    "react-native-webview": "13.12.5",
    "tailwindcss": "^3.4.17",
    "zustand": "^5.0.2"
  },
  "devDependencies": {
    "@babel/core": "^7.25.2",
    "@types/jest": "^29.5.12",
    "@types/react": "~18.3.12",
    "@types/react-test-renderer": "^18.3.0",
    "jest": "^29.2.1",
    "jest-expo": "~52.0.2",
    "prettier": "^3.4.2",
    "prettier-plugin-tailwindcss": "^0.6.9",
    "react-test-renderer": "18.3.1",
    "typescript": "^5.3.3"
  },
  "private": true
}

app.json

{
  "expo": {
    "name": "Speed Math",
    "slug": "speed-math",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./src/assets/images/icon.png",
    "scheme": "speed-math",
    "userInterfaceStyle": "automatic",
    "newArchEnabled": true,
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "com.vishnu.speedmath"
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./src/assets/images/adaptive-icon.png",
        "backgroundColor": "#ffffff"
      },
      "adaptiveIconForeground": "./src/assets/images/adaptive-icon.png",
      "adaptiveIconBackground": "#ffffff",
      "adaptiveIconBackgroundDark": "#000000",
      "package": "com.vishnu.speedmath"
    },
    "plugins": [
      "expo-router",
      "expo-splash-screen",
      [
        "expo-build-properties",
        {
          "ios": {
            "useFrameworks": "static"
          }
        }
      ],
      [
        "react-native-google-mobile-ads",
        {
          "androidAppId": "ca-app-pub-2399707265097616~123",
          "iosAppId": "ca-app-pub-2399707265097616~123"
        }
      ]
    ],
    "splash": {
      "image": "./src/assets/images/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff",
      "dark": {
        "image": "./src/assets/images/splash.png",
        "resizeMode": "contain",
        "backgroundColor": "#000000"
      }
    },
    "experiments": {
      "typedRoutes": true
    }
  }
}

ios/Podfile

No response

android/build.gradle

No response

android/app/build.gradle

No response

android/settings.gradle

No response

AndroidManifest.xml

No response

@vishnuc vishnuc added the help wanted Extra attention is needed label Jan 3, 2025
@mikehardy
Copy link
Collaborator

That doesn't look like an iOS crash trace to me, there is not enough information to localize a problem and look for a solution here.

Run the app from Xcode, watch the console and get the actual crash trace and paste it in here in between triple-backticks (so it's formatted well) and if there is a stack frame pointing to this module we can investigate

@vishnuc
Copy link
Author

vishnuc commented Jan 3, 2025

In Xcode I get below error

0x11f031140 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=45388, error: (null)
Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}>
0x11f031a40 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebProcess NearSuspended Assertion' for process with PID=45388, error: (null)
Failed to terminate process: Error Domain=com.apple.extensionKit.errorDomain Code=18 "(null)" UserInfo={NSUnderlyingError=0x600000c87de0 {Error Domain=RBSRequestErrorDomain Code=3 "No such process found" UserInfo={NSLocalizedFailureReason=No such process found}}}

@vishnuc
Copy link
Author

vishnuc commented Jan 3, 2025

Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "((target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.rendering AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.networking AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.webcontent))" UserInfo={NSLocalizedFailureReason=((target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.rendering AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.networking AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.webcontent))}>
0x121031680 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=47784, error: (null)
Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}>
0x121031a40 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebProcess NearSuspended Assertion' for process with PID=47784, error: (null)

@mikehardy
Copy link
Collaborator

@vishnuc I don't know what any one expects with regard to support or troubleshooting when next to zero information is provided. There's nothing really to go on here.

@vishnuc
Copy link
Author

vishnuc commented Jan 3, 2025

Hey I am sorry , But only when I use react-native-google-mobile-ads , maybe this issue in dev build

@mikehardy
Copy link
Collaborator

You are still not providing any information that could be useful to help locate the error

@vishnuc
Copy link
Author

vishnuc commented Jan 3, 2025

Hey am sorry , but please guide me how get useful information ? I run in xcode and pasted the warnings i received in console..ads are working fine , but this warnings keep popping up

@mikehardy
Copy link
Collaborator

If ads are working, I think there is nothing to be done. Have you searched around for the error message prior to posting? I just did so and If you search around for that message or similar ones you'll see that they are apparently outside of the control of the app or this module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants