var date: Date = Date()
if #available(iOS 13.0, *) {
date = Date().advanced(by: TimeInterval(10000))
} else {
// Fallback on earlier versions
date = Date()
}
When building for 64 bit simulator or device only, this works correctly (e.g. debug build).
But when any 32 bit arch is contained in the architectures being built for, this fails with the following:
Value of type 'Date' has no member 'advanced'
I can workaround this with the following:
var date: Date = Date()
print(type(of: Date()))
if #available(iOS 13.0, *) {
// Why is this #if required for a release config to build?
// Shouldn't the #available check above be enough?
#if (arch(x86_64) || arch(arm64))
date = Date().advanced(by: TimeInterval(10000))
#else
date = Date()
#endif
} else {
// Fallback on earlier versions
date = Date()
}
But I think that the failure is a bug. I've attached a sample project that exhibits this issue when building for Release.
Attachment: Download
Environment
Xcode version: Have tested against 11.0 -\> 11.2 OS: 10.15.1 (19B88)Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: f2185a923bb5973aa48e49a0224601c0Issue Description:
Consider the following code:
When building for 64 bit simulator or device only, this works correctly (e.g. debug build).
But when any 32 bit arch is contained in the architectures being built for, this fails with the following:
I can workaround this with the following:
But I think that the failure is a bug. I've attached a sample project that exhibits this issue when building for Release.