react-native-version icon indicating copy to clipboard operation
react-native-version copied to clipboard

Not updating project.pbxproj?

Open GrabbenD opened this issue 5 years ago • 5 comments

The CURRENT_PROJECT_VERSION entries in ios/{project_name}.xcodeproj/project.pbxproj aren't being updated when the package is executed. Is there anything that we can do about that?

GrabbenD avatar Oct 06 '20 18:10 GrabbenD

Found the issue. It's due to target.name === appPkg.name condition. The solution is to update "name": in the main package.json to match the prefix of the project folder in ios/ directory. E.g "name": "MyProject" if you've got ios/MyProject.xcodeproj. It's not ideal since in our case it's not following the lowercase convention but it's okay. https://github.com/stovmascript/react-native-version/blob/f5577a25951c68bc4a6cc638a6b1aa5045b469af/index.js#L402

GrabbenD avatar Oct 06 '20 19:10 GrabbenD

I guess we could change this condition to always test both properties after converting them .toLowerCase(). Do you want to make a PR?

stovmascript avatar Oct 07 '20 10:10 stovmascript

This check also means it won't work for multiple targets. It updates both Info.plist files but only one of the targets in the project.pbxproj.

geraintwhite avatar Nov 19 '20 16:11 geraintwhite

Using --legacy and setting CURRENT_PROJECT_VERSION in the project rather than the targets seems to do the trick.

geraintwhite avatar Nov 19 '20 16:11 geraintwhite

Using --legacy and setting CURRENT_PROJECT_VERSION in the project rather than the targets seems to do the trick.

Incredible, but it works as it should! Thank you

dmlitvinov avatar Jan 05 '21 04:01 dmlitvinov