添加了Crashlytics并强制使应用程序崩溃后,iOS Simulator卡在了启动屏幕上

问题描述

我为我的Swift应用启用了Firebase Analytics和Crashlytics。但是有些奇怪的事情发生了,每当我使用模拟器使应用程序崩溃时,下次我打开应用程序时,它就会卡在启动屏幕上。但是,它在实际设备上效果很好。

这是我在构建阶段上的自定义运行脚本

import random
var = random.randint(0,99)

我还在输入文件中添加了这些脚本:

"${PODS_ROOT}/FirebaseCrashlytics/upload-symbols" -gsp "${PROJECT_DIR}/path/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"

我该如何解决此问题?

解决方法

我建议您清除派生数据并再次运行,如果它不起作用,请尝试使用以下方法:

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.util.AttributeSet;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.camera.view.PreviewView;

public class RoundedCameraPreview extends PreviewView {


    Path clipPath;
    boolean isRound;

    public RoundedCameraPreview(@NonNull Context context) {
        super(context);
    }

    public RoundedCameraPreview(@NonNull Context context,@Nullable AttributeSet attrs) {
        super(context,attrs);
    }

    public RoundedCameraPreview(@NonNull Context context,@Nullable AttributeSet attrs,int defStyleAttr) {
        super(context,attrs,defStyleAttr);
        TypedArray a = context.getTheme().obtainStyledAttributes(
                attrs,R.styleable.PreviewView,0);

        try {
            isRound = a.getBoolean(R.styleable.PreviewView_isRound,true);
        } finally {
            a.recycle();
        }
    }

    public boolean isRound() {
        return isRound;
    }

    public void setIsRound(boolean isRound) {
        this.isRound = isRound;
        invalidate();
        requestLayout();
    }

    public RoundedCameraPreview(@NonNull Context context,int defStyleAttr,int defStyleRes) {
        super(context,defStyleAttr,defStyleRes);
    }

    @Override
    protected void dispatchDraw(Canvas canvas) {
        if (isRound) {
            clipPath = new Path();
            //TODO: define the circle you actually want
            clipPath.addCircle(canvas.getWidth() / 2,canvas.getWidth() / 2,Path.Direction.CW);

            Paint paint = new Paint();
            paint.setAntiAlias(true);
            paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));

            canvas.clipPath(clipPath);
            canvas.drawPath(clipPath,paint);
        }
        super.dispatchDraw(canvas);
    }
}

代替:

"$PODS_ROOT/FirebaseCrashlytics/upload-symbols" -gsp "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...