Fix the break in PackageInfo (#582) * Fix the break in PackageInfo * Formatting
diff --git a/packages/package_info/example/ios/Runner/Info.plist b/packages/package_info/example/ios/Runner/Info.plist index 84e4dc8..0ba5e95 100644 --- a/packages/package_info/example/ios/Runner/Info.plist +++ b/packages/package_info/example/ios/Runner/Info.plist
@@ -2,6 +2,8 @@ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> + <key>CFBundleDisplayName</key> + <string>Package Info Example</string> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleExecutable</key>
diff --git a/packages/package_info/ios/Classes/PackageInfoPlugin.m b/packages/package_info/ios/Classes/PackageInfoPlugin.m index 3686794..5c0adbb 100644 --- a/packages/package_info/ios/Classes/PackageInfoPlugin.m +++ b/packages/package_info/ios/Classes/PackageInfoPlugin.m
@@ -15,8 +15,14 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { if ([call.method isEqualToString:@"getAll"]) { + NSString* displayName = + [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]; + // Cannot put nil into a map so return an empty string. + if (displayName == nil) { + displayName = @""; + } result(@{ - @"appName" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"], + @"appName" : displayName, @"packageName" : [[NSBundle mainBundle] bundleIdentifier], @"version" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"], @"buildNumber" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]