How to force Flutter to update my version and build number? - xcode

I've changed my version in pubspec.yaml to 1.0.1+1 (from 1.0.0+3)
flutter clean
flutter build ios
When I open [project]/ios/Runner.xcworkspace it still shows me 1.0.0 version.
What am I doing wrong? How can I force Xcode to update my version from CLI or pubspec.yaml?
This is how my Info.plist looks like:
<?xml version="1.0" encoding="UTF-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>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Name</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Sundee</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Your location will be used to determine sun angle.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Your location will be used to determine sun angle.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your location will be used to determine sun angle.</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>

The same thing happened to me.
I think that when I used the xcode interface he changed the file ios/Runner.xcodeproj/project.pbxproj and he didn't get the value automatically
I solved it like this.
change this:
CURRENT_PROJECT_VERSION = your buildnumber
MARKETING_VERSION = your version
to:
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
MARKETING_VERSION = "$(FLUTTER_BUILD_NAME)";
this appears 3 times

I got it. It's because my lines in my Info.plist did not look like the following:
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
Anyone has an idea why I had $(MARKETING_VERSION) and $(CURRENT_PROJECT_VERSION)?

In my case, I had different flavors for my app, which I kind of understand to be schemes in XCode.
After doing flutter clean, since my app was done almost a year ago, I also decided to remove the android and ios folders to start from scratch, even the custom configurations. After that, I did pod install by setting my configurations to None first.
And then I encountered the issue. I did all the above solutions but didn't really work.
Turns out doing pod install set the Runner targets' build configs to Pods-Runner.<flavor>. I was able to have it update again after setting it to the Generated.xcconfig file.
before
after
I decided to set the Project config to the generated Pods-Runner.<flavor>, though I'm still not quite sure why, just felt like it was generated for a reason. Anyone who could help would be greatly appreciated.

#louise's answer got me pretty close but, weirdly, mine was the exact opposite. My Configurations look like this:

You need also get package.
CFBundleShortVersionString is the public "name" of the version (example: "2.5", or "3.8.1"). You must increase it at each release.
CFBundleVersion is the private build number. It is not seen on the AppStore. You must increase it at each upload. It means that if you ever reject a binary before it goes online, and you want to upload a new binary, it will have the same
CFBundleShortVersionString but must have a higher CFBundleVersion (example: public "2.5", private "2.5", and then binary reject, and re-upload private "2.5.1")

To achieve this, you have to add some values in CfBundleVersionShortString
Like:
<key>CFBundleShortVersionString</key>
<string>1.0</string>
And give the build value in Runner as 1.0 and version as 1.0

Related

Xcode - Archives not in organizer

Today I was looking to make an archive in Xcode 12 and suddenly I can no longer see the Archives in Window -> Organizer (it will not open automatically as supposed). It will show me the alert with Build Succeeded but no archive to upload on Test Flight. I was looking in ~Library/Developer/Xcode/Archives and is there but I can't see it in Organizer.
Any reason and maybe a solution for this?
Make sure you have the correct app selected. For example, this app I have no archives shown:
But once I select the correct app, it works:
I have managed to find a solution for this. So I was using react native mapbox package which seem to have some pods issues as per this thread https://github.com/react-native-mapbox-gl/maps/issues/1097#issuecomment-770064084
Looks like the archive was malformed
Try the follow:
1 - Close XCode.
2 - Go to /Library/Developer/XCode/Archives.
3 - Find the .xarchive file that you just archived.
4 - Delete the folders that are not the targets that you just archived (if exist):
Products/Applications/your-app-dev.app
Products/Applications/your-app-stage.app
5 - Open the Info.plist file (still from the .xarchive file).
6 - Complete the file with the part that is missing:
<?xml version="1.0" encoding="UTF-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>ApplicationProperties</key>
<dict>
<key>ApplicationPath</key>
<string>Applications/your-app.app</string>
<key>Architectures</key>
<array>
<string>arm64</string>
</array>
<key>CFBundleIdentifier</key>
<string>com.your-app.app</string>
<key>CFBundleShortVersionString</key>
<string>2.2</string>
<key>CFBundleVersion</key>
<string>42</string>
<key>SigningIdentity</key>
<string>Apple Development: Your Name (SOMEKEY123)</string>
<key>Team</key>
<string>123456789</string>
</dict>
<key>ArchiveVersion</key>
<integer>2</integer>
<key>CreationDate</key>
<date>2021-05-16T00:28:17Z</date>
<key>Name</key>
<string>your-app</string>
<key>SchemeName</key>
<string>your-app</string>
</dict>
</plist>

Safari Extension CSS Injection not loading

I built a Safari Extension in XCode from scratch. The main goal was to hide the video recommendations on YouTube when watching something - I figured I could do that using some css properties.
For testing purposes, I included some more style modifications.
/* Testing */
body {
background: red !important;
color: blue !important;
}
/* Hide column with video recommendations */
#secondary {
display: none !important;
}
For some reason these css properties, which I saved in nostyle.css, do not affect the site.
I followed the Apple Guide on injecting CSS Style Sheets as closely as I could, mainly by editing the Info.plist file:
I added the css file as a reference in NSExtension -> SFSafariStyleSheet -> Array -> Dictionary with Key Style Sheet (notice the space) and value nostyle.css (a file in the same directory as "script.js" that came together with the project default setup)
I added *.youtube.com to the list of allowed domains (among other URLs for testing purposes)
I got the script.js file to output messages in my console, although at a somewhat inconsistent rate.
I have not touched any other files (except I added some Icons to Assets.xcassets). The following shows the full content of my Info.plist file inside the Extension folder. It also contains a Toolbar Item (SFSafariToolbarItem) that appears in the menu bar in Safari but doesn't do anything on click (as intended).
<?xml version="1.0" encoding="UTF-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>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>DistractionFreeYouTube Extension</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSExtension</key>
<dict>
<key>SFSafariStyleSheet</key>
<array>
<dict>
<key>Style Sheet</key>
<string>nostyle.css</string>
</dict>
</array>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.Safari.extension</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).SafariExtensionHandler</string>
<key>SFSafariContentScript</key>
<array>
<dict>
<key>Script</key>
<string>script.js</string>
</dict>
</array>
<key>SFSafariToolbarItem</key>
<dict>
<key>Action</key>
<string>Command</string>
<key>Identifier</key>
<string>Button</string>
<key>Image</key>
<string>ToolbarItemIcon.pdf</string>
<key>Label</key>
<string>Distraction Free</string>
</dict>
<key>SFSafariWebsiteAccess</key>
<dict>
<key>Allowed Domains</key>
<array>
<string>*.youtube.com</string>
</array>
<key>Level</key>
<string>Some</string>
</dict>
</dict>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2020 (my name). All rights reserved.</string>
<key>NSHumanReadableDescription</key>
<string>This extension hides the column of recommended videos when watching YouTube videos.</string>
</dict>
</plist>
Here's a screenshot of my workspace.
check the manifest.json file in your app extension, make sure the key "content_scripts" has the css file you need:
"content_scripts": [{
"css": ["nostyle.css"],
"js": [ "script.js" ],
"matches": [ "*://*.youtube.com/*" ],
}],
And this is not mentioned in Apple documents but MDN WebExtensions Doc

Why isn't my document being recognized as a bundle in a minimally privileged environment?

I've got a OS X app that saves to a bundle. It works fine until I log out and then back in as a guest user and then it just shows up as a folder. The structure of the folder looks fine and has the correct extension, it's just not showing up as the custom UTI document.
I have changed the plist to say that the document is a bundle and changed it in the document types part of the target. Again, it is only not working when logging in as Guest User and so has been rejected from the App Store. Any ideas?
Here's the relevant section of "QTReview-Info.plist:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>movr</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>QTReviewIconRed</string>
<key>CFBundleTypeMIMETypes</key>
<array/>
<key>CFBundleTypeName</key>
<string>QTReview</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSItemContentTypes</key>
<array>
<string>com.protogylabs.qtreview</string>
</array>
<key>LSTypeIsPackage</key>
<integer>1</integer>
<key>NSDocumentClass</key>
<string>MyDocument</string>
<key>NSPersistentStoreTypeKey</key>
<string>Binary</string>
</dict>
The structure of the bundle is:
bundleFilename.movr (folder)
--Quicktime movie
--documentDictData
--annotationFiles (folder)
----image01.jpg
----image02.jpg

How can I suppress warnings in SublimeLinter for mixed spaces/tabs in comments?

Here is a link to a screenshot of the warnings:
I would like to be able to use the "cmd+/" shortcut to quickly comment out sections of code. Whenever I do, I get a bunch of space/tab mixing errors. I am required to use tabs for coding standards, but it seems Sublime 3 forces spaces for the comments. I also enjoy the error checking for space/tab mixing through non-commented code, so I would like to leave that intact if possible.
Is there a way to modify Sublime's settings to change the commenting shorcuts functionality or is there a way to modify SublimeLinter-jshint's settings to ignore these warnings?
Thanks in advance.
The easiest way to do this is to remove the space from after the //. Open your Packages folder via Preferences -> Browse Packages... and create a folder called JavaScript. I assume you're on OS X, so the full path to the folder is ~/Library/Application Support/Sublime Text 3/Packages. Next, create a new file in Sublime with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>source.js, source.json</string>
<key>settings</key>
<dict>
<key>shellVariables</key>
<array>
<dict>
<key>name</key>
<string>TM_COMMENT_START</string>
<key>value</key>
<string>//</string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_START_2</string>
<key>value</key>
<string>/*</string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_END_2</string>
<key>value</key>
<string>*/</string>
</dict>
</array>
</dict>
<key>uuid</key>
<string>A67A8BD9-A951-406F-9175-018DD4B52FD1</string>
</dict>
</plist>
and save it in the Packages/JavaScript folder as Comments.tmPreferences. You'll notice that the TM_COMMENT_START value is //, whereas in the original it's //. Restart Sublime, and now when you're editing JavaScript or JSON files and hit Command ⌘/ your code will be commented out without the addition of a space.

Creating a bundle - What's going wrong?

I've got a relatively simple one here. I'm making bundles to live inside the Resources folder of my application (and possibly in the Application Support folder). These bundles will contain template information for the data the application handles. I've constructed a bundle, with extension "booksprintstyle", and the directory structure is up to spec. I have an Info.plist all set and I think I've filled in all the values I need to. Do I need to change something in my App to have these folders-with-extensions recognized as bundle files, or am I missing something in my bundle structure? I noticed that some bundles have a file called PkgInfo; is that important?
Below is the Info.plist from my bundle.
<?xml version="1.0" encoding="UTF-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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleGetInfoString</key>
<string>1.0, Copyright © 2009 Joey Lange</string>
<key>CFBundleIdentifier</key>
<string>net.atherial.books.exporter.printingpress.printstyle</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Books Print Style - Generic</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleDisplayName</key>
<string>Books Print Style - Generic</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2009 Joey Lange</string>
<key>CFBundleVersion</key>
<string>1.0</string>
</dict>
</plist>
Do I need to change something in my App to have these folders-with-extensions recognized as bundle files…
Yes. Export a UTI declaration in your app's Info.plist for the type of these bundles. You'll declare the UTI as conforming to com.apple.package. See Understanding Uniform Type Identifiers for more.
Below is the Info.plist from my bundle.
That isn't relevant. The necessary declaration goes in your application bundle, not your document/plug-in bundles.
I noticed that some bundles have a file called PkgInfo; is that important?
No.

Resources