小编Tar*_*epp的帖子

以编程方式在swift中的特定时间删除地址簿中的联系人

我试图以编程方式在特定时间从地址簿中删除联系人.甚至可以在Swift中使用Apple吗?我已经熟悉了,CNContactStore因为我已经开始在电话簿中添加联系人了.授予访问联系人等的权限.但我不知道如何以特定时间以编程方式从地址簿(永远)中删除联系人.

任何帮助表示赞赏!

ios swift contacts-framework

4
推荐指数
1
解决办法
3778
查看次数

Vuetify 文本字段附加槽内的按钮点击

我正在尝试创建v-text-field带有名为插槽append且插槽包含按钮的 Vuetify。一切工作正常,除了我的点击点击按钮并聚焦text-field在移动打开键盘上。

这是我的文本字段组件

<v-text-field
    class="search-input"
    solo
    hide-details
    rounded
    elevation-12
    :placeholder="searchFieldPlaceholder"
    aria-label="Search"
    @input="searchDidChange"
  >
    <slot slot="append" name="end" />
</v-text-field>
Run Code Online (Sandbox Code Playgroud)

这是我的按钮,其中包含@click.stop当我调用文本字段组件时

<template v-slot:end>
    <v-btn
      text
      icon
      class="ml-2"
      aria-label="List view"
      @click.stop="gridView = !gridView"
    >
      <v-icon>view_list</v-icon>
    </v-btn>
</template>
Run Code Online (Sandbox Code Playgroud)

我的问题是我应该如何阻止按钮在内部传播v-text-field?我也尝试过@click.native,效果是一样的。文档还提到了@click:append但这会破坏我的组件槽逻辑,然后我应该开始使用预定义的道具,这不是我想要的。

javascript vue.js vuetify.js

4
推荐指数
1
解决办法
1万
查看次数

Liquid 警告:Liquid 语法错误:应为 end_of_string,但在

我正在使用这行代码

<img data-animate="zoomIn" srcset="{{ 'device1.png' | asset_path | magick:resize:549x395 magick:quality:100 }} 1024w, {{ 'device1.png' | asset_path | magick:resize:280x201magick:quality:100 }} 640w" src="{{ 'device1.png' | asset_path | magick:resize:549x395 magick:quality:100 }}" alt="Mac" style="width: 100%; top: 0; left: 0;">
Run Code Online (Sandbox Code Playgroud)

但我收到了这样的液体错误

