Skip to content

Commit 03c3678

Browse files
author
yuzheng
committed
feat: if CFBundleDisplayName and CFBundleName is null, use CFBundleExecutable as appName
1 parent e3dc771 commit 03c3678

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

TZImagePickerController.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ Pod::Spec.new do |s|
1111
s.requires_arc = true
1212
s.resources = "TZImagePickerController/TZImagePickerController/*.{png,bundle}"
1313
s.source_files = "TZImagePickerController/TZImagePickerController/*.{h,m}"
14-
s.frameworks = "Photos"
14+
s.frameworks = "Photos", "CoreServices"
1515
end

TZImagePickerController/TZImagePickerController/TZImagePickerController.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ - (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount columnNumber:(N
183183
NSDictionary *infoDict = [TZCommonTools tz_getInfoDictionary];
184184
NSString *appName = [infoDict valueForKey:@"CFBundleDisplayName"];
185185
if (!appName) appName = [infoDict valueForKey:@"CFBundleName"];
186+
if (!appName) appName = [infoDict valueForKey:@"CFBundleExecutable"];
186187
NSString *tipText = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@"Allow %@ to access your album in \"Settings -> Privacy -> Photos\""],appName];
187188
_tipLabel.text = tipText;
188189
[self.view addSubview:_tipLabel];

TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,8 @@ - (void)takePhoto {
645645
// 无权限 做一个友好的提示
646646
NSString *appName = [infoDict valueForKey:@"CFBundleDisplayName"];
647647
if (!appName) appName = [infoDict valueForKey:@"CFBundleName"];
648-
648+
if (!appName) appName = [infoDict valueForKey:@"CFBundleExecutable"];
649+
649650
NSString *message = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@"Please allow %@ to access your camera in \"Settings -> Privacy -> Camera\""],appName];
650651
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSBundle tz_localizedStringForKey:@"Can not use camera"] message:message delegate:self cancelButtonTitle:[NSBundle tz_localizedStringForKey:@"Cancel"] otherButtonTitles:[NSBundle tz_localizedStringForKey:@"Setting"], nil];
651652
[alert show];

0 commit comments

Comments
 (0)