Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XCode build error: Ambiguous use of 'subscript(_:)' #295

Open
fabioz23 opened this issue Dec 6, 2020 · 7 comments
Open

XCode build error: Ambiguous use of 'subscript(_:)' #295

fabioz23 opened this issue Dec 6, 2020 · 7 comments
Labels

Comments

@fabioz23
Copy link

fabioz23 commented Dec 6, 2020

Bug report

Description

  • What did you do?
    New Ionic 5 Angular/Capacitor project with this plugin.
  • What did happen?
    Xcode build fails with: Ambiguous use of 'subscript(_:)'
  • What did you expect to happen?
    complete build

Environment

  • Plugin version
    4.0.1
  • Build environment (cordova info)

Ionic:

Ionic CLI : 6.12.0 (/Users/fabio/.nvm/versions/node/v10.21.0/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.5.0
@angular-devkit/build-angular : 0.1100.2
@angular-devkit/schematics : 11.0.2
@angular/cli : 11.0.2
@ionic/angular-toolkit : 3.0.0

Capacitor:

Capacitor CLI : 2.4.3
@capacitor/core : 2.4.3

Utility:

cordova-res (update available: 0.15.2) : 0.15.1
native-run : 1.2.2

System:

NodeJS : v10.21.0 (/Users/fabio/.nvm/versions/node/v10.21.0/bin/node)
npm : 6.14.4
OS : macOS Catalina


### Logs

![error](https://user-images.githubusercontent.com/729310/101287640-bc41b180-37f1-11eb-85c9-a98de9405ecb.JPG)
@fabioz23 fabioz23 added the bug label Dec 6, 2020
@fabioz23
Copy link
Author

fabioz23 commented Dec 6, 2020

error

@fabioz23
Copy link
Author

a valid fix can be changing AnyObject to a more fitted class on all occurrencies?

for example, at row 142 what kind of object is the 1st array element of commands.arguments[0] ?

@NiklasMerz
Copy link
Owner

Would you mind opening a pull request for that? This would help a lot for reviewing and testing.

@fabioz23
Copy link
Author

fabioz23 commented Dec 11, 2020

i've tried to debug in Xcode but placing some breakpoint inside the involved functions with swift errors (commenting rows with errors).

i've seen that in normal use (open app and unlock with touchID) these functions are not called.

And i don't know in which use case they are called.

@jsBiztech
Copy link

I am facing the same issue. Is there any update?

@jsBiztech
Copy link

Hi @fabioz23 , @NiklasMerz ,
I changed the following line

let data = command.arguments[0] as AnyObject?;

To

let args = command.arguments as? [[String: Any]];
let data  = args?[0];

I haven't tested it yet but seems to remove error for now.

Hope this helps.

@fabioz23
Copy link
Author

fabioz23 commented Jan 8, 2021

I've tried and it works, thanks.

BTW i don't know when these parts are involved on.
until yesterday I had set the variables to a static value (false) and it worked the same

let data  = command.arguments[0] as AnyObject?;
        var pluginResult: CDVPluginResult
        do {
            let secret = Secret()
            try? secret.delete()
            let invalidateOnEnrollment = false
...
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants