How to get app's Build Number through Electron - electron

I would like to get my MacOS app's build number at runtime, the same way I get the app version:
const { app } = require('electron');
console.log(app.getVersion()); // 1.0.0
The problem is that Electron doesn't seem to have any built-in method to retrieve the app's build number.
In a MacOS application, the build number is the one between parenthesis in the "About" panel. For example:
I'm packaging my Electron macOS app using forge.config.js, with the following config:
{
[...]
appVersion: '1.0.0',
buildVersion: '123456',
}
When I package my application for macOS, the About Panel shows the version correctly, displaying 1.0.0 (123456).
Is there a way to access the build number at runtime? Or, at least, injecting it into the packaged app so I can retrieve it somehow.

buildVersion ends up getting written to your Mac app bundle's your.app/Contents/Info.plist file under the CFBundleVersion field. So you'd have to read and parse the Info.plist xml file at runtime to get it, AFAIK there is no easier built in way. Not too hard to do, though it might just be easier for you to append this info to your appVersion like 1.0.0-123456 as that can be any string, there is no requirement that it be in semver or any particular format.

Related

How to test the purpose string of NSPhotoLibraryUsageDescription in iOS using Expo?

I've been struggling to verify if the purpose string for photo library access really is working as expected. It started with the application got rejected because it wasn't set.
Using expo-image-picker, it says in the docs that adding this into the plugins section in app.json should set the NSPhotoLibraryUsageDescription:
[
"expo-image-picker",
{
"photosPermission": "This allows you to upload a photo to your Appname profile."
}
]
Before I added this, I basically added NSPhotoLibraryUsageDescription to the plist key inside ios section in app.json. What I can see, both do exactly the same thing.
After building ios using expo build:ios I was able to verify that that the string existed in the Info.plist file:
<key>NSPhotoLibraryUsageDescription</key>
<string>This allows you to upload a photo to your Appname profile.</string>
Using Expo Go doesn't really help since when requesting permissions, it says "Expo Go" in the alert.
Also, I only have experience working with Expo / React Native, and have no access to a mac (or xcode).
When apple test this, it looks like this (according to their screenshot):
While the expected text should be:
This allows you to upload a photo to your Appname profile.
How can I verify that the purpose string is really set (and works) before submitting an application to App store?
My solution:
First I set up my app for an EAS build. If you're not familiar with that you should check out the docs: https://docs.expo.dev/build/introduction/
Basically you do this:
install eas-cli: npm install -g eas-cli
run eas build:configure to initialize an eas.config file.
configure your eas build profiles. Mine look like this:
I collapsed the submit block to hide my credentials. Sorry for the photo instead of code/text. The formatter kept messing it up.
Any way, trigger a build using eas build -p ios --profile development. Notice the simulator flag set to true. This will allow you to run this as a stand-alone binary in your simulator.
When your build completes, go to expo.io and log into your account. Click on your project and download the binary for your ios build (under the builds tab). Unzip the binary and drag it into your simulator. You may be prompted with a message that says that you need to start up your development server. Just follow those simple instructions and there you go. You'll be able to see if your NSPhotoLibraryUsageDescription string updated.
Admittedly, this can be a pain in the (insert donkey emoji here - still don't have one yet Apple....😡) and you're kind of executing outside of the expo environment, but it solves the problem of wondering if your string has updated before posting to the store again.
Best of luck. Hope that helps.

Invalid bundle structure. The binary file '***' is not permitted

This is my first time when I integrate, share extension to my app. I don't know after adding a share extension to my app I get this error while uploading my app build on Test Flight. App work fine on a device not getting any error, but when I try to upload my app a get this error.
thanks in advance
You should fix your bundle CFBundleVersion
According to Apple document as below
Each integer provides information about the build version in the format [Major].[Minor].[Patch]:
Major: A major revision number.
Minor: A minor revision number.
Patch: A maintenance release number.
You can include more integers but the system ignores them.
You can also abbreviate the build version by using only one or two integers, where missing integers in the format are interpreted as zeros. For example, 0 specifies 0.0.0, 10 specifies 10.0.0, and 10.5 specifies 10.5.0.
As well as your app bundle version you should be aware of your pods has correct short bundle versions are correct. You can check them from info.plist
removing file FAIcon from my copy bundle resource work for me.

Add a checksum file to my macOS notarised app bundle

I would like to detect whether my macOS app executable file has been altered by someone.
I wouldn't rely on the Codesign because, as I have seen on the web, many apps have been cracked, even if notarised by Apple. I know this will not guarantee the top security, but I would add this custom protection anyway.
A) If I add a checksum file within the Resources folder in the bundle after the app has been Archived (so within the xcarchive package), it's too late. The app won't launch because of the manipulation. I get a crash with "Termination Reason: Namespace CODESIGNING, Code 0x2".
B) If I add or modify the checksum file after the app has been notarised, the same, it won't launch.
C) If I modify the checksum resource file with a shell script during the build phase, before the "Run Copy Bundle Resources" phase, the checksum is wrong since the executable at that moment has a different file size and file modification date.
So, what's the best way to add my own checksum file to my app bundle?
I run macOS 10.15.6 and XCode 11.5 and compile my 64 bits app for macOS 10.3/10.5.
If I understand correctly, you're trying to verify that your application is as you shipped it? And you're worried that codesigning isn't enough, as it might be "cracked"?
I do not believe this can be solved by using any kind of checksum. Anything that can compromise codesigning, can also compromise your checksum.
I would instead look at the new Apple Attestation API. This is designed to allow an application to verify that it is running on Apple hardware, and is the codesigned version. (A modified and signed application would fail this -- it's codesigned by a different key)
https://developer.apple.com/documentation/devicecheck

Universal Linking with Firebase and Ionic

Additional Findings (After Initial Post)
I used this site https://limitless-sierra-4673.herokuapp.com/ to validate the link. Got an error about application/pkcs7-mime. Not sure how to change this with Firebase Dynamic Links
Im trying to set up universal linking with Firebase's dynamic links.
1. Firebase Setup
I've set up the app with Firebase and I have the link: https://e2x6f.app.goo.gl.
When I open the link I get a 400 Error but If I go to https://e2x6f.app.goo.gl/apple-app-site-association I get this:
{"applinks":
{
"apps": [],
"details": [{
"appID": "8CK4RLPU2T.com.turnmusicapp.15499",
"paths": ["/*"]
}]
}
}
So I think its ok. I've checked to make sure all the information is correct.
One problem is, when I use app's link to check search validation it also returns a 400 error - not sure if this is ok or not.
2. Xcode Setup
Anyways, I enabled Associative Domains on my app:
Then under "Info" -> URL Types I added:
3. Ionic Setup
Here is my Ionic info:
global packages:
#ionic/cli-utils : 1.4.0
Ionic CLI : 3.4.0
System:
Node : v8.1.2
OS : macOS Sierra
Xcode : Xcode 8.3.3 Build version 8E3004b
ios-deploy : 1.9.1
ios-sim : not installed
npm : 5.0.4
So I installed the Deeplinks package and have that all setup. I know it's working because I can use links like turn://home in the Safari browser and it will take me to my app. I'm not sure if I need to do anything else here. I've updated the widget field in my config.xml file to this:
<widget id="com.turnmusicapp.15499" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
Does the id field need to include my app prefix?
Result
So I'm running my app with ionic cordova run ios --livereload, I type the message into Safari and It takes me to a 400 error page. I've tried sending the link as an iMessage and that does the same thing.
Thanks for the help!
You have a few misconceptions — let's clear them up in order:
The https://limitless-sierra-4673.herokuapp.com/ validator is outdated — application/pkcs7-mime hasn't been required for years. Check Apple's official docs and you'll see application/json has been the requirement since iOS 9. Dynamic Links certainly won't have any configuration issues on the server side so you really don't even need to check this part, but a more updated validator is available here if you want it (yes, https://e2x6f.app.goo.gl validates perfectly).
The URL https://e2x6f.app.goo.gl is not a Dynamic Link; it's simply your link base domain. Real links will look like https://e2x6f.app.goo.gl/A97Q (short version) or https://e2x6f.app.goo.gl/?link=https://example.com/path/to/app/content&ibi=com.turnmusicapp.15499&ius=turnmusicapp&ad=1&isi=1121012049&ifl=https://example.com&apn=com.turnmusicapp.15499&al=https://example.com&at=affiliate_token&ct=campaign_text (full length). While a 400 error for the base domain is lame UX, it's expected. You need to actually create some links.
The Apple tool is the "App Search API Validation Tool", not the "Universal Links Validation Tool" (which doesn't exist from Apple). The results from this tool have no connection to whether Universal Links work — it's checking something completely different.
There is no official Dynamic Links package for Ionic, and the Deeplinks package is not designed to support it. You're off the edge of the map trying to get these working together. You might look at this new community plugin.
Alternatively, take a look at Branch.io (full disclosure: I'm on the Branch team). We do everything Dynamic Links does plus far more, and there is an actively-developed Ionic module that will handle all of this for you.

Test on IOS: System.ArugumentException

I would like to test an IOS application on Xamarin, using XamarinUITest.
Unfortunatly, i'm not able to launch anything on my local device.
I've succed on running test on Android but IOS seems to be a brand new mystery.
Actually i've an error that I'm not able to find any solution.
The system says :
System.ArgumentException : Must supply files for hashing
Parameter name: fileInfos
This is my code for launching the application :
app = ConfigureApp.IOS.Debug()
.EnableLocalScreenshots()
.DeviceIdentifier(PHYSICAL_DEVICE_ID)
.AppBundle(PATH_TO_MY_IPA)
.StartApp();
I've not the hand on the application, i've only an IPA that includes calabash.
i've only an IPA that includes calabash.
AppBundle requires access to the .app, not the .ipa.
Install the .ipa and use InstalledApp passing the application bundle id

Resources