kingcos / Perspective

📝 Write something with perspectives.
https://kingcos.me
185 stars 15 forks source link

iOS 开发问题解决集锦 #16

Open kingcos opened 6 years ago

kingcos commented 6 years ago

Unable to boot device in current state: Creating

Solution

# -*- coding: utf-8 -*-

import argparse
import subprocess
import re

def erase_device(device):
    status, output = subprocess.getstatusoutput('xcrun simctl list | grep \'' + device + ' (\'')
    if status == 0:
        outputs = output.split('\n')
        for output in outputs:
            simulator_udids = re.findall('[A-Z0-9-]{36}', output)
            if simulator_udids != []:
                for udid in simulator_udids:
                    subprocess.getstatusoutput('xcrun simctl erase' + udid)
                    print('Already erased ' + device + ' - UDID: ' + udid)

if __name__ == '__main__':
    iphone_64_devices = ['iPhone 5s', 'iPhone 6', 'iPhone 6 Plus', 'iPhone 6s', 'iPhone 6s Plus', 'iPhone 7', 'iPhone 7 Plus', 'iPhone 8', 'iPhone 8 Plus', 'iPhone X']
    parser = argparse.ArgumentParser()
    parser.add_argument('-d', '--device', help='Specify the simulator device, eg. iPhone X', choices=iphone_64_devices)
    args = parser.parse_args()
    if args.device is not None:
        erase_device(args.device)
    else:
        print('Please specify the device option!')

The operation couldn’t be completed. (DVTCoreSimulatorAdditionsErrorDomain error 0.)

Solution

xcrun simctl erase all

Cannot find "$(SRCROOT)/*/Info.plist"

Solution

Failed to verify bitcode in *

Solution

build_ios_app(export_options: { compileBitcode: false })

Missing password for user xxx@yyy.com, and running in non-interactive shell

Solution

No value found for 'username'

Solution

Please see Simulator Help for information on adjusting system settings to allow more simulated devices to boot at once.

Solution

sudo launchctl limit maxproc 2000 2500

在 iPhone X 及以上全面屏机型 UIWebView 的内容未填充整个视图

Solution

if #available(iOS 11.0, *) {
    webView.scrollView.contentInsetAdjustmentBehavior = .never
}