Problems and Solutions While Development on MacBook Pro M2
Hello friends, while developing a mobile application using React Native the author was hampered by various setting problems on the Macbook Pro M2, here is a list of the problems noted and their solutions:
Simulator does not automatically open
When you want to run a mobile application developed using Expo, the command starts with expo start then presses the i button to activate the Simulator, and not a simulator that opens but is informed that Xcode must be installed via the App Store, even though Xcode has already been installed.Xcode needs to be installed (don’t worry, you won’t have to use it), would you like to continue to the App Store?After searching through google, the solution is to simply type the command below:
sudo xcode-select -s /Applications/Xcode.app
Please try again by typing expo start and try to open the simulator, the simulator will automatically open.
Reference:
Issue with opening IOS Simulator on Expo Dev Tool
https://developer.apple.com/forums/thread/678469
Git Not Logging Lowercase or Uppercase File Name Changes
File name changes using lowercase and uppercase letters will not be recorded by GIT, meaning that for example we have a physical file named test.js and submitted to github then after a while we want to change its name to Test.js, name changes like this will not be recorded by GIT . Problems will arise when we re-clone the repository and when we want to run the application there is a file error error. The solution to this problem is to manually change the filename directly from the command prompt using the git mv commandgit mv test.js Test.js
Reference:
https://stackoverflow.com/questions/17683458/how-do-i-commit-case-sensitive-only-filename-changes-in-git
GADInvalidInitializationException
After successfully compiling the application for IOS and found no problems or warnings during build compile, the problem appears when running the application, the error message is:GADInvalidInitializationException : Ads SDK was initialized without an application IDThe solution is to add Admob App ID in app.json, recompile it, once done, try to run app in simulator.
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.suryadi.personalnote",
"userInterfaceStyle": "automatic",
"buildNumber": "1.9.7",
"config": {
"googleMobileAdsAppId": "ca-app-pub-6894070964244250~8501322530"
}
},
How to Generate Build Dev Client in Simulator
I use the Expo framework with the addition of expo-dev-client, for those who don’t know what expo-dev-client is, please read other articles Getting to know React, React Native, Bare React Native, and Expo Here is additional configuration to compile expo-dev-client specific in eas.json file
"developmentios": {
"developmentClient": true,
"distribution": "internal",
"ios": { "simulator": true }
},
{
"cli": {
"version": ">= 0.43.0"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"developmentios": {
"developmentClient": true,
"distribution": "internal",
"ios": { "simulator": true }
},
"preview": {
"distribution": "internal"
},
"production": {}
},
"submit": {
"production": {}
}
}
Reference:
https://expo.canny.io/feature-requests/p/custom-dev-clients-for-simulator
eas build –profile preview