我正在观看这个WWDC18的演讲,他们明确宣布他们将允许开发人员同时连接一个Sandbox帐户进行IAP测试 - 在开发者模式和iOS12中.
它们显示该功能的时刻的屏幕截图

直截了当的问题:
我试图从我的iPhone 6S和iPhone X上访问它 - 都在iOS 12上 - 但是在屏幕的末尾都没有这个选项.此外,我搜索了这个主题,似乎没有人解决这个问题.
我的设备上有"Apple ID> iTunes&App Stores"

这个功能令人难以置信,因为它不需要注销我们的Apple ID - 这是一个巨大的痛苦.
测试说明:我试图在我的设备上更改区域和语言 - 两者都不成功.
快速介绍我的场景:我有一个 VPC,其中包含一个 API 网关,该网关将其调用重定向到我的 Lambda 函数,然后它们访问 RDS 实例和外部 API 调用(互联网访问)。
由于函数需要访问 RDS,我将 RDS 和 Lambdas 放在同一个 VPC 中,在没有公开访问的情况下正确保护 RDS。现在,由于 Lambda 位于 VPC 中,因此它们需要一个 NAT 网关来访问互联网(几乎所有这些功能都需要调用第三方 API),这就是我面临的一个巨大问题。
我有一个小项目为几个用户(从 10 到 200 个用户不等)提供服务,并且使用我创建的无服务器设置,我预计每个月的费用为 3.00 美元到 10.00 美元。这是成本没有一个单一的NAT网关。现在,如果我们加上网关的价格,即每小时 0.045 美元- 我什至没有考虑每 GB 传输的数据 0.045 美元 -每月超过 30 美元。如果我不创建另一个多可用区并减轻可能的可用区故障,我会很愚蠢 - 所以2 个 NAT 网关 > 60.00 美元。
这不仅对我来说不切实际,而且它不会也使通常遵循按需方法的整个无服务器结构的要点无效吗?
我的替代方法之一是将 Lambdas 移出 VPC(意味着没有 VPC)并通过某种机制访问 RDS,而不使其公开访问 - 这也是我失败的地方,如何安全地访问 RDS …
我正在研究iOS 13的新CoreNFC功能,并且正在努力使NFCTagReaderSession工作。设置权利并实例化NFCTagReaderSession和委托之后,我尝试通过调用来启动会话nfcTagReaderSession?.begin()。我的会话立即因以下错误而失效:
Error Domain=NFCError Code=2 "Missing required entitlement" UserInfo={NSLocalizedDescription=Missing required entitlement}
我在这里查看了我的权利文件的文档:https : //developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_nfc_readersession_formats
我还在Info.plist中添加了相应的“隐私-NFC扫描使用说明”。
有人让这个工作了吗?这仅仅是Xcode 11或iOS 13的问题吗?
这是我的ViewController中的代码:
import UIKit
import CoreNFC
class ViewController: UIViewController {
var nfcTagReaderSession: NFCTagReaderSession?
override func viewDidLoad() {
super.viewDidLoad()
nfcTagReaderSession = NFCTagReaderSession(pollingOption: [.iso14443, .iso15693, .iso18092], delegate: self)
nfcTagReaderSession?.begin()
print("isReady: \(nfcTagReaderSession?.isReady)")
}
}
extension ViewController: NFCTagReaderSessionDelegate {
func tagReaderSessionDidBecomeActive(_ session: NFCTagReaderSession) {
print("Tag reader did become active")
}
func tagReaderSession(_ session: NFCTagReaderSession, didInvalidateWithError error: Error) {
print("\(error)")
}
func tagReaderSession(_ session: NFCTagReaderSession, …Run Code Online (Sandbox Code Playgroud) DateComponentsFormatter因此,我在只需要格式化给定 的纳秒的情况下使用 a TimeInterval。问题是它不能按预期工作,或者我在这里混淆了一些我不知道的东西。
这里有 3 个快速测试来说明我所说的内容。
let fooFormatter = DateComponentsFormatter()
fooFormatter.allowedUnits = [.second, .nanosecond]
fooFormatter.unitsStyle = .full
fooFormatter.collapsesLargestUnit = true
fooFormatter.allowsFractionalUnits = true
print(fooFormatter.string(from: 42.42424242424242424242424242424242))
Run Code Online (Sandbox Code Playgroud)
输出:Optional("42 seconds")。
预期:因为这会折叠“最大单位”(在本例中为秒),所以预计会类似于(Optional("42.42424242424242424242424242424242 * 1e^9"))。
let fooFormatter = DateComponentsFormatter()
fooFormatter.allowedUnits = [.second, .nanosecond]
fooFormatter.unitsStyle = .full
fooFormatter.allowsFractionalUnits = true
print(fooFormatter.string(from: 42.42))
Run Code Online (Sandbox Code Playgroud)
输出:Optional("42 seconds")。
预期:即使没有选择不崩溃.second,我的预期也接近(Optional("42 seconds 0.42 * 1e^9 nanoseconds"))。
let fooFormatter = DateComponentsFormatter()
fooFormatter.allowedUnits = …Run Code Online (Sandbox Code Playgroud) time nsdateformatter nsdatecomponents swift nsdatecomponentsformatter
我目前正在制作一个 API,我希望 type 的可选值永远T不能为空(当然启用空安全)。
让我们用以下例子来举例说明:
void main() {
T nonNullableGeneric<T>(T value) {
if(value == null) {
throw 'This is null';
}
return value;
}
nonNullableGeneric(1); // Works fine
nonNullableGeneric(null); // Works fine BUT I would like that the type inference would not allow a nullable value
// Now this works as expected:
// "the argument type 'Null' can't be assigned to the parameter type 'int'."
//
// ... but I have to specify the type `T`, which …Run Code Online (Sandbox Code Playgroud)