iOS 开发交流

Xcode 10 更新

2018-12-03  本文已影响22人  Mr__Peng__
概览

Xcode 10 包含SDK iOS 12 ,watchOS 5, macOS 10.14,tvOS 12. 支持调试iOS 8和更高版本,tvOS 9和更高版本,watchOS 2 和更高版本,需要Mac运行在macOS 10.13.6或更高版本

General
新功能
已知问题
解决问题
Apple Clang Compiler
新功能
解决问题
Asset Catalog
新功能
解决问题
Build System

查看 Build System Release Notes for Xcode 10

Command Line Tools
新功能
Create ML
新功能
已知问题
解决问题
Debugging
新功能
解决问题

-Memory Gauge Report现在可以在所有平台上一致地报告物理足迹。

Deprecation Notices
Deprecations
Devices
已知问题
Documentation Viewer
新功能
Instruments
新功能
已知问题
解决问题
Interface Builder

Interface Builder Release Notes for Xcode 10

Localization
新功能
解决问题
Metal
新功能
Playgrounds
新功能
已知问题
解决问题
Refactoring
解决问题
Server
解决问题
Signing and Distribution
新功能
Simulator
新功能
已知问题
Source Control
新功能
已知问题
解决问题
Source Editor

Source Editor Release Notes for Xcode 10

Static Analyzer
新功能
+ (NSString *)requestCurrentTaskName {
    __block NSString *taskName = nil;
    dispatch_semaphore_t sema = dispatch_semaphore_create(0);
    NSXPCConnection *connection =
      [[NSXPCConnection alloc]
        initWithServiceName:@"MyConnection"];
    id remoteObjectProxy = connection.remoteObjectProxy;
    [remoteObjectProxy requestCurrentTaskName:^(NSString *task) {
        taskName = task;
        dispatch_semaphore_signal(sema);
    }];
    dispatch_semaphore_wait(sema,
        dispatch_time(DISPATCH_TIME_NOW, 100)
    );
    return taskName;
}

此类模式可能会降低性能并导致应用程序挂起。 默认情况下,该检查当前处于禁用状态,但可以使用building setting设置“Performance Anti-Patterns with Grand Central Dispatch”来启用该检查

Swift

Swift 4.2 Release Notes for Xcode 10

Testing
新功能
func testFoo() {
    let expectation1 = self.expectation(description: "expectation1")
    doSomething { expectation1.fulfill() }
    XCTWaiter().wait(for: [expectation1], timeout: 1)
 
    let expectation2 = self.expectation(description: "expectation2")
    doSomething { expectation2.fulfill() }
 
    // API Violation exception because it waits on both expectations,
    // but expectation1 has already been waited on.
    self.waitForExpectations(timeout: 1)
}

两种修复的可能

func testFoo_fix1() {
    let expectation1 = self.expectation(description: "expectation1")
    doSomething { expectation1.fulfill() }
    XCTWaiter().wait(for: [expectation1], timeout: 1)

    let expectation2 = self.expectation(description: "expectation2")
    doSomething { expectation2.fulfill() }

    // Only wait on expectation2, which has not yet been waited on.
    self.wait(for: [expectation2], timeout: 1)
}
 
func testFoo_fix2() {
    // Create an XCTestExpectation directly, not using XCTestCase convenience API.
    let expectation1 = XCTestExpectation(description: "expectation1")
    doSomething { expectation1.fulfill() }
    XCTWaiter().wait(for: [expectation1], timeout: 1)

    let expectation2 = self.expectation(description: "expectation2")
    doSomething { expectation2.fulfill() }

    self.waitForExpectations(timeout: 1) // Waits only for expectation2.
}
解决问题
上一篇 下一篇

猜你喜欢

热点阅读