小编GIJ*_*JOW的帖子

无法呈现和更新自动布局状态

几天前,我收到了这个错误,我完全陷入了我的项目.

这只是一个Runtime问题,我可以运行我的项目,但根本无法触摸界面构建器.

没有更改任何内容IB以启动此错误:

 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: bundleIdentifier != nil'
Run Code Online (Sandbox Code Playgroud)

我的包标识符不是nil.

这是我的日志文件

Process:               IBDesignablesAgentCocoaTouch [10742]
Path:                  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Overlays/IBDesignablesAgentCocoaTouch
Identifier:            IBDesignablesAgentCocoaTouch
Version:               8.1 (11524)
Code Type:             X86-64 (Native)
Parent Process:        launchd_sim [8117]
Responsible:           IBDesignablesAgentCocoaTouch [10742]
User ID:               501


Date/Time:             2016-11-11 18:10:08.256 -0200
OS Version:            Mac OS X 10.12.1 (16B2657)
Report Version:        12
Anonymous UUID:        544DA3C3-CD64-6444-0CE0-06F48A5B5FE9




Time Awake Since Boot: 9000 seconds


System Integrity Protection: enabled


Crashed Thread:        0


Exception …
Run Code Online (Sandbox Code Playgroud)

interface-builder autolayout swift size-classes xcode8

7
推荐指数
0
解决办法
1296
查看次数

应用内购买耗材自动恢复

我正在进行我的第一次应用内购买,一种奇怪的行为是正在恢复耗材产品而不是创建新的交易.

我跟着tuto https://www.raywenderlich.com/122144/in-app-purchase-tutorial

我发现了一种优雅的方法.

这是我的StoreKit助手:

import StoreKit

public typealias ProductIdentifier = String

public typealias ProductsRequestCompletionHandler = (_ success: Bool, _ products: [SKProduct]?) -> ()



open class IAPHelper : NSObject  {
    fileprivate let productIdentifiers: Set<ProductIdentifier>
    fileprivate var purchasedProductIdentifiers: Set<ProductIdentifier> = Set()
    fileprivate var productsRequest: SKProductsRequest?
    fileprivate var productsRequestCompletionHandler: ProductsRequestCompletionHandler?

    static let IAPHelperPurchaseNotification = "IAPHelperPurchaseNotification"

    public init(productIds: Set<ProductIdentifier>) {
        productIdentifiers = productIds
        super.init()
        SKPaymentQueue.default().add(self)
    }
}

// MARK: - StoreKit API

extension IAPHelper {

    public func requestProducts(_ completionHandler: @escaping ProductsRequestCompletionHandler) {
        productsRequest?.cancel() …
Run Code Online (Sandbox Code Playgroud)

in-app-purchase ios swift3

7
推荐指数
1
解决办法
686
查看次数

快速选择音频设备输出(如 Waze)

我正在网上挖掘,试图找到一些线索来实现这一目标,但没有成功。

我正在尝试向用户显示像 Waze 那样的弹出窗口,以允许用户选择音频输出设备、音量等。

它似乎是一些 API,因为它在 iOS11 上完全显示为声音小部件。

在此处输入图片说明

任何帮助表示赞赏。

iphone audio ios swift

6
推荐指数
1
解决办法
1147
查看次数

通过NSAttributedString进行攻击:"没有更多上下文的表达类型是不明确的"

谁能告诉我什么是错的?

let myTitle = NSAttributedString(string: Xdevices[row].deviceName!,
              attributes: [NSFontAttributeName:UIFont(name: "Georgia", size: 
              15.0)!,NSForegroundColorAttributeName:UIColor.orangeColor(), 
              NSStrikethroughStyleAttributeName: NSUnderlineStyle.StyleSingle])
Run Code Online (Sandbox Code Playgroud)

错误是:

如果没有更多的上下文,表达的类型是不明确的

这是在插入后发生的 NSStrikethroughStyleAttributeName: NSUnderlineStyle.StyleSingle

nsattributedstring swift

5
推荐指数
1
解决办法
4858
查看次数

Nginx Access-Control-Allow-Origin 不起作用

尝试通过 Ajax 访问我的 API 时出现此错误:

请求的资源上不存在“Access-Control-Allow-Origin”标头。因此,不允许访问Origin ' http://localhost:9090 '。响应具有 HTTP 状态代码 404。

我的 NGINX 配置看起来像这样,我也在使用 Varnish。

server {
    listen 127.0.0.1:8080;
    server_name api.example.cc;

    access_log /var/log/nginx/api.access.log combined;
    error_log /var/log/nginx/api.error.log;

    root /home/spark/api.example.cc/web;
    #index index.php;
    try_files $uri /index.php;

    set $cache_uri $request_uri;
    location / {
            add_header 'Access-Control-Allow-Origin' 'http://localhost:9090';
            add_header 'Access-Control-Allow-Credentials' 'true';
            add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
            add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
    }
}
Run Code Online (Sandbox Code Playgroud)

curl -X 选项 -i http://api.example.cc结果:

HTTP/1.1 204 No Content
Server: nginx/1.8.0
Date: Wed, 30 Dec 2015 20:14:27 GMT
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: …
Run Code Online (Sandbox Code Playgroud)

ajax nginx

5
推荐指数
2
解决办法
2万
查看次数

MongoDB Go 驱动程序何时不应该在本地主机上查找

我不是 Go 人,只需要使用用 Go 编写的插件,而我在插件和 MongoDB 之间遇到了一些麻烦。

错误是:

server selection error: server selection timeout
current topology: Type: Unknown
Servers:
Addr: localhost:27017, Type: Unknown, State: Connected, Avergage RTT: 0, Last error: dial tcp 127.0.0.1:27017: connect: connection refused
exit status 1
Run Code Online (Sandbox Code Playgroud)

我的配置:

time=“2019-09-03T16:29:35Z” level=debug msg=“Host: ip-XXX-XX-XX-XXX.sa-east-1.compute.internal”
time=“2019-09-03T16:29:35Z” level=debug msg=“Port: 27017”
time=“2019-09-03T16:29:35Z” level=debug msg=“Username: user”
time=“2019-09-03T16:29:35Z” level=debug msg=“Password: user123*”
time=“2019-09-03T16:29:35Z” level=debug msg=“DBName: dbBackend”
Run Code Online (Sandbox Code Playgroud)

执行连接的插件片段:

addr := fmt.Sprintf("mongodb://%s:%s", m.Host, m.Port)

to := 60 * time.Second
opts := options.ClientOptions{
    ConnectTimeout: &to,
}

opts.ApplyURI(addr)



if m.Username …
Run Code Online (Sandbox Code Playgroud)

go mongodb

3
推荐指数
1
解决办法
2044
查看次数