Nativescript - iOS app name? - nativescript

How is the app name set in iOS version of the build?
Looking at app/App_Resources/iOS/Info.plist - I see
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
How are these 2 set and when are they set (during prepare?)?

By default, the name of the app is same as PRODUCT_NAME, which in return is the project name (the root-folder name of your app). EXECUTABLE_NAME is the name of the .ipa file that is generated. I would recommend to leave these two alone, the way they are :)
You can add the following to the Info.plist in order to set your own name:
<key>CFBundleDisplayName</key>
<string>My App</string>
UPDATE: If you need to fetch values from the Info.plist file, you can do it like this:
var utils = require("utils/utils");
var mainBundle = utils.ios.getter(NSBundle, NSBundle.mainBundle);
var appName = mainBundle.infoDictionary.objectForKey("CFBundleDisplayName"));

Related

Can I set the name of the generated IPA file?

I have a user-defined attribute that I set for CFBundleName:
<key>CFBundleName</key>
<string>$(APP_DISPLAY_NAME)</string>
APP_DISPLAY_NAME == THIS IS MY APP <-- it is the app name that I can see on my iPhone after I installed the app,
The problem is that also the IPA file name will be THIS IS MY APP.ipa. What is the problem with all the spaces while working with this file in the pipeline?
Is there a way to version this as my_app_prod_1_2_1 or my_app_dev_1_2_1 for the name of the file produced?
In your app's Build Settings, change the PRODUCT_NAME.

Asset validation failed (90287) Invalid Code Signing Entitlements when signing an electron app

I am trying for the first time to sign an electron app (via electron-forge that uses #electron/osx-sign under the hood) and public in Mac App Store.
After several errors, I could successfully sign but two of them persisted:
Asset validation failed (90287)
Invalid Code Signing Entitlements. The entitlements in your app bundle signature do not match the ones that are contained in the provisioning profile. The bundle contains a key that is not included in the provisioning profile: 'com.apple.application-identifier' in 'com.COMPANY.APP.pkg/Payload/APP.app/Contents/MacOS/APP'. (ID: ***)
Asset validation failed (90287)
Invalid Code Signing Entitlements. The entitlements in your app bundle signature do not match the ones that are contained in the provisioning profile. The bundle contains a key that is not included in the provisioning profile: 'com.apple.developer.team-identifier' in 'com.COMPANY.APP.pkg/Payload/APP.app/Contents/MacOS/APP'. (ID: ***)
This happens when I try to send it via Apple's Transporter.
I am searching for the last days but everything I tried was in vain, like:
Download different provision profiles: Development, Distribution, Developer;
Manually sign/notarize via CLI;
Use Development/Distribution environments;
My configuration file:
const path = require('path');
const fs = require('fs');
require('dotenv').config();
const APP_BUNDLE_ID = 'com.COMPANY.APP';
const MACOS_ENTITLEMENTS_PATH = path.join('osx', 'entitlements.plist');
module.exports = {
packagerConfig: {
icon: './assets/icon.ico',
appBundleId: APP_BUNDLE_ID,
appVersion: process.env.APP_VERSION,
name: 'APP',
appCategoryType: 'public.app-category.developer-tools',
darwinDarkModeSupport: true,
executableName: 'APP',
osxUniversal: {
mergeASARs: true,
x64ArchFiles: '**/{node_modules/\.cache,node_modules}/**'
},
osxSign: {
identity: process.env.APPLE_SIGN_IDENTITY,
provisioningProfile: path.join('osx', 'dist.provisionprofile'),
hardenedRuntime: true,
entitlements: MACOS_ENTITLEMENTS_PATH,
'entitlements-inherit': MACOS_ENTITLEMENTS_PATH,
'signature-flags': 'library',
'gatekeeper-assess': false,
},
osxNotarize: {
appleId: process.env.APPLE_SIGN_APPLEID,
appleIdPassword: process.env.APPLE_SIGN_APPLEIDPASSWORD,
}
},
makers: ['...']
}
my entitlements file:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
</dict>
</plist>
The question is: how can I add those keys to my provision profile? is it the correct thing to do?
Thanks in advance!
I could solve it by understanding a few topics:
I believe notarisation is needed only when you plan to distribute your app in other places, but not in Mac App Store.
To notarise, only Developer ID keys are accepted.
The electron-forge does not update all fields from electron-notarize package and one of these fields is provisioningProfile, you will need to put it in the root folder in order to load it.
You can set DEBUG=electron-osx-sign* to have a full signing log.
I still need to sign the .pkg file manually as Transporter does not accept the package signed by electron-forge's make pipeline.

Undefined dictionary in Info.plist

Sep 4 18:26:17 MacBook-Pro-77 com.apple.dt.Xcode[315] :
installApplication:withOptions:error:: Error
Domain=IXUserPresentableErrorDomain Code=1 "This app could not be
installed at this time." UserInfo={NSLocalizedDescription=This app
could not be installed at this time., NSUnderlyingError=0x7fd558a69980
{Error Domain=MIInstallerErrorDomain Code=39 "Appex bundle at
/Users/mrinmaykalita/Library/Developer/CoreSimulator/Devices/4E1C6B5B-2711-47ED-B8B6-27DA419E4609/data/Library/Caches/com.apple.mobile.installd.staging/temp.9nyJrs/extracted/Beam.app/Watch/Beam
Watch.app/PlugIns/Beam Watch Extension.appex with id
com.bpl.Beam.watchkitapp.watchkitextension does not define an
NSExtension dictionary in its Info.plist"
UserInfo={LegacyErrorString=AppexBundleMissingNSExtensionDict,
FunctionName=-[MIPluginKitPluginBundle overlaidInfoPlistWithError:],
SourceFileLine=213, NSLocalizedDescription=Appex bundle at
/Users/mrinmaykalita/Library/Developer/CoreSimulator/Devices/4E1C6B5B-2711-47ED-B8B6-27DA419E4609/data/Library/Caches/com.apple.mobile.installd.staging/temp.9nyJrs/extracted/Beam.app/Watch/Beam
Watch.app/PlugIns/Beam Watch Extension.appex with id
com.bpl.Beam.watchkitapp.watchkitextension does not define an
NSExtension dictionary in its Info.plist}}}
In the above output from CoreSimlutor.log; why is com.apple.mobile.installd.staging referred to when that folder does not exist or get created in running.
Any quick workouts kindly please?
I checked that the key exists in Info.plist for
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>WKAppBundleIdentifier</key>
<string>com.bpl.Beam.watchkitapp</string>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.watchkit</string>
</dict>
Thanks
I had this problem after changing location of Info.plist file for app/WatchKit extension or WatchKit app. Other reason may be just renamed folder for WatchKit app or extension.
You have to clean all targets including main application, extensions and WatchKit app. I had to perform clean using Cmd+Shift+K for each target once changing targets in drop down in Xcode one after another.

