Unverified Commit d5d2cdfe authored by xster's avatar xster Committed by GitHub

A bunch of onboarding error detections (#12977)

parent 580281e5
......@@ -41,6 +41,9 @@ You can create a new Provisioning Profile for your project in Xcode for your
team by:
$fixWithDevelopmentTeamInstruction
It's also possible that a previously installed app with the same Bundle Identifier was
signed with a different certificate.
For more information, please visit:
https://flutter.io/setup/#deploy-to-ios-devices
......@@ -65,8 +68,11 @@ const String fixWithDevelopmentTeamInstruction = '''
open ios/Runner.xcworkspace
2- Select the 'Runner' project in the navigator then the 'Runner' target
in the project settings
3- In the 'General' tab, make sure a 'Development Team' is selected. You may need to add
your Apple ID first.
3- In the 'General' tab, make sure a 'Development Team' is selected. You may need to
- Log in with your Apple ID in Xcode first
- Ensure you have a valid unique Bundle ID
- Register your device with your Apple Developer Account
- Let Xcode automatically provision a profile for your app
4- Build or run your project again''';
final RegExp _securityFindIdentityDeveloperIdentityExtractionPattern =
......
......@@ -16,6 +16,7 @@ import '../build_info.dart';
import '../device.dart';
import '../globals.dart';
import '../protocol_discovery.dart';
import 'code_signing.dart';
import 'ios_workflow.dart';
import 'mac.dart';
......@@ -242,7 +243,11 @@ class IOSDevice extends Device {
if (!debuggingOptions.debuggingEnabled) {
// If debugging is not enabled, just launch the application and continue.
printTrace('Debugging is not enabled');
installationResult = await runCommandAndStreamOutput(launchCommand, trace: true);
installationResult = await runCommandAndStreamOutput(
launchCommand,
mapFunction: monitorInstallationFailure,
trace: true,
);
} else {
// Debugging is enabled, look for the observatory server port post launch.
printTrace('Debugging is enabled, connecting to observatory');
......@@ -254,7 +259,11 @@ class IOSDevice extends Device {
final Future<Uri> forwardObservatoryUri = observatoryDiscovery.uri;
final Future<int> launch = runCommandAndStreamOutput(launchCommand, trace: true);
final Future<int> launch = runCommandAndStreamOutput(
launchCommand,
mapFunction: monitorInstallationFailure,
trace: true,
);
localObservatoryUri = await launch.then<Uri>((int result) async {
installationResult = result;
......@@ -331,6 +340,33 @@ class IOSDevice extends Device {
@override
Future<Null> takeScreenshot(File outputFile) => iMobileDevice.takeScreenshot(outputFile);
// Maps stdout line stream. Must return original line.
String monitorInstallationFailure(String stdout) {
// Installation issues.
if (stdout.contains('Error 0xe8008015') || stdout.contains('Error 0xe8000067')) {
printError(noProvisioningProfileInstruction, emphasis: true);
// Launch issues.
} else if (stdout.contains('e80000e2')) {
printError('''
═══════════════════════════════════════════════════════════════════════════════════
Your device is locked. Unlock your device first before running.
═══════════════════════════════════════════════════════════════════════════════════''',
emphasis: true);
} else if (stdout.contains('Error 0xe8000022')) {
printError('''
═══════════════════════════════════════════════════════════════════════════════════
Error launching app. Try launching from within Xcode via:
open ios/Runner.xcworkspace
Your Xcode version may be too old for your iOS version.
═══════════════════════════════════════════════════════════════════════════════════''',
emphasis: true);
}
return stdout;
}
}
class _IOSDeviceLogReader extends DeviceLogReader {
......
......@@ -354,11 +354,9 @@ Future<XcodeBuildResult> buildXcodeProject({
Future<Null> diagnoseXcodeBuildFailure(XcodeBuildResult result, BuildableIOSApp app) async {
if (result.xcodeBuildExecution != null &&
result.xcodeBuildExecution.buildForPhysicalDevice &&
((result.stdout?.contains('BCEROR') == true &&
// May need updating if Xcode changes its outputs.
result.stdout?.contains('Xcode couldn\'t find a provisioning profile matching') == true)
// Error message from ios-deploy for missing provisioning profile.
|| result.stdout?.contains('0xe8008015') == true)) {
result.stdout?.contains('BCEROR') == true &&
// May need updating if Xcode changes its outputs.
result.stdout?.contains('Xcode couldn\'t find a provisioning profile matching') == true) {
printError(noProvisioningProfileInstruction, emphasis: true);
return;
}
......
......@@ -311,33 +311,6 @@ Xcode's output:
Could not build the precompiled application for the device.
Error launching application on iPhone.''',
xcodeBuildExecution: new XcodeBuildExecution(
<String>['xcrun', 'xcodebuild', 'blah'],
'/blah/blah',
buildForPhysicalDevice: true
),
);
await diagnoseXcodeBuildFailure(buildResult, app);
expect(
testLogger.errorText,
contains('No Provisioning Profile was found for your project\'s Bundle Identifier or your device.'),
);
});
testUsingContext('No ios-deploy provisioning profile shows message', () async {
final XcodeBuildResult buildResult = new XcodeBuildResult(
success: false,
stdout: '''
Launching lib/main.dart on iPhone in debug mode...
Signing iOS app for device deployment using developer identity: "iPhone Developer: test@flutter.io (1122334455)"
Running Xcode build... 1.3s
Installing on iPhone...
ios-deploy[75050:1892997] [ !! ] Error 0xe8008015: A valid provisioning profile for this executable was not found. AMDeviceSecureInstallApplication(0, device, url, options, install_callback, 0)
Could not install build/ios/iphoneos/Runner.app on 7233072bb988fb4c64429a4d9a092295f9423892.
Error launching application on iPhone.''',
xcodeBuildExecution: new XcodeBuildExecution(
<String>['xcrun', 'xcodebuild', 'blah'],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment