Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

adding nil check #1072

Merged
merged 8 commits into from
Jan 14, 2019
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/package_info/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.3

* Fixed a crash on IOS when some of the package infos are not available.

## 0.3.2

* Updated Gradle tooling to match Android Studio 3.1.2.
Expand Down
15 changes: 6 additions & 9 deletions packages/package_info/ios/Classes/PackageInfoPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,14 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {

- (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" : displayName,
@"packageName" : [[NSBundle mainBundle] bundleIdentifier],
@"version" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"],
@"appName" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]
?: [NSNull null],
@"packageName" : [[NSBundle mainBundle] bundleIdentifier] ?: [NSNull null],
@"version" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]
?: [NSNull null],
@"buildNumber" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]
?: [NSNull null],
});
} else {
result(FlutterMethodNotImplemented);
Expand Down
2 changes: 1 addition & 1 deletion packages/package_info/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Flutter plugin for querying information about the application
package, such as CFBundleVersion on iOS or versionCode on Android.
author: Flutter Team <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/package_info
version: 0.3.2
version: 0.3.3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


flutter:
plugin:
Expand Down