小编use*_*205的帖子

tony million Reachability说连接时无法访问

我搜索过但没有找到像我这样的问题.我确定这是我看过的东西.

我正在使用tony million的可达性块方法.当我有互联网然后没有互联网时它工作得很好.警报出现并且工作得很好.

但是,当我没有互联网然后我上网时会弹出相同的警报

我的代码是

-(void)reachabilityBlock
{
// allocate a reachability object
Reachability * reach = [Reachability reachabilityWithHostname:@"www.google.com"];

// tell the reachability that we DONT want to be reachable on 3G/EDGE/CDMA
reach.reachableOnWWAN = YES;


reach.reachableBlock = ^(Reachability * reachability)
{
    dispatch_async(dispatch_get_main_queue(), ^{
        //NSLog(@"REACHABLE! block");
        [self newsTableViewRefresher];
    });
};

reach.unreachableBlock = ^(Reachability * reachability)
{

        dispatch_async(dispatch_get_main_queue(), ^{
            //NSLog(@"UNREACHABLE! block");

            UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"No Network found!"
                                                            message: @"You have no wifi or cellular connection available. Please connect to a …
Run Code Online (Sandbox Code Playgroud)

xcode uialertview reachability ios

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

在Firebase云功能中创建PDF

我是javascript的新手,我正在尝试使用pdfkit从firebase函数制作PDF文件.下面是我的功能代码.

const pdfkit = require('pdfkit');
const fs = require('fs');

exports.PDFTest = functions.https.onRequest((req, res) => {

var doc = new pdfkit();

var loremIpsum = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam in...';  

doc.y = 320;
doc.fillColor('black')
doc.text(loremIpsum, {
paragraphGap: 10,
indent: 20,
align: 'justify',
columns: 2
});  

doc.pipe( res.status(200) )

});
Run Code Online (Sandbox Code Playgroud)

该函数启动但发生超时错误.这是在firebase中创建pdf文件的最佳方式吗?我有一些html,我想做成一个PDF文件.

javascript pdf firebase google-cloud-functions

9
推荐指数
2
解决办法
6857
查看次数

iOS 13 中的条形按钮色调颜色

在 iOS 13 中,他们改变了导航栏颜色的操作方式。现在他们使用 UINavigationBarAppearance 和 UIBarButtonItemAppearance 来自定义导航栏,以及 standardAppearance 和 scrollEdgeAppearance。

我正在寻找一种方法来为standardAppearance 和scrollEdgeAppearance 设置不同的导航栏色调颜色。或者能够为每个外观更改条形按钮图标颜色。

        //set the standard nav bar appearance
        let navBarAppearance = UINavigationBarAppearance()
        navBarAppearance.configureWithOpaqueBackground()
        navBarAppearance.titleTextAttributes = [.foregroundColor: UIColor.white]
        navBarAppearance.largeTitleTextAttributes = [.foregroundColor: UIColor.white]
        navBarAppearance.backgroundColor = UIColor.mainAppColorForNavBar

        //set bar button appearance
        let buttonAppearance = UIBarButtonItemAppearance()
        buttonAppearance.normal.titleTextAttributes = [.foregroundColor : UIColor.white]
        navBarAppearance.buttonAppearance = buttonAppearance

        UINavigationBar.appearance(whenContainedInInstancesOf: [UINavigationController.self]).standardAppearance = navBarAppearance



        //set the scroll edge nav bar appearance
        let scrollNavBarAppearance = UINavigationBarAppearance()
        scrollNavBarAppearance.configureWithOpaqueBackground()
        scrollNavBarAppearance.titleTextAttributes = [.foregroundColor: UIColor.label]
        scrollNavBarAppearance.largeTitleTextAttributes = [.foregroundColor: UIColor.label]

        //set bar button appearance …
Run Code Online (Sandbox Code Playgroud)

uinavigationcontroller ios swift ios13

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

Firebase 崩溃报告已隐藏

我将 Firebase 用于我的崩溃报告,我在 Xcode 中有一个运行脚本,用于上传我的 dsym 文件。

今天,我在 firebase 中有一份崩溃报告,但堆栈跟踪中有这些行,这些行只是说隐藏在您希望从代码中看到导致崩溃的行的位置。

如何摆脱这些“隐藏”行并显示真实的代码行?
下面是我的 firebase 崩溃报告的样子。

1 MyAppName __hidden#483_ (__hidden#9327_:64)
2 MyAppName __hidden#483_ (__hidden#9327_:64)
3 MyAppName __hidden#483_ (__hidden#9327_)
4 Foundation _decodeObjectBinary + 418924
5 Foundation -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 446284
6 etc....
Run Code Online (Sandbox Code Playgroud)

谢谢你。

ios firebase swift firebase-crash-reporting

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

Stripe - 创建或更新订阅时 PaymentIntent 为空

我是 Stripe 的新手,所以如果我遗漏了什么,请提供建议。

技术栈:React(前端)节点(后端)

我正在尝试创建或更新 Stripe 订阅,在任何一种情况下,我都会得到一个 null paymentIntent。我想我读到我应该检查 paymentIntent 状态以确保订阅的付款已经完成。

我的订阅工作流程,当用户注册时,我创建一个 Stripe 客户并将他们添加到订阅中。此订阅是免费套餐,因此不需要付款方式。该payment_intent为空。

//create a Stripe customer code here
...

//create the subscription 
const subscription = await stripe.subscriptions.create({
    customer: customer.id,
    items: [{ priceID }],
    expand: ['latest_invoice.payment_intent'],
});

const invoice = subscription.latest_invoice as Stripe.Invoice;
const payment_intent = invoice.payment_intent as Stripe.PaymentIntent;
Run Code Online (Sandbox Code Playgroud)

后来他们想升级到付费计划后,我申请了一张信用卡并将他们当前的订阅升级到付费计划。在前端,我使用 Stripe Element 并通过这样做创建付款方式。

if (!elements || !stripe) {
     return 
}

const cardElement = elements.getElement(CardElement);

if (!cardElement) {
     return
}

// Confirm Card Setup
const { 
     error, 
     paymentMethod …
Run Code Online (Sandbox Code Playgroud)

node.js stripe-payments reactjs

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

无法使用Kotlin访问EditText或其他UI组件

我正在使用Android Studio 3.0 RC2和Kotlin.

当我尝试访问UI组件时,应用程序崩溃,除非我首先编写findViewById.我以为Kotlin应该摆脱不得不写findViewById线?UI是一个fragment,我试图从相同的fragment代码访问.有没有办法不用写findViewById?

这些行有效:

var userNameField = view?.findViewById<EditText>(R.id.userNameTextField) as EditText
userNameField.setText("hello world")
Run Code Online (Sandbox Code Playgroud)

没有findViewById行,此行不起作用

userNameTextField.setText("hello world")
Run Code Online (Sandbox Code Playgroud)

我甚至有

import kotlinx.android.synthetic.main.fragment_sign_in.*
Run Code Online (Sandbox Code Playgroud)

onCreateView()代码:

 override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?,
                          savedInstanceState: Bundle?): View? {
    // Inflate the layout for this fragment
    var view = inflater!!.inflate(R.layout.fragment_sign_in, container, false)

    var userNameField = view?.findViewById<EditText>(R.id.userNameTextField) as EditText
    userNameField.setText("hello world")

    return view
}
Run Code Online (Sandbox Code Playgroud)

android kotlin kotlin-extension android-studio-3.0

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