液体警告:液体语法错误:应为 end_of_string,但在“{{ 'device1.png' | asset_path | magick:resize:549x395 magick:quality 中找到了 id

你能帮我用正确的语法吗?

提前致谢。卡洛斯·维埃拉

syntax liquid

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

Firebase电子邮件验证不会验证帐户

我检查了用户是否通过电子邮件进行了验证.但是,无论我发送多少封电子邮件并确认,验证状态仍然存在false.我在检查时做错了什么?

FIRAuth.auth()?.addStateDidChangeListener({ (auth, user) in
            if (auth.currentUser?.isEmailVerified)!{
                let mainStoryboard: UIStoryboard = UIStoryboard(name:"Main",bundle:nil)

                let NewPostViewController: UIViewController = mainStoryboard.instantiateViewController(withIdentifier: "NewPostViewController")

                //Send the user to the LoginViewController
                self.present(NewPostViewController, animated: true, completion: nil)
            }else{
                let alertVC = UIAlertController(title: "Error", message: "Sorry. Your email address has not yet been verified. Do you want us to send another verification email to \(self.currentUser.generalDetails.email).", preferredStyle: .alert)
                let alertActionOkay = UIAlertAction(title: "Okay", style: .default) {
                    (_) in
                    FIRAuth.auth()?.currentUser?.sendEmailVerification(completion: nil)

                }
                let alertActionCancel = UIAlertAction(title: "Cancel", style: .default, …
Run Code Online (Sandbox Code Playgroud)

ios firebase swift firebase-authentication

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

RestSharp 中针对 Twitter API GET 和 POST 方法的 OAuth1 身份验证

使用 Postman,我可以API使用 Postman 的 OAuth 1.0 授权成功地使用 Twitter 查询和创建定制受众。然而,当尝试使用 RestSharp 执行相同操作时,我收到未经授权的错误。

“UNAUTHORIZED_ACCESS”-“此请求未经过正确身份验证”。

我的GET请求身份验证正常,但 POST 请求失败。

        _twitterRestClient = new RestClient("https://ads-api.twitter.com/1")
        {
            Authenticator = OAuth1Authenticator.ForProtectedResource(ConsumerKey, ConsumerSecret, AccessToken, AccessSecret)
        };

        var restRequest1 = new RestRequest(string.Format("/accounts/{0}/tailored_audiences", TwitterAccountId), Method.GET);
        //this works and gives me a list of my tailored audiences
        var response1 = _twitterRestClient.Execute(restRequest1);

        var restRequest2 = new RestRequest(string.Format("/accounts/{0}/tailored_audiences?name=SampleAudience2&list_type=EMAIL", TwitterAccountId), Method.POST);
        // this results in an "Unauthorized" status code , and the message {\"code\":\"UNAUTHORIZED_ACCESS\",\"message\":\"This request is not properly authenticated\"}
        var response2 …
Run Code Online (Sandbox Code Playgroud)

twitter restsharp oauth-1.0a

2
推荐指数
1
解决办法
3239
查看次数

将水平渐变添加到边线

我在我的视图中创建了简单的边界线.但是我正在努力为它提供水平渐变背景颜色.我该怎么办?

我试过这样但它只是将颜色设置为白色:

    let border = CAGradientLayer()
    border.frame = CGRect(x: 0, y: self.mainView.frame.height - 2, width: self.mainView.frame.width, height: 2)
    border.backgroundColor = UIColor.gray.cgColor
    let color1 = UIColor.black.withAlphaComponent(0.1).cgColor as CGColor
    let color2 = UIColor.white.withAlphaComponent(0.9).cgColor as CGColor
    border.locations = [0.60, 1.0]// Are these right coordinates?
    border.colors = [color2, color1]
Run Code Online (Sandbox Code Playgroud)

swift

2
推荐指数
1
解决办法
3209
查看次数

Laravel 数据库迁移架构构建器自定义列类型

我正在尝试使用 Laravel 创建迁移,但我处于一种需要自定义列类型的情况,因为我想要的列类型不包含在模式构建器中,即“POLYGON”。所以我想知道如何创建自定义列类型,而不是架构生成器中已有的列类型。

我想要的 SQL 语句如下所示:

更改表xxx添加polygonPOLYGON 不为空

是否可以自己做,或者我被迫使用这样的

我知道我可以这样做:

DB::statement('ALTER TABLE country ADD COLUMN polygon POLYGON');
Run Code Online (Sandbox Code Playgroud)

但这导致我出现该表不存在的错误。

laravel laravel-schema-builder

2
推荐指数
1
解决办法
1631
查看次数

当密钥根据用户输入更改时,如何从 json 解码变量?

我正在尝试使用Swift 4解析来自CoinmarketCap 的一些 JSON 响应。JSONDecoder()但问题是来自 json 的响应正在根据用户输入而变化。例如,如果用户想要欧元的价格,输出如下:

[
    {
        "price_eur": "9022.9695444"
    }
]
Run Code Online (Sandbox Code Playgroud)

但如果用户想要以英镑为单位的价格:

[
    {
        "price_gbp": "7906.8032145"
    }
]
Run Code Online (Sandbox Code Playgroud)

所以问题是Decodable如果变量(json键)名称发生变化,我应该如何制作继承自的结构?

json swift swift4 codable jsondecoder

2
推荐指数
1
解决办法
1353
查看次数

如何编码Realm的List <>类型

我正在尝试将我的Realm数据库编码为JSON.除List<>编码外,一切正常.所以我的问题是,你将如何编码List<>?因为List不符合Encodable更好的可解码协议.

现在我这样做:

@objcMembers class User: Object, Codable{
    dynamic var name: String = ""
    let dogs = List<Dog>()


    private enum UserCodingKeys: String, CodingKey {
        case name
        case dogs
    }

    convenience init(name: String) {
        self.init()
        self.name = name
    }

    func encode(to encoder: Encoder) throws {
        var container = encoder.container(keyedBy: UserCodingKeys.self)
        try container.encode(name, forKey: .name)

    }



@objcMembers class Dog: Object, Codable{
    dynamic var name: String = ""
    dynamic var user: User? = nil …
Run Code Online (Sandbox Code Playgroud)

realm swift

2
推荐指数
1
解决办法
1007
查看次数

Firebase 消息传递 onMessage 仅在窗口中可用

我在我的项目中实现了 Firebase Cloud Messaging 来发送和接收推送通知。我可以接收推送通知,但我无法使通知事件起作用。具体来说,我想让onMessage事件工作,但由于某种原因,它给了我这个错误:

消息传递:此方法在 Window 上下文中可用。(消息/仅在窗口中可用)。

这是我的消息服务工作者:

// Give the service worker access to Firebase Messaging.
// Note that you can only use Firebase Messaging here, other Firebase libraries
// are not available in the service worker.
importScripts('https://www.gstatic.com/firebasejs/6.3.4/firebase-app.js')
importScripts('https://www.gstatic.com/firebasejs/6.3.4/firebase-messaging.js')

// Initialize the Firebase app in the service worker by passing in the
// messagingSenderId.
firebase.initializeApp({
  messagingSenderId: 'XXXXXXXX'
})

// Retrieve an instance of Firebase Messaging so that it can handle background
// messages.
const messaging = …
Run Code Online (Sandbox Code Playgroud)

javascript firebase vue.js firebase-cloud-messaging vuejs2

2
推荐指数
1
解决办法
1493
查看次数

搜索栏取消按钮仅在iPad上不可见

首先,我想说我没有找到任何好的答案Swift.我创造了search bar.在按钮上单击它显示并在取消它隐藏searchbar.它工作正常,取消按钮是可见的所有iPhones,但由于某种原因不能iPad.应该导致什么?

这就是我创建的方式searchbar:

//Create searchbar
    func createSearchBar(){

        searchBar.showsCancelButton = true
        searchBar.tintColor = UIColor(red:0.184, green:0.996, blue:0.855, alpha:1.00)
        searchBar.placeholder = "Search brands"
        searchBar.delegate = self



        searchBar.hidden =  false
        searchBar.alpha = 0

        navigationItem.titleView = searchBar
        navigationItem.setLeftBarButtonItem(menuButton, animated: true)
        navigationItem.setRightBarButtonItem(searchButtton, animated: true)


        UIView.animateWithDuration(0.5, animations: {
            self.searchBar.alpha = 1
            }, completion: { finished in
                self.searchBar.becomeFirstResponder()
        })


    }
Run Code Online (Sandbox Code Playgroud)

uisearchbar ipad swift

1
推荐指数
2
解决办法
2424
查看次数

在Vue中使用箭头键选择div元素

我正在尝试使用箭头键浏览 div 元素。我知道如何在 JavaScript 中实现它,但是我正在努力做到“vue 方式”。我知道不应该有任何差异,但它根本不起作用。

我已经为你制作了沙箱来检查发生了什么。如果我不使用Vue,它就可以工作

在 Vue 中,由于这一行,我收到以下错误:

无法读取 null 的属性“焦点”

document.activeElement.parentNode.previousSibling.firstChild.focus();
Run Code Online (Sandbox Code Playgroud)

谁能告诉我我做错了什么?是v-for错误来源还是有其他问题?

javascript vue.js vuejs2

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