I have a project in React Native that has two different build schemes and uses cocoapods. To compile it I run:
react-native run-ios --scheme="RNProject-(SCHEME_NAME)"
The resulting apps are for example:
./build/Build/Products/Debug/iphonesimulator/RNProject-customer1.app
./build/Build/Products/Debug/iphonesimulator/RNProject-customer2.app
Using the command it builds for one of the build schemes, but not for the other
Xcode always builds the project for both build schemes
Furthermore, build/Build/Products/Debug-iphonesimulator/RNProject-customer1.app/Info.plist exists in that path and the file contains valid CFBundleIdentifier (it matches General > Identity > Bundle Identifier for each of the two build schemes)
Project settings seem to be correct for both schemes (after checking ios/RNProject.xcodeproj/project.pbxproj)
Schema-specific settings are located in ios/Pods/Target Support Files/Pods-RNProject-customer1 and ios/Pods/Target Support Files/Pods-RNProject-customer2
I tried different ways to solve it:
Running sudo react-native
Restarting RN packager
Manually editing Info.plist
Changing build locations
Console:
** BUILD SUCCEEDED **
Installing build/Build/Products/Debug-iphonesimulator/RNProject.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
child_process.js:509
throw err;
^
Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/RNProject.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
at checkExecSyncError (child_process.js:486:13)
at Object.execFileSync (child_process.js:506:13)
at ChildProcess.xcodeBuildProcess.on.code (node_modules/react-native/local-cli/runIOS/runIOS.js:109:36)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:852:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
The problem was with how React Native names labels the executable files.
My Xcode project created two executable files with different names based on Xcode project settings.
React Native on the other hand forms the executable filename from .xcworkspace filename in this script (./node_modules/react-native/local-cli/runIOS/runIOS.js:57):
const inferredSchemeName = path.basename(xcodeProject.name, path.extname(xcodeProject.name));
The two approaches are different and lead to two different executable file names (e.g. Xcode build/Build/Products/Debug-iphonesimulator/RNProject-customer1.app vs React Native build/Build/Products/Debug-iphonesimulator/RNProject.app).
I had set custom value for inferredSchemeNameto match the filename created by Xcode.
My solution is similar:
open ./node_modules/react-native/local-cli/runIOS.js file
change the build path from:
const getBuildPath = function(configuration = 'Debug', appName, isDevice) {
return `build/Build/Products/${configuration}-${isDevice ? 'iphoneos' : 'iphonesimulator'}/${appName}.app`;
};
to
const getBuildPath = function(configuration = 'Debug', appName, isDevice) {
return `build/Build/Products/${configuration}-${isDevice ? 'iphoneos' : 'iphonesimulator'}/${appName}.app`;
};
remove "Build" in the path.
I'm using Xcode-beta 8.2
Related
Whenever I try running my app Xcode gives me this:
Launching lib/main.dart on iPhone 14 Pro Max in debug mode...
lib/main.dart:1
Xcode build done. 9.9s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/4m/6ntf71vx17qfqdg9kr88s2s80000gn/T/flutter_tools.V6z5EC/flutter_ios_build_temp_dirX4Qj6c/temporary_xcresult_bundle
: Error: The getter 'payload' isn't defined for the class 'NotificationAppLaunchDetails'.
lib/main.dart:57
- 'NotificationAppLaunchDetails' is from 'package:flutter_local_notifications_platform_interface/src/types.dart' ('../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_local_notifications_platform_interface-6.0.0/lib/src/types.dart').
package:flutter_local_notifications_platform_interface/src/types.dart:1
Try correcting the name to the name of an existing getter, or defining a getter or field named 'payload'.
_orderID = (notificationAppLaunchDetails.payload != null &&
^^^^^^^
: Error: The getter 'payload' isn't defined for the class 'NotificationAppLaunchDetails'.
lib/main.dart:58
- 'NotificationAppLaunchDetails' is from 'package:flutter_local_notifications_platform_interface/src/types.dart' ('../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_local_notifications_platform_interface-6.0.0/lib/src/types.dart').
package:flutter_local_notifications_platform_interface/src/types.dart:1
Try correcting the name to the name of an existing getter, or defining a getter or field named 'payload'.
notificationAppLaunchDetails.payload.isNotEmpty)
^^^^^^^
: Error: The getter 'payload' isn't defined for the class 'NotificationAppLaunchDetails'.
lib/main.dart:59
- 'NotificationAppLaunchDetails' is from 'package:flutter_local_notifications_platform_interface/src/types.dart' ('../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_local_notifications_platform_interface-6.0.0/lib/src/types.dart').
package:flutter_local_notifications_platform_interface/src/types.dart:1
Try correcting the name to the name of an existing getter, or defining a getter or field named 'payload'.
? int.parse(notificationAppLaunchDetails.payload)
^^^^^^^
: Error: The getter 'WebView' isn't defined for the class '_PaymentScreenState'.
package:flutter_sixvalley_ecommerce/…/payment/payment_screen.dart:46
- '_PaymentScreenState' is from 'package:flutter_sixvalley_ecommerce/view/screen/payment/payment_screen.dart' ('lib/view/screen/payment/payment_screen.dart').
package:flutter_sixvalley_ecommerce/…/payment/payment_screen.dart:1
.
. (goes on like this for the rest of the packages)
.
Failed to package /Users/abdelrahmanmohamed/development/FlutterProjects/valley_userapp.
Command PhaseScriptExecution failed with a nonzero exit code
note: Building targets in dependency order
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
warning: Run script build phase 'Thin Binary' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
Result bundle written to path:
/var/folders/4m/6ntf71vx17qfqdg9kr88s2s80000gn/T/flutter_tools.V6z5EC/flutter_ios_build_temp_dirX4Qj6c/temporary_xcresult_bundle
Could not build the application for the simulator.
Error launching application on iPhone 14 Pro Max.
Exited
No matter how much I do flutter clean and arch -x86_64 pod install. It keeps doing this.
I am using a mac silicon machine. And this is a project I didn't run before on it. So its new.
I am using Flutter 3.3.10. And I am able to build and run other Flutter apps.
So running dat analyze as #Alaindeseine suggested revealed in the code editor that these were actually errors in code.
The assets were old and when I updated them it didn't reflect in the code editor.
You can use dart anayze command to display info, warnings, errors and deprecateds. It may help finding what is going wrong with you code.
You can alos use dart fix --dry-runcommand to list and dart fix --apply to fix problems.
Please know that flutter build ios works perfectly without any warning or error.
But when I do flutter build ios --obfuscate --split-debug-info=/_app/obfuscate
it failed with this error :
Building com.x.app for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: YSHDK23K
Running pod install... 18.9s
Running Xcode build...
Xcode build done. 515.9s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
/_app/ios/Pods/libwebp/src/dsp/dec_neon.c:1462:38: warning:
variable 'sum_left' may be uninitialized when used here [-Wconditional-uninitialized]
const uint16x8_t sum = vaddq_u16(sum_left, sum_top);
^~~~~~~~
/_app/ios/Pods/libwebp/src/dsp/dec_neon.c:1426:3: note: variable
'sum_left' is declared here
uint16x8_t sum_left;
^
/_app/ios/Pods/libwebp/src/dsp/dec_neon.c:1462:48: warning:
variable 'sum_top' may be uninitialized when used here [-Wconditional-uninitialized]
const uint16x8_t sum = vaddq_u16(sum_left, sum_top);
^~~~~~~
/_app/ios/Pods/libwebp/src/dsp/dec_neon.c:1425:3: note: variable
'sum_top' is declared here
uint16x8_t sum_top;
...... ======= <Warnings Truncated> ========= .......
/Applications/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_image_compress-0.6.5+1/ios/Classes/SYP
ictureMetadata/SYMetadataExif.m:9:9: warning: non-portable path to file '"SYMetadataExif.h"'; specified path differs in
case from file name on disk [-Wnonportable-include-path]
#import "SYMetadataEXIF.h"
^~~~~~~~~~~~~~~~~~
"SYMetadataExif.h"
1 warning generated.
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Encountered error while building for device.
I got an error from Stackoverflow thus cannot submit without truncating the warnings, thus I cut it off in the middle. If you need more of those warnings please ask me and I will send it to you..
What am I missing here? The app and all works fine even in release mode. It is only when I add the --obfuscate flag it is like this.
Finally I solved this problem. But the solution is tedious and I'm not sure if this is the best solution. But I think this is the robust solution:
Delete Flutter entirely from your computer
Reinstall flutter with the latest version.
In the ios folder of your project directory, delete "Podfile" file, "Podfile.lock" file, and "Pods" directory.
Do flutter clean in your project directory.
Then rerun the app as intended.
Then it works... at least for me.
Anyone else has other solution?
Clean all unwanted files,
run this command from a terminal
flutter clean && rm ios/Podfile ios/Podfile.lock pubspec.lock && rm -rf ios/Pods ios/Runner.xcworkspace
I just installed the latest version of flutter and xcode and I'm getting an error when I try running the flutter app on an actual iPhone. Works on ios simulator. The weird thing is that it works when I run it from xcode, but when I run it from vsCode, I get the following error:
It appears that your application still contains the default signing identifier.
Try replacing 'com.example' with your signing id in Xcode:
open ios/Runner.xcworkspace
What I tried doing:
Change the bundle identifier to myEmailAddress#gmail.com.appTitle
Clean and build the ios app
clean then ran flutter build bundle
What am I doing wrong and how can I get vsCode to run the app on an iPhone?
Here's the full error:
Launching lib/main.dart on Jessica’s iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: ITYTO5RCWD
Xcode build done. 25.4s
Failed to build iOS app
Error output from Xcode build:
↳
2020-04-19 13:53:51.828 xcodebuild[2046:21215] [MT] iPhoneConnect: 📱<DVTiOSDevice ...> == Underlying device preparation errors ==
2020-04-19 13:53:51.828 xcodebuild[2046:21215] [MT] iPhoneConnect: Failed _shouldMakeReadyForDevelopment check even though device is not locked by passcode.
Domain: com.apple.platform.iphoneos
Code: 5
Failure Reason: allowsSecureServices: 1. isConnected: 0. Platform: <"...platform info...">. DTDKDeviceIdentifierIsIDID: 0
User Info: {
DVTDeviceDescription = "...device info..."
}
--
2020-04-19 13:53:51.829 xcodebuild[2046:21215] [MT] iPhoneConnect: 📱<"...platform info..."> == END: Underlying device preparation errors ==
** BUILD FAILED **
Xcode's output:
↳
/Users/Jessica/Development/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.15.1/darwin/Classes/AudioplayersPlugin.m:88:37: warning: incompatible pointer types sending 'FlutterEngine *' to parameter of type 'NSObject<FlutterBinaryMessenger> * _Nonnull' [-Wincompatible-pointer-types]
binaryMessenger:_headlessEngine];
^~~~~~~~~~~~~~~
In module 'Flutter' imported from /Users/Jessica/Development/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers-0.15.1/darwin/Classes/AudioplayersPlugin.h:2:
/Users/Jessica/Desktop/flutter_game2/ios/Flutter/Flutter.framework/Headers/FlutterChannels.h:178:74: note: passing argument to parameter 'messenger' here
binaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger;
^
1 warning generated.
/Users/Jessica/Desktop/flutter_game2/build/ios/Debug-iphoneos/Runner.app: resource fork, Finder information, or similar detritus not allowed
Command CodeSign failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the precompiled application for the device.
It appears that your application still contains the default signing identifier.
Try replacing 'com.example' with your signing id in Xcode:
open ios/Runner.xcworkspace
Error launching application on Jessica’s iPhone.
Exited (sigterm)
Alright, so i solved this problem by pressing on the search icon on the top left of vscode, then searching for com.example
then i saw three search results that were in the ios folder click on it and replace all three com.example with the identifier you created in xcode.
you can change your signing identifier in Xcode
To do that, just open your workspace with app in Xcode, then go to signing and capabilities to change default com.example to anything else...
Better to use as follows to give app company / organization name
flutter create --org com.yourdomain your_app_name
Swift, Kotlin, and androidx dependencies are the default options
After just open the created project in Android Studio or in VSCode
Parameter
--org com.yourcompany
will form applicationId for Android:
com.yourcompany.yourappname
and iOS PRODUCT_BUNDLE_IDENTIFIER:
com.yourcompany.yourAppName
To explore all possible parameters type
flutter create --help
I am following the ReactNative tutorial for 0.58. I do everything it says to do and I am crashing after running react-native run-ios. I have seen this extremely similar SO question from 2016.
I attempted react-native upgrade and it recommended doing react-native-git-upgrade.This did nothing. Same problem.
The bit on running ./configure in the question above after cd-ing into glog did nothing. There was no configure script there. In the path NewStupidProject/node_modules/react-native/scripts there is a script called ios-configure-glog.sh. I run bash ios-configure-glog.sh and it says ios-configure-glog.sh: line 31: ./configure: No such file or directory.
I have also attempted setting Xcode to use the legacy build system. This did not fix the issue. I am restarting my laptop now to see if that makes any of these changes take effect. No luck. At the top it says:
Found Xcode project NewStupidProject.xcodeproj Building using
"xcodebuild -project NewStupidProject.xcodeproj -configuration Debug
-scheme NewStupidProject -destination id=854019D1-8EE7-4D13-87E1-385E6CAC21BE -derivedDataPath build" User
defaults from command line:
IDEDerivedDataPathOverride = /Users/me/NewStupidProject/ios/build
Prepare build
note: Using legacy build system
=== BUILD TARGET double-conversion OF PROJECT React WITH CONFIGURATION Debug ===
When I go into the home directory and run react-native --version the output is:
[NewStupidProject](master)$ react-native --version
react-native-cli: 2.0.1
react-native: 0.58.4
[NewStupidProject](master)$
My output after crashing is:
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Install\ Third\ Party /Users/me/native_react_apps/NewStupidProject/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh
(1 failure)
Installing
build/Build/Products/Debug-iphonesimulator/NewStupidProject.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/NewStupidProject.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Error: Command failed: /usr/libexec/PlistBuddy -c
Print:CFBundleIdentifier
build/Build/Products/Debug-iphonesimulator/NewStupidProject.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 (/Users/me/native_react_apps/NewStupidProject/node_modules/react-native/local-cli/runIOS/runIOS.js:208:5)
How is it possible for the setup process to be this fraught with errors and this difficult?
WHY is this error message not in the Troubleshooting ReactNative setup?
HOW do I fix this? Is it possible to avoid this altogether in the future?
Other versioning info:
XCode: 10.1
Command Line Tools: 10.1
yarn: 0.27.5
watchman: 4.9.0
homebrew: 2.0.1
npm: 6.8.0
node: v11.9.0
macOS: 10.13.6
UPDATE:
I am trying to implement the solution in this issue in GitHub and I'm getting:
dyld: Library not loaded:
/usr/local/opt/readline/lib/libreadline.7.dylib Referenced from:
/usr/local/bin/awk Reason: image not found
./ios-install-third-party.sh: line 20: 24497 Broken pipe: 13
shasum -p "$cachedir/$file"
24498 Abort trap: 6 | awk -v hash="$hash" '{exit $1 != hash}' Incorrect hash: 61067502c5f9769d111ea1ee3f74e6ddf0a5f9cc
?/Users/me/.rncache/glog-0.3.5.tar.gz
UPDATE No. 2 I am trying to run the watchman watch-del-all command as recommended here to clear the cache for RN > 0.50 and the whole thing is hanging.
I tried modify the build system and it worked for me.
Detail:
Open your project workspace file in Xcode, and
File -> Workspace Settings -> Build system -> Legacy Build system
I get the "error: can't exec (No such file or directory)" when building a project with a user-defined build setting which is a path to a script. The project builds in Xcode 9.
ld = $(USER_LIBRARY_DIR)/Application\ Support/BlackBerry/Good.platform/iOS/FIPS_module/$FIPS_PACKAGE/bin/gd_fipsld
gives
error: can't exec '/Users/username/Library/Application\ Support/BlackBerry/Good.platform/iOS/FIPS_module/arm64.sdk/bin/gd_fipsld' (No such file or directory)
How to fix it?
In Xcode10 the new build system doesn’t support the tilde(~) character which is replaced with $(HOME) in the path.
Before: ~/Library/Application Support/BlackBerry/Good.platform/iOS/FIPS_module/$FIPS_PACKAGE/bin/gd_fipsld
After: $(HOME)/Library/Application Support/BlackBerry/Good.platform/iOS/FIPS_module/$FIPS_PACKAGE/bin/gd_fipsld
Note: The changes needs to be made in default.xcconfig file.