Hi,
I am in the process of migrating my app to use capacitor 3 from capacitor 2 and while the npx cap sync ios command works fine, when I try to compile the App to a target device i get the error “Extra trailing closure passed in call” in the Camera plugin as shown in the screenshot below.
The error is in the function below on the line PHPhotoLibrary.shared().presentLimitedLibraryPicker(from: viewController) { _ in
@objc func pickLimitedLibraryPhotos(_ call: CAPPluginCall) {
if #available(iOS 14, *) {
PHPhotoLibrary.requestAuthorization(for: .readWrite) { (granted) in
if granted == .limited {
if let viewController = self.bridge?.viewController {
if #available(iOS 15, *) {
PHPhotoLibrary.shared().presentLimitedLibraryPicker(from: viewController) { _ in
self.getLimitedLibraryPhotos(call)
}
} else {
PHPhotoLibrary.shared().presentLimitedLibraryPicker(from: viewController)
call.resolve([
"photos": []
])
}
}
} else {
call.resolve([
"photos": []
])
}
}
} else {
call.unavailable("Not available on iOS 13")
}
}
My setup so far as output from ionic info is as below
Ionic:
Ionic CLI : 6.20.4 (/Users/stibrewal/.nvm/versions/node/v14.15.4/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.6.1
@angular-devkit/build-angular : 12.2.18
@angular-devkit/schematics : 11.2.5
@angular/cli : 12.2.18
@ionic/angular-toolkit : 3.1.1
Capacitor:
Capacitor CLI : 3.9.0
@capacitor/android : 3.9.0
@capacitor/core : 3.9.0
@capacitor/ios : 3.9.0
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : 6.0.0, android 9.1.0, browser
Cordova Plugins : cordova-plugin-ionic-webview 4.2.1, (and 2 other plugins)
Utility:
cordova-res : 0.15.4
native-run : 1.7.1
System:
Android SDK Tools : 26.1.1 (/Users/stibrewal/Library/Android/sdk)
NodeJS : v14.15.4 (/Users/stibrewal/.nvm/versions/node/v14.15.4/bin/node)
npm : 6.14.10
OS : macOS Big Sur
Xcode : Xcode 12.5 Build version 12E262
I have tried removing and adding the @capacitor/camera plugin back but still get the same error.
Look forward to any help on how to fix this issue.
Thanks,
Sanjay.