react-native-webgl fails to build on iOS 12
Recently I was in the need of some WebGL functionality for a React Native app. I found the react-native-webgl project and it looked like it fit my needs. However when building the app I ran into some issues.
I followed the installation instructions making sure the linked libraries in Xcode we’re correct.
But when building the app I got the following error.
** BUILD FAILED **
The following build commands failed:
CompileC ios/build/Build/Intermediates.noindex/RNWebGL.build/Debug-iphonesimulator/RNWebGL.build/Objects-normal/x86_64/RNWebGLView.o node_modules/react-native-webgl/ios/RNWebGLView.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/reactNativeApp.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
Failed to install the requested application
The bundle identifier of the application could not be determined.
Ensure that the application's Info.plist contains a value for CFBundleIdentifier.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/reactNativeApp.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/reactNativeApp.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
at checkExecSyncError (child_process.js:637:11)
at Object.execFileSync (child_process.js:655:13)
at Promise.then (node_modules/react-native/local-cli/runIOS/runIOS.js:208:5)
After opening the project in Xcode and hitting build I got the following errors.
After some Googling I found this Stack Overflow
thread where it looked like someone had a similar issue. I did as they
suggested - removing some files from the npm
package.
$ rm -r ios/build
$ rm -r node_modules/react-native-webgl/ios/framework/GPUImageMac.xcodeproj
$ rm -r node_modules/react-native-webgl/ios/framework/Source/Mac
Afterwards the app built like a charm.
** BUILD SUCCEEDED **
The following commands produced analyzer issues:
Analyze node_modules/react-native/React/Base/RCTModuleMethod.mm normal x86_64
Analyze node_modules/react-native/Libraries/Network/RCTNetInfo.m normal x86_64
(2 commands with analyzer issues)
Installing build/Build/Products/Debug-iphonesimulator/reactNativeApp.app
Launching RN.reactNativeApp
reactNativeApp: 47506
According to the Stack Overflow thread it looks this is something that happens purely when building for iOS 12. There is also an open issue in the react-native-webgl repo with people having the same problem.