how to make a finder sync extension load automatically?

i create a cocoa application project, and add target "Finder sync extension". Then the "finderSync.appex" will be put to ".../Contens/Plugins/" folder. But when i launch the application, the extension is not loaded automatically, should i load it manually ? How can i load it ?
From the Apple developement guide, it says:
For OS X to recognize and automatically load the Finder Sync extension, the extension target’s info.plist file must contain the following entries:
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict/>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.FinderSync</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).FinderSync</string>
</dict>
I already set as the above, but it doens't work.
You need to register your extension with Finder:
pluginkit -a <path you your appex>
You might also need to tell Finder to enable your extension:
pluginkit -e use -i <ID of you appex>

Can the name of the bundle application be different of the name of the executable file?

I have a sandboxed login item whose executable file name is something like X174423.MyApp because it is prefixed with my developer ID. I'd like to set the bundle name for this helper application to MyApp.
In Xcode 5, I've tried to change the bundle display name but the name of the bundle does'nt change.
I've created a CFBundleDisplayName entry in the InfoPlist.strings but the name of the bundle reminds the same.
It seems that I've missed something but what ?
If I understand correctly, you'd like to have the bundle to be shown in Finder as MyApp. I don't know why exactly it has to be like this, but it's working for us the following way. In your Apps Info.plist:
<key>CFBundleDisplayName</key>
<string>X174423.MyApp</string>
<key>CFBundleName</key>
<string>X174423.MyApp</string>
and following in the InfoPlist.strings:
/* Localized versions of Info.plist keys */
CFBundleDisplayName = "MyApp";
CFBundleName = "MyApp";
Alternatively you could try this in Info.plist and don't use InfoPlist.strings:
<key>CFBundleExecutable</key>
<string>X174423.MyApp</string>
<key>CFBundleDisplayName</key>
<string>MyApp</string>
<key>CFBundleName</key>
<string>MyApp</string>

Resources