Skip to content

Commit

Permalink
added bundleIdentifier for IOS (#8)
Browse files Browse the repository at this point in the history
* added bundleIdentifier for IOS

* fixed typo
  • Loading branch information
mmmurf authored and alvaromb committed Aug 9, 2017
1 parent 900d644 commit da9d284
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
# react-native-version-number
<img src="https://travis-ci.org/APSL/react-native-version-number.svg?branch=master" />

Returns the `CFBundleShortVersionString` and the `CFBundleVersion`. For Android, returns the `versionName` and `versionCode`.
Returns the `CFBundleShortVersionString` and the `CFBundleVersion` and `bundleIdentifier` on IOS. For Android, returns the `versionName` and `versionCode`.


| | iOS | Android | Example |
| --- | --- | --- | --- |
| appVersion | `CFBundleShortVersionString` | `versionName` | `1.0.2` |
| buildVersion | `CFBundleVersion` | `versionCode` | `42` |
| bundleIdentifier | `bundleIdentifier` | | `com.foo.bar.MyApp`|


## Getting started
Expand All @@ -27,6 +28,9 @@ import VersionNumber from 'react-native-version-number';

console.log(VersionNumber.appVersion);
console.log(VersionNumber.buildVersion);

console.log(VersionNumber.bundleIdentifier); // IOS only

```

## License
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type VersionObject = {
const VersionNumber: VersionObject = {
appVersion: RNVersionNumber.appVersion,
buildVersion: RNVersionNumber.buildVersion,
bundleIdentifier: RNVersionNumber.bundleIdentifier
}

export default VersionNumber;
5 changes: 4 additions & 1 deletion ios/RNVersionNumber.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ - (dispatch_queue_t)methodQueue
- (NSDictionary *)constantsToExport
{
return @{@"appVersion" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"],
@"buildVersion": [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]};
@"buildVersion": [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey],
@"bundleIdentifier" : [[NSBundle mainBundle] bundleIdentifier]
};

}

@end

0 comments on commit da9d284

Please sign in to comment.