Commit acd3f7ca authored by Justin Cohen's avatar Justin Cohen Committed by Commit Bot

[ios] Get things compiling on Xcode 11.

Updates various files with to conform to iOS13 SDK headers changes:
  Nullability and availability changes
  Updates security types
  Updated default values (modalPresentationStyle)
  Updates objc_zombie with IMP changes (as well as adding the accidentally-omitted tests)

TBR=rohitrao

Change-Id: I7d88a8c0fbb764484050be67dd33adcd11d343dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1642508
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Reviewed-by: default avataredchin <edchin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#666142}
parent 46f2422a
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef BASE_MAC_FOUNDATION_UTIL_H_ #ifndef BASE_MAC_FOUNDATION_UTIL_H_
#define BASE_MAC_FOUNDATION_UTIL_H_ #define BASE_MAC_FOUNDATION_UTIL_H_
#include <AvailabilityMacros.h>
#include <CoreFoundation/CoreFoundation.h> #include <CoreFoundation/CoreFoundation.h>
#include <string> #include <string>
...@@ -52,7 +53,7 @@ typedef CR_FORWARD_ENUM(unsigned int, NSSearchPathDirectory); ...@@ -52,7 +53,7 @@ typedef CR_FORWARD_ENUM(unsigned int, NSSearchPathDirectory);
typedef unsigned int NSSearchPathDomainMask; typedef unsigned int NSSearchPathDomainMask;
#endif #endif
#if defined(OS_IOS) #if defined(OS_IOS) || defined(MAC_OS_X_VERSION_10_15)
typedef struct CF_BRIDGED_TYPE(id) __SecCertificate* SecCertificateRef; typedef struct CF_BRIDGED_TYPE(id) __SecCertificate* SecCertificateRef;
typedef struct CF_BRIDGED_TYPE(id) __SecKey* SecKeyRef; typedef struct CF_BRIDGED_TYPE(id) __SecKey* SecKeyRef;
typedef struct CF_BRIDGED_TYPE(id) __SecPolicy* SecPolicyRef; typedef struct CF_BRIDGED_TYPE(id) __SecPolicy* SecPolicyRef;
......
...@@ -198,6 +198,7 @@ test("components_unittests") { ...@@ -198,6 +198,7 @@ test("components_unittests") {
deps += [ deps += [
"//components/autofill/ios/browser:unit_tests", "//components/autofill/ios/browser:unit_tests",
"//components/autofill/ios/form_util:unit_tests", "//components/autofill/ios/form_util:unit_tests",
"//components/crash/core/common:unit_tests",
"//components/image_fetcher/ios:unit_tests", "//components/image_fetcher/ios:unit_tests",
"//components/language/ios/browser:unit_tests", "//components/language/ios/browser:unit_tests",
"//components/password_manager/ios:unit_tests", "//components/password_manager/ios:unit_tests",
......
...@@ -153,7 +153,15 @@ source_set("unit_tests") { ...@@ -153,7 +153,15 @@ source_set("unit_tests") {
sources += [ "objc_zombie_unittest.mm" ] sources += [ "objc_zombie_unittest.mm" ]
} }
if (!is_mac && !is_win && !is_fuchsia && !is_android) { # TODO(crbug.com/970280): crash_key* is failing on iOS.
if (is_ios) {
sources -= [
"crash_key_unittest.cc",
"crash_keys_unittest.cc",
]
}
if (!is_mac && !is_ios && !is_win && !is_fuchsia && !is_android) {
include_dirs = [ "//third_party/breakpad/breakpad/src/" ] include_dirs = [ "//third_party/breakpad/breakpad/src/" ]
sources += [ "crash_key_breakpad_unittest.cc" ] sources += [ "crash_key_breakpad_unittest.cc" ]
} }
......
...@@ -56,7 +56,17 @@ namespace { ...@@ -56,7 +56,17 @@ namespace {
const size_t kBacktraceDepth = 20; const size_t kBacktraceDepth = 20;
// The original implementation for |-[NSObject dealloc]|. // The original implementation for |-[NSObject dealloc]|.
IMP g_originalDeallocIMP = NULL; #if OBJC_OLD_DISPATCH_PROTOTYPES
using RealIMP = IMP;
#else
// With !OBJC_OLD_DISPATCH_PROTOTYPES the runtime hasn't changed and IMP is
// still what it always was, but the SDK is hiding the details now outside the
// objc runtime. It is safe to define |RealIMP| to match the older definition of
// |IMP|.
using RealIMP = id (*)(id, SEL, ...);
#endif
RealIMP g_originalDeallocIMP = NULL;
// Classes which freed objects become. |g_fatZombieSize| is the // Classes which freed objects become. |g_fatZombieSize| is the
// minimum object size which can be made into a fat zombie (which can // minimum object size which can be made into a fat zombie (which can
...@@ -252,8 +262,8 @@ BOOL ZombieInit() { ...@@ -252,8 +262,8 @@ BOOL ZombieInit() {
return YES; return YES;
Class rootClass = [NSObject class]; Class rootClass = [NSObject class];
g_originalDeallocIMP = g_originalDeallocIMP = reinterpret_cast<RealIMP>(
class_getMethodImplementation(rootClass, @selector(dealloc)); class_getMethodImplementation(rootClass, @selector(dealloc)));
// objc_getClass() so CrZombie doesn't need +class. // objc_getClass() so CrZombie doesn't need +class.
g_zombieClass = objc_getClass("CrZombie"); g_zombieClass = objc_getClass("CrZombie");
g_fatZombieClass = objc_getClass("CrFatZombie"); g_fatZombieClass = objc_getClass("CrFatZombie");
...@@ -346,9 +356,10 @@ bool ZombieEnable(bool zombieAllObjects, ...@@ -346,9 +356,10 @@ bool ZombieEnable(bool zombieAllObjects,
if (!m) if (!m)
return false; return false;
const IMP prevDeallocIMP = method_setImplementation(m, (IMP)ZombieDealloc); const RealIMP prevDeallocIMP = reinterpret_cast<RealIMP>(
method_setImplementation(m, reinterpret_cast<IMP>(ZombieDealloc)));
DCHECK(prevDeallocIMP == g_originalDeallocIMP || DCHECK(prevDeallocIMP == g_originalDeallocIMP ||
prevDeallocIMP == (IMP)ZombieDealloc); prevDeallocIMP == reinterpret_cast<RealIMP>(ZombieDealloc));
// Grab the current set of zombies. This is thread-safe because // Grab the current set of zombies. This is thread-safe because
// only the main thread can change these. // only the main thread can change these.
...@@ -420,7 +431,7 @@ void ZombieDisable() { ...@@ -420,7 +431,7 @@ void ZombieDisable() {
// Put back the original implementation of -[NSObject dealloc]. // Put back the original implementation of -[NSObject dealloc].
Method m = class_getInstanceMethod([NSObject class], @selector(dealloc)); Method m = class_getInstanceMethod([NSObject class], @selector(dealloc));
DCHECK(m); DCHECK(m);
method_setImplementation(m, g_originalDeallocIMP); method_setImplementation(m, reinterpret_cast<IMP>(g_originalDeallocIMP));
// Can safely grab this because it only happens on the main thread. // Can safely grab this because it only happens on the main thread.
const size_t oldCount = g_zombieCount; const size_t oldCount = g_zombieCount;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"comments": [ "comments": [
"Runs tests on 64-bit iOS 11.4 and 12.1 and 13.0 tests" "Runs tests on 64-bit iOS 11.4 and 12.1 and 13.0 tests"
], ],
"xcode build version": "10e125", "xcode build version": "11m336w",
"gn_args": [ "gn_args": [
"goma_dir=\"$(goma_dir)\"", "goma_dir=\"$(goma_dir)\"",
"is_component_build=false", "is_component_build=false",
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"xcode parallelization": true, "xcode parallelization": true,
"include": "eg2_tests.json", "include": "eg2_tests.json",
"device type": "iPhone X", "device type": "iPhone X",
"os": "12.2", "os": "13.0",
"pool":"Chrome", "pool":"Chrome",
"host os": "Mac-10.14.3", "host os": "Mac-10.14.3",
"optional_dimensions": { "optional_dimensions": {
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
{ {
"include": "screen_size_dependent_tests.json", "include": "screen_size_dependent_tests.json",
"device type": "iPhone 6s Plus", "device type": "iPhone 6s Plus",
"os": "12.2", "os": "13.0",
"pool":"Chrome", "pool":"Chrome",
"host os": "Mac-10.14.3", "host os": "Mac-10.14.3",
"optional_dimensions": { "optional_dimensions": {
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
{ {
"include": "screen_size_dependent_tests.json", "include": "screen_size_dependent_tests.json",
"device type": "iPhone 6s", "device type": "iPhone 6s",
"os": "12.2", "os": "13.0",
"pool":"Chrome", "pool":"Chrome",
"host os": "Mac-10.14.3", "host os": "Mac-10.14.3",
"optional_dimensions": { "optional_dimensions": {
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
{ {
"include": "common_tests.json", "include": "common_tests.json",
"device type": "iPhone 6s", "device type": "iPhone 6s",
"os": "12.2", "os": "13.0",
"pool":"Chrome", "pool":"Chrome",
"host os": "Mac-10.14.3", "host os": "Mac-10.14.3",
"optional_dimensions": { "optional_dimensions": {
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
{ {
"include": "eg_tests.json", "include": "eg_tests.json",
"device type": "iPhone 7", "device type": "iPhone 7",
"os": "12.2", "os": "13.0",
"pool":"Chrome", "pool":"Chrome",
"host os": "Mac-10.14.3", "host os": "Mac-10.14.3",
"optional_dimensions": { "optional_dimensions": {
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
{ {
"include": "eg_tests.json", "include": "eg_tests.json",
"device type": "iPad Air 2", "device type": "iPad Air 2",
"os": "12.2", "os": "13.0",
"pool":"Chrome", "pool":"Chrome",
"host os": "Mac-10.14.3", "host os": "Mac-10.14.3",
"optional_dimensions": { "optional_dimensions": {
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
{ {
"include": "eg_tests.json", "include": "eg_tests.json",
"device type": "iPhone X", "device type": "iPhone X",
"os": "12.2", "os": "13.0",
"pool":"Chrome", "pool":"Chrome",
"host os": "Mac-10.14.3", "host os": "Mac-10.14.3",
"optional_dimensions": { "optional_dimensions": {
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
{ {
"include": "eg_cq_tests.json", "include": "eg_cq_tests.json",
"device type": "iPhone X", "device type": "iPhone X",
"os": "12.2", "os": "13.0",
"pool":"Chrome", "pool":"Chrome",
"host os": "Mac-10.14.3", "host os": "Mac-10.14.3",
"optional_dimensions": { "optional_dimensions": {
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
{ {
"include": "eg_cq_tests.json", "include": "eg_cq_tests.json",
"device type": "iPad Air 2", "device type": "iPad Air 2",
"os": "12.2", "os": "13.0",
"pool":"Chrome", "pool":"Chrome",
"host os": "Mac-10.14.3", "host os": "Mac-10.14.3",
"optional_dimensions": { "optional_dimensions": {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"comments": [ "comments": [
"Runs tests on 64-bit iOS 11.4 and 12.1 and 13.0 tests" "Runs tests on 64-bit iOS 11.4 and 12.1 and 13.0 tests"
], ],
"xcode build version": "10e125", "xcode build version": "11m336w",
"gn_args": [ "gn_args": [
"goma_dir=\"$(goma_dir)\"", "goma_dir=\"$(goma_dir)\"",
"is_component_build=false", "is_component_build=false",
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"xcode parallelization": true, "xcode parallelization": true,
"include": "eg2_tests.json", "include": "eg2_tests.json",
"device type": "iPhone X", "device type": "iPhone X",
"os": "12.2", "os": "13.0",
"pool":"Chrome", "pool":"Chrome",
"host os": "Mac-10.14.3", "host os": "Mac-10.14.3",
"optional_dimensions": { "optional_dimensions": {
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
{ {
"include": "screen_size_dependent_tests.json", "include": "screen_size_dependent_tests.json",
"device type": "iPhone 6s Plus", "device type": "iPhone 6s Plus",
"os": "12.2", "os": "13.0",
"pool":"Chrome", "pool":"Chrome",
"host os": "Mac-10.14.3", "host os": "Mac-10.14.3",
"optional_dimensions": { "optional_dimensions": {
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
{ {
"include": "screen_size_dependent_tests.json", "include": "screen_size_dependent_tests.json",
"device type": "iPhone 6s", "device type": "iPhone 6s",
"os": "12.2", "os": "13.0",
"pool":"Chrome", "pool":"Chrome",
"host os": "Mac-10.14.3", "host os": "Mac-10.14.3",
"optional_dimensions": { "optional_dimensions": {
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
{ {
"include": "common_tests.json", "include": "common_tests.json",
"device type": "iPhone 6s", "device type": "iPhone 6s",
"os": "12.2", "os": "13.0",
"pool":"Chrome", "pool":"Chrome",
"host os": "Mac-10.14.3", "host os": "Mac-10.14.3",
"optional_dimensions": { "optional_dimensions": {
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
{ {
"include": "eg_tests.json", "include": "eg_tests.json",
"device type": "iPhone 7", "device type": "iPhone 7",
"os": "12.2", "os": "13.0",
"pool":"Chrome", "pool":"Chrome",
"host os": "Mac-10.14.3", "host os": "Mac-10.14.3",
"optional_dimensions": { "optional_dimensions": {
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
{ {
"include": "eg_tests.json", "include": "eg_tests.json",
"device type": "iPad Air 2", "device type": "iPad Air 2",
"os": "12.2", "os": "13.0",
"pool":"Chrome", "pool":"Chrome",
"host os": "Mac-10.14.3", "host os": "Mac-10.14.3",
"optional_dimensions": { "optional_dimensions": {
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
{ {
"include": "eg_tests.json", "include": "eg_tests.json",
"device type": "iPhone X", "device type": "iPhone X",
"os": "12.2", "os": "13.0",
"pool":"Chrome", "pool":"Chrome",
"host os": "Mac-10.14.3", "host os": "Mac-10.14.3",
"optional_dimensions": { "optional_dimensions": {
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
{ {
"include": "eg_cq_tests.json", "include": "eg_cq_tests.json",
"device type": "iPhone X", "device type": "iPhone X",
"os": "12.2", "os": "13.0",
"pool":"Chrome", "pool":"Chrome",
"host os": "Mac-10.14.3", "host os": "Mac-10.14.3",
"optional_dimensions": { "optional_dimensions": {
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
{ {
"include": "eg_cq_tests.json", "include": "eg_cq_tests.json",
"device type": "iPad Air 2", "device type": "iPad Air 2",
"os": "12.2", "os": "13.0",
"pool":"Chrome", "pool":"Chrome",
"host os": "Mac-10.14.3", "host os": "Mac-10.14.3",
"optional_dimensions": { "optional_dimensions": {
......
...@@ -210,7 +210,6 @@ void UndockKeyboard() { ...@@ -210,7 +210,6 @@ void UndockKeyboard() {
CGRect keyboardContainerFrame = KeyboardContainerForLayout(layout).frame; CGRect keyboardContainerFrame = KeyboardContainerForLayout(layout).frame;
CGPoint pointToKey = {keyFrame.origin.x - keyboardContainerFrame.origin.x, CGPoint pointToKey = {keyFrame.origin.x - keyboardContainerFrame.origin.x,
keyFrame.origin.y - keyboardContainerFrame.origin.y}; keyFrame.origin.y - keyboardContainerFrame.origin.y};
CGRectIntersection(keyFrame, keyboardContainerFrame);
CGPoint startPoint = CGPointMake((pointToKey.x + keyFrame.size.width / 2.0) / CGPoint startPoint = CGPointMake((pointToKey.x + keyFrame.size.width / 2.0) /
keyboardContainerFrame.size.width, keyboardContainerFrame.size.width,
(pointToKey.y + keyFrame.size.height / 2.0) / (pointToKey.y + keyFrame.size.height / 2.0) /
......
...@@ -143,6 +143,11 @@ initWithRootViewController:(UIViewController*)rootViewController ...@@ -143,6 +143,11 @@ initWithRootViewController:(UIViewController*)rootViewController
- (instancetype)initWithRootViewController:(UIViewController*)rootViewController - (instancetype)initWithRootViewController:(UIViewController*)rootViewController
NS_UNAVAILABLE; NS_UNAVAILABLE;
- (instancetype)initWithNavigationBarClass:(Class)navigationBarClass
toolbarClass:(Class)toolbarClass NS_UNAVAILABLE;
- (instancetype)initWithNibName:(NSString*)nibNameOrNil
bundle:(NSBundle*)nibBundleOrNil NS_UNAVAILABLE;
- (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE;
// Returns a new Done button for a UINavigationItem which will call // Returns a new Done button for a UINavigationItem which will call
// closeSettings when it is pressed. Should only be called by view controllers // closeSettings when it is pressed. Should only be called by view controllers
......
...@@ -249,9 +249,13 @@ initWithRootViewController:(UIViewController*)rootViewController ...@@ -249,9 +249,13 @@ initWithRootViewController:(UIViewController*)rootViewController
delegate:(id<SettingsNavigationControllerDelegate>)delegate { delegate:(id<SettingsNavigationControllerDelegate>)delegate {
DCHECK(browserState); DCHECK(browserState);
DCHECK(!browserState->IsOffTheRecord()); DCHECK(!browserState->IsOffTheRecord());
#if defined(__IPHONE_13_0) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0)
self = [super initWithRootViewController:rootViewController];
#else
self = rootViewController self = rootViewController
? [super initWithRootViewController:rootViewController] ? [super initWithRootViewController:rootViewController]
: [super init]; : [super init];
#endif
if (self) { if (self) {
mainBrowserState_ = browserState; mainBrowserState_ = browserState;
delegate_ = delegate; delegate_ = delegate;
......
...@@ -302,6 +302,7 @@ ...@@ -302,6 +302,7 @@
} }
self.bvcContainer = [[BVCContainerViewController alloc] init]; self.bvcContainer = [[BVCContainerViewController alloc] init];
self.bvcContainer.modalPresentationStyle = UIModalPresentationFullScreen;
self.bvcContainer.currentBVC = viewController; self.bvcContainer.currentBVC = viewController;
self.bvcContainer.transitioningDelegate = self.transitionHandler; self.bvcContainer.transitioningDelegate = self.transitionHandler;
BOOL animated = !self.animationsDisabledForTesting; BOOL animated = !self.animationsDisabledForTesting;
......
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
- (instancetype)initWithTable:(ChromeTableViewController*)table - (instancetype)initWithTable:(ChromeTableViewController*)table
NS_DESIGNATED_INITIALIZER; NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithRootViewController:(UIViewController*)rootViewController
NS_UNAVAILABLE;
- (instancetype)initWithNavigationBarClass:(Class)navigationBarClass
toolbarClass:(Class)toolbarClass NS_UNAVAILABLE;
- (instancetype)initWithNibName:(NSString*)nibNameOrNil - (instancetype)initWithNibName:(NSString*)nibNameOrNil
bundle:(NSBundle*)nibBundleOrNil NS_UNAVAILABLE; bundle:(NSBundle*)nibBundleOrNil NS_UNAVAILABLE;
- (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
// Fake implementations of UIDocumentInteractionController properties: // Fake implementations of UIDocumentInteractionController properties:
@property(nonatomic, copy) NSString* UTI; @property(nonatomic, copy) NSString* UTI;
@property(nonatomic, weak) id<UIDocumentInteractionControllerDelegate> delegate; @property(nonatomic, weak) id delegate;
// Whether or not this controller can present Open In... menu. Defaults to YES. // Whether or not this controller can present Open In... menu. Defaults to YES.
@property(nonatomic) BOOL presentsOpenInMenu; @property(nonatomic) BOOL presentsOpenInMenu;
......
...@@ -21,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -21,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, nullable, copy) NSURLResponse* response; @property(nonatomic, nullable, copy) NSURLResponse* response;
- (nullable instancetype)initWithURL:(NSURL*)URL NS_DESIGNATED_INITIALIZER; - (nullable instancetype)initWithURL:(NSURL*)URL NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)init NS_UNAVAILABLE; - (nonnull instancetype)init NS_UNAVAILABLE;
@end @end
......
...@@ -113,9 +113,13 @@ NSArray* Runtimes(NSDictionary* simctl_list) { ...@@ -113,9 +113,13 @@ NSArray* Runtimes(NSDictionary* simctl_list) {
NSMutableArray* runtimes = NSMutableArray* runtimes =
[[simctl_list[@"runtimes"] mutableCopy] autorelease]; [[simctl_list[@"runtimes"] mutableCopy] autorelease];
for (NSDictionary* runtime in simctl_list[@"runtimes"]) { for (NSDictionary* runtime in simctl_list[@"runtimes"]) {
BOOL available =
[runtime[@"availability"] isEqualToString:@"(available)"] ||
runtime[@"isAvailable"];
if (![runtime[@"identifier"] if (![runtime[@"identifier"]
hasPrefix:@"com.apple.CoreSimulator.SimRuntime.iOS"] || hasPrefix:@"com.apple.CoreSimulator.SimRuntime.iOS"] ||
![runtime[@"availability"] isEqualToString:@"(available)"]) { !available) {
[runtimes removeObject:runtime]; [runtimes removeObject:runtime];
} }
} }
...@@ -209,6 +213,18 @@ NSString* GetDeviceBySDKAndName(NSDictionary* simctl_list, ...@@ -209,6 +213,18 @@ NSString* GetDeviceBySDKAndName(NSDictionary* simctl_list,
return nil; return nil;
} }
// Create and a redturn a device udid of |device| and |sdk_version|.
NSString* CreateDeviceBySDKAndName(NSString* device, NSString* sdk_version) {
NSString* sdk = [@"iOS" stringByAppendingString:sdk_version];
XCRunTask* create = [[[XCRunTask alloc]
initWithArguments:@[ @"simctl", @"create", device, device, sdk ]]
autorelease];
[create run];
NSDictionary* simctl_list = GetSimulatorList();
return GetDeviceBySDKAndName(simctl_list, device, sdk_version);
}
bool FindDeviceByUDID(NSDictionary* simctl_list, NSString* udid) { bool FindDeviceByUDID(NSDictionary* simctl_list, NSString* udid) {
NSDictionary* devices_table = simctl_list[@"devices"]; NSDictionary* devices_table = simctl_list[@"devices"];
for (id runtimes in devices_table) { for (id runtimes in devices_table) {
...@@ -433,10 +449,13 @@ int main(int argc, char* const argv[]) { ...@@ -433,10 +449,13 @@ int main(int argc, char* const argv[]) {
if (udid == nil) { if (udid == nil) {
udid = GetDeviceBySDKAndName(simctl_list, device_name, sdk_version); udid = GetDeviceBySDKAndName(simctl_list, device_name, sdk_version);
if (udid == nil) { if (udid == nil) {
LogError(@"Unable to find a device %@ with SDK %@.", device_name, udid = CreateDeviceBySDKAndName(device_name, sdk_version);
sdk_version); if (udid == nil) {
PrintSupportedDevices(simctl_list); LogError(@"Unable to find a device %@ with SDK %@.", device_name,
exit(kExitInvalidArguments); sdk_version);
PrintSupportedDevices(simctl_list);
exit(kExitInvalidArguments);
}
} }
} else { } else {
if (!FindDeviceByUDID(simctl_list, udid)) { if (!FindDeviceByUDID(simctl_list, udid)) {
......
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