Reputation: 519
I am using the permission_handler package. The version is 9.0.1.
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFNITIONS'] ||=[
'$(inherited)',
'PERMISSION_CAMERA=1',
'PERMISSION_PHOTOS=1'
]
end
end
end
My Podfile is the same as above.
<key>NSCameraUsageDescription</key>
<string>blahblahblah!</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>blahblahblah!</string>
I also put values in NSCameraUsageDescription and NSPhotoLibraryUsageDescription in info.plist.
var photoPermission = await Permission.photos.status;
if (!photoPermission.isGranted) {
await Permission.photos.request();
}
When debugging while setting a breakpoint, I can see the program entering the await Permission.photos.request();
code. However, the permission request window does not appear.
I also looked for the package's GitHub issue page, but couldn't solve it.
Please help me.
Upvotes: 0
Views: 575
Reputation: 4037
Seems like the third library Compiling wield, It works fine by editing the iOS plugin part source code a little
seen from the source code:
in file PhotoPermissionStrategy.h
#import <Foundation/Foundation.h>
#import "PermissionStrategy.h"
#if PERMISSION_PHOTOS
#import <Photos/Photos.h>
@interface PhotoPermissionStrategy : NSObject <PermissionStrategy>
-(instancetype)initWithAccessAddOnly:(BOOL) addOnly;
@end
#else
#import "UnknownPermissionStrategy.h"
@interface PhotoPermissionStrategy : UnknownPermissionStrategy
@end
#endif
turn the above into
#import <Foundation/Foundation.h>
#import "PermissionStrategy.h"
#if 1
#import <Photos/Photos.h>
...
And in file PhotoPermissionStrategy.m
turn
#import "PhotoPermissionStrategy.h"
#if PERMISSION_PHOTOS
@implementation PhotoPermissionStrategy{
bool addOnlyAccessLevel;
}
...
to
#import "PhotoPermissionStrategy.h"
#if 1
@implementation PhotoPermissionStrategy{
bool addOnlyAccessLevel;
}
...
easy to debug by logging the source code
Upvotes: 1