小编Rec*_*ect的帖子

MainActivity的requestPermission自动拒绝Android权限

在Android应用程序的主要活动中,我检查权限(Manifest.permission.MANAGE_DOCUMENTS),检测我没有它们,并调用requestPermisions.然后onRequestPermissionResult我几乎立即被拒绝许可,没有显示对话框.

我已经在同一个应用程序的另一个活动中确认了相同的权限(通过requestPermissions再次,这有效),所以我期望这个决定被存储(对于会话,或者其他),我从未选择拒绝该权限.无论哪种方式,都不会显示权限对话框,并且会自动拒绝权限.

到目前为止,我已经在Android 7和6(API 24和23)的模拟器上进行了测试.

我试过了:

我很难过......

这是权限请求(请参阅代码中的注释):

private fun askForPermissionOrSendRequest(view: View, permission: String) {
    if (checkSelfPermission(permission) == PackageManager.PERMISSION_DENIED) {
        if (shouldShowRequestPermissionRationale(permission)) {
            cachedView = view
            val explanationDialog = AlertDialog.Builder(this).setMessage("We need permissions to read your storage in order to show your profile image.").setOnDismissListener {
                requestPermissions(
                        arrayOf(permission),
                        BSMainActivity.permissionRequestSendProfilePic
                )
            }.create()
            explanationDialog.show()

        } else {
            cachedView = view
            // this branch is …
Run Code Online (Sandbox Code Playgroud)

android

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

Haskell / cabal 包的解决方法受到 Nix 和 Cabal 的限制?

我最近开始使用reflex-platform进行开发,并使用了一些与优秀的reflex-project-sculpture中描述的类似的额外配置。

现在我遇到了无法解决的包冲突。我使用与 相同的 cabal 脚本,它通过 cabal 命令以非交互模式reflex-project-skeleton调用。nix-shell

如果我尝试

./cabal new-build --allow-newer all
Run Code Online (Sandbox Code Playgroud)

我明白了

these derivations will be built:
  /nix/store/d6ji516i7pry5l6gv18y6hpj9k1bvgg5-heist-1.0.1.0.drv
  /nix/store/zj1clks7mzq8gn91ahhwa3nvpi5rwra9-snap-1.0.0.2.drv
  /nix/store/mx861972jnjabn7yxyr3y3q1yhf25jfq-snaplet-acid-state-0.2.7.drv
  /nix/store/grhp4dhavmpi6bgns5a6vdzg8ny2bsf8-hoogle-local-0.1.drv
  /nix/store/y3sszsj58f6ad3r06540w0mlr1pncd59-ghc-8.0.2-with-packages.drv

...

Configuring heist-1.0.1.0...
Setup: Encountered missing dependencies:
aeson >=0.6 && <1.2

builder for '/nix/store/d6ji516i7pry5l6gv18y6hpj9k1bvgg5-heist-1.0.1.0.drv' failed with exit code 1
cannot build derivation '/nix/store/y3sszsj58f6ad3r06540w0mlr1pncd59-ghc-8.0.2-with-packages.drv': 1 dependencies couldn't be built
Run Code Online (Sandbox Code Playgroud)

有问题的包似乎是snaplet-acid-state,所以我尝试从 nix-shell 内部安装它:

cabal install snaplet-acid-state
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: snaplet-acid-state-0.2.7 (user goal)
trying: base-4.9.1.0/installed-4.9... (dependency of …
Run Code Online (Sandbox Code Playgroud)

haskell cabal-install nix reflex-dom

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

标签 统计

android ×1

cabal-install ×1

haskell ×1

nix ×1

reflex-dom ×1