Running tns resources generate icons killed iOS app - nativescript

I ran tns resources generate splashes and tns resources generate icons and it worked fine for Android but when it reloaded on iOS I got the following error:
/* com.apple.actool.errors /
/Users/adam_beck/Desktop/code/fingoalNS/platforms/ios/fingoalNS/Resources/Assets.xcassets: error: None of the input catalogs contained a matching stickers icon set or app icon set named "AppIcon".
/ com.apple.actool.document.warnings /
/Users/adam_beck/Desktop/code/fingoalNS/platforms/ios/fingoalNS/Resources/Assets.xcassets:./LaunchScreen.AspectFill.imageset/(null)[2d][LaunchScreen-AspectFill.png]: warning: The image set "LaunchScreen.AspectFill" has 2 unassigned children.
/Users/adam_beck/Desktop/code/fingoalNS/platforms/ios/fingoalNS/Resources/Assets.xcassets:./LaunchScreen.Center.imageset/(null)[2d][LaunchScreen-Center.png]: warning: The image set "LaunchScreen.Center" has 2 unassigned children.
/Users/adam_beck/Desktop/code/fingoalNS/platforms/ios/fingoalNS/Resources/Assets.xcassets:./LaunchImage.launchimage/(null)[2d][Default-1125h.png]: warning: The launch image set "LaunchImage" has 12 unassigned children.
/ com.apple.actool.compilation-results */
/Users/adam_beck/Desktop/code/fingoalNS/platforms/ios/build/Debug-iphonesimulator/fingoalNS.app/LaunchImage-700-568h#2x.png
/Users/adam_beck/Library/Developer/Xcode/DerivedData/fingoalNS-fvoglrpadrrtljalueomxfllvudt/Build/Intermediates.noindex/fingoalNS.build/Debug-iphonesimulator/fingoalNS.build/assetcatalog_generated_info.plist
When I rebuilt for iOS I got the following error:
Failed to find LaunchScreen.storyboard but it was specified in the Info.plist.
Consider updating the resources in app/App_Resources/iOS/.
A good starting point would be to create a new project and diff the changes with your current one.
Also the following repo may be helpful: https://github.com/NativeScript/template-hello-world/tree/master/App_Resources/iOS
We will now place an empty obsolete compatability white screen LauncScreen.xib for you in platforms/ios/fingoalNS/Resources/LaunchScreen.xib so your app may appear as it did in pre v2.1.0 versions of the ios runtime.
Info.plist: Merging CFBundleURLTypes: Property CFBundleTypeRole is required!
and it exits with Command xcodebuild failed with exit code 65
Thoughts?

In case any one else runs into this issue the tns commands never worked but I was able to successfully generate splashes and icons through Sidekick. From their docs:
Launch NativeScript Sidekick and open your app.
From the left toolbar, select Assets to open the Assets view.
To generate the icons of your app, complete the following steps.
In the icon placeholder in the generator, click Browse.
Browse and locate the image source that you want to use, select it and click Open.
When prompted, choose for which platforms you want to generate icons.
Click Generate and wait for the operation to complete.
To generate the splash screens of your app, complete the following steps.
In the splash screen placeholder in the generator, click Browse.
Browse and locate the image source that you want to use, select it and click Open.
When prompted, choose for which platforms you want to generate splash screens.
(Optional) Provide a custom background color in a hexadecimal format.
Click Generate and wait for the operation to complete.
(Optional) Select the Android and iOS tabs to inspect the newly added app assets.

I am on Windows and this command worked perfectly:
tns resources generate icons app-icon.png
I putted icon in the main folder, so it didn't required to give a path or smth..
Same with splashes:
tns resources generate splashes app-icon.png --background white

Related

Phonegap/Cordova to ipa file without Phonegap build

I use Phonegap Build to create my Android and iOS app files. However I want to compile the files locally on my computer, and not use Phonegap Build. I have done this successfully for Android (see here: https://cordova.apache.org/docs/en/latest/guide/platforms/android/) but iOS is more complicated. I have little Apple-knowledge.
Does anybody know of any good tutorials on how to import a Phonegap plugin in to the xcode environment...ideally one for someone who's background is NOT an Apple developer.
I have managed to do this myself but I've answered my own post to help others who may be in a similar situation - Please note this is correct as of end of 2019, and I had already successfully uploaded an IPA file to the app store via Phonegap Build before. All I'm doing here is compiling my Phonegap/Cordova project IPA file directly on a Mac, rather than using Phonegap Build:
1) You will need a mac and a developer license (as expected). You will be using both a terminal window where possible and Xcode.
2) Certificates and provisioning are a messy nightmare right out of satans bumhole. But just make sure you set up an "App store distribution" profile on your developer.apple.com account. If you don't know how to handle certificates and provisions please read here https://medium.com/ios-os-x-development/ios-code-signing-provisioning-in-a-nutshell-d5b247760bef.
But remember you only need to download the certificate to your Mac, and add it to your "My Certificates" area. The provisions can be automatically downloaded/linked to via Xcode.
3) Install Xcode 11 on your Mac. Forget all the other versions.
4) Install Cordova CLI on your Mac using the terminal - open up the terminal window and type:
sudo npm install -g cordova
5) Create a FRESH cordova project - dont try to be smart by shoe-horning the one you've already used on your PC:
cordova create hello com.example.hello HelloWorld
...you might need to to add "sudo" to the front of that. Don't copy and paste any html files or plugins in to it yet!
6) If your Mac might give you read/write access problems. So locate the entire folder, ctrl+click on the project folder, choose "get info" ...in the bottom right of the popup window click the lock icon and enter your password. Now change all settings to "read and write", then click the cog icon and select "Apply to enclosed items".
7) Create the platform : sudo cordova platform add ios#5.1.0....note, DO NOT use ios5.1.1 if you are using firebase or push notifications, as it seems to break with 5.1.1.
8) Apple will (again) probably give only read access to your new platforms/ios folder, because it hates you and wants you to suffer. So repeat step 6 if necessary.
9) Open Xcode the following way... In your projectname/platforms/ios/ folder locate the .xcworkspace file. This is the file you use to open your project. DO NOT use the .xcodeproj file because this is for older Xcode versions (and it will just break your whole damn project). Also go to File->Workspace Settings and ensure Build System is set to "Legacy Build System".
10) Now piece together your config.xml file by extracting the bits you need from your previous config file to your fresh new one. Don't bother moving over any android-specific bits.
11 a) Apple bring you a fresh slice of hell with cocoapods - a dependency manager for Swift and Objective-C. You'll need to install this if your app uses certain things like push notifications (firebase for example). You can install this via the terminal window. FIRST....close down Xcode. NEXT go to projectname/ and type: sudo gem install cocoapods. FINALLY go to projectname/platforms/ios/ and type pod install.
11 b) There's a bug...a pretty major one. Your cocoapods will fail when building at this point. So you need to do some hacking here. Navigate to the directory projectname/platform/ios/Pods/TargetSupport Files/Pods-yourproject and look for
Pods-yourproject.debug.xconfig and Pods-yourproject.release.xconfig
You need to copy the content of these files into platform/ios
pods-debug-xconfig and pods-release.xconfig respectively----THANK YOU kyale-mwendwa for this tip....https://github.com/phonegap/phonegap-plugin-push/issues/1825#issuecomment-359155007
12) Now copy and paste your www folder over in to your fresh project. You are ready to build your project...
13) Re-open xcode using the .xcworkspace file. Now you need to ensure your provisioning is set up correctly for your release. Click the project name at the top of the left-hand column (right above where it says config.xml). Now in the main window click your app name under the "Targets" section. Now select "Signing and Capabilities". If you managed to set up certificates and provisions correctly you should be able to select your "team" (no I don't know either, just select whatever option you can here), and enter the correct bundle identified (com.whatever.whatever).
14) Ok, you are ready to create your IPA file. Still have hair?? Bonus points for you!
Just before this next bit, go to Xcode and towards the top of the screen you will see the project name followed by "> iPad (7th generation)" or something similar. Click this and make sure you choose "Generic iOS device".
Now back in the terminal enter sudo cordova build ios. You don't have to transport your plugin files over from your windows-built cordova folder. Cordova will detect the plugins you need from your config.xml and install them appropriately.
15) If you have no errors you can now create your IPA file and even submit it directly to the App store (this bit of Xcode is actually really good). In Xcode, from the menu at the top click "Product" and then "Archive". Follow the onscreen instructions. At this point your IPA file is created.
You can choose to automatically distribute your file to the Appstore, but I suggest clicking the "Validate App" option first, which will re-request the correct certificates/provisions and give you a summary of any issues. If no issues you can click "Distribute App" and it will upload the IPA file to your Appstore Connect (formerly iTunes Connect) area.

Asset Catalog Compiler Error - none of the input catalogs contained a matching app icon set named "AppIcon"

Asset Catalog Compiler Error - none of the input catalogs contained a matching app icon set named "AppIcon"
I had a similar problem and I think it was because I accidentally deleted the AppIcon in Images.xcassets. So I will explain what I did.
Open the Images.xcassets in the current project.
Resize the window and move the window(Xcode) to the right.
Start a new project in Xcode(a temporary one). Name it something like "temporaryApp".
Open the Images.xcassets in the temporaryApp. Here, you can see AppIcon.
Click and drag this to Images.xcassets of our previous app, that is placed at the right-hand side of the screen.
And voila, Build Succeeded.
Hope this works for you
Please verify your settings is correct.
I had a same issue and I solved this way.
For me, I added Apple Watch extension within this project and deleting them got me into this trouble.
In the Images.xcassets, I do have "icon" and "info", but the error message was exactly same as yours but for "icon" set.
So I searched within xCode project which contains "icon". and found xcodeproj file > build settings > Asset Catalog Compiler - Options with app icon set name as "icon".
So I deleted icon leave it blank and build again, IT WORKS.
This once happened to me, and I solve it correctly with an easy way :->
choose the file "Images.xcassets", if your project does not have such a resource file, create it.
click your mouse's right key in the blanket, and choose "New App Icon"
build your project again, everything works fine now.
IF NOT, check the project's "Build Settings", and find property "Asset Catalog App Icon Set Name" to see if it was "AppIcon".
You have probably deleted the Appicon in a Assets.xcassets, you can fix it by going to Assets.xcassets -> hitting the + -> App Icons & Launch Image -> New iOS App Icon.
Here's an Image
For whoever comes across this issue in the future. Verify That App Icons-> Source is set to AppIcons, and not "None". See pic
Here is a simple solution
Go to assets
Right click -> IOS -> add AppIcon
Run
This problem might be solved by removing the reference of .xcassets file and adding it back if the AppIcon and info is already setup. It worked for me when i removed the reference to Images.xcassets and then added it to project again from Xcode.
On Xcode 13+
Go to your app info -> General
You will see " App Icon and launch Image", be sure to target the right folder in my case AppIcon.
Screen general app info
If you deleted it, simply go to your "Asset", then click on the plus on the top right of your screen and search for missing folder like "AppIcon" or "AccentColor"
Screen explanation to search for elements
Have a great day 👩🏻‍💻
In my case I run Flutter debug app on IOS Simulator. It took me up to 3 days and I still can't run it. Finally the solution that can get it working again is simply restarting my Macbook.
For me - it was assets catalog (that contained the app icon) had no target membership set.
Please make sure you had that set to appropriate target.
For me the target membership was not set on the icons.

Give an OS X app a custom icon?

Yes, my problem really is that simple. How the heck do I get my app to use the icon file or asset catalog?!
System info:
Xcode 6.1.1 (6A2008a)
app target OS X 10.10
OS X 10.10.1 (14B25)
This is my first OS X app but I have several years' experience developing iOS apps.
Steps to reproduce:
open Xcode, start an entirely new cocoa application project
not sure this matters, but i specified my new project not to use storyboards or core data
drag a .png file from my local directory into the project structure, and make sure (a) it ends up in the build target and (b) the file copies into the project's directory
drag the png into the Images.xcassets catalog under any/all of the sizes classes for AppIcon.
build and run
Expected: app in dock and tab-switcher has the new icon.
Actual: app in dock and tab-switcher has the default "blank page with instruments A on it"
Ok, maybe that's a DEBUG thing.
archive the project, show in finder
Expected: app in Finder has correct icon
Actual: nope. It should be noted however that Xcode's Organizer shows the correct icon, and there does exist a file Contents/Resources/AppIcon.icns. Contents/Info.plist specifies that the Icon File is "AppIcon".
grrr. Let's try without the asset catalog.
in the target's General settings, under App Icon, select "don't use asset catalogs"
delete Images.xcassets
In Info.plist, in the line for Icon File (CFBundleIconFile), specify the icon's name (in my case "AppIcon"). The documentation clearly states that
The system looks for the icon file in the main resources directory of the bundle.
File extension is not required here.
build & run. also archive, to save time later.
Expected: app icon in dock and tab-switcher is correct.
Actual: nope
Expected: archived app has correct icon.
Actual: nope, but the archived product did have the correct png file in Contents/Resources.
What am I missing?!
I've tried this with .png app icons and a regular .icns file (generated by Xcode via an asset catalog). I've tried excluding and including the file extension in the Info.plist. Why is this so difficult?
Edit: Clean, Clean Build Folder and deleting the Derived Data folder did not help.
So I found the answer through the help of a commenter: I had to fill all of the xcassets/icns slots with images of the exact dimensions.

How do I add an icon to my Xcode project?

I have an Xcode project for Mac OSX, and I'd like to add an icon file (.icns) to my project and set it as the App Icon. How would I do this?
The key here is that you need an ICNS (icon set) file.
The right way to create this is described in the Human Interface Guidelines, and the details are covered in various user's guides and reference guides in Apple's maze of twisty little documentation, but I'll summarize it here.
There are third-party tools that can do this, as well as plugins for Photoshop, GIMP, Illustrator, etc., that can output a correct .icns file. But make sure, if you use such a thing, it's up to date, because Apple changes the rules all the time.
If you need to do it manually, here's what you do:
First, create a set of PNG files at different sizes. The exact list of what you need changes over time. See Provide the Correct Resources and Let OS X Do the Work if that link lasts longer than the current list; otherwise, search for it at http://developer.apple.com yourself. But, as of early 2013, it's 512x512, 256x256, 128x128, 32x32, 16x16, and #2x versions of each. All of them should have the sRGB color profile embedded in them. They should be named either icon_512x512#2x.png, icon_512x512.png, etc., or MyApp_512x512#2x.png, MyApp_512x512.png, etc. Put them all in a directory together named, e.g., MyApp.iconset.
"But wait! I just want an icon, I don't want all those sizes!" Well, you really do want all those sizes. Your 512x512 icon will look horrible when scaled down to 32x32. And on a Retina Mac, when your icon gets scaled up to double resolution, instead of getting sharper it'll just get jagged. Also, if you want to get into the App Store, Apple will reject you if you don't have them. But, if you insist, you can get away with just putting icon-512x512.png in the folder, and follow the rest of the steps, and it will work.
From the Terminal, cd into the parent directory, and type iconutil -c icns MyApp.iconset. You will get a file called MyApp.icns.
Now you can do the steps suggested by Douglas, and it will actually work. In Xcode, select your project in the Project Navigator, select your app target in the project sidebar, select the Summary tab, and drag MyApp.icns from Finder to the App Icon box.
This may not have any visible effect in the GUI, except to add MyApp.icns to the Project Navigator. In other words, you may still see the "?" icon. This seems to be a bug in Xcode 4.5. If you follow the out-of-date recommendations from the HIG two versions ago, Xcode always shows the icon, but if you follow the current HIG, it doesn't. Go figure. Hopefully Apple will fix that some day.
But for now, it doesn't matter. Build the project, and then look at MyApp.app, and it will have your icon in the Finder, on the Dock, etc.
Now, I know you don't want to draw the same picture in 10 different variations, you just want something simple. As long as you don't want to get into the App Store, you can get away with cheating, in two ways:
Scale the 512x512 (1024x1024 pixel "512x512#2x" if supporting hi res) image to all of the other sizes, using your favorite tool.
Create a .icns with nothing but the 512x512 image in the iconset.
The second one is simpler, and less cheat-y, and ultimately Finder is probably going to scale your 512x512 image as well as you would have anyway.
Finally, if you've manually edited your Info.plist or changed build settings (or you're using a project imported from a much easier version of Xcode), just dragging the image may not be enough. If you need to do the same steps manually, here they are:
MyApp.icns has to be in the Project Navigator as a file in your project. (You can drag it here from Finder.)
In Build Phases, the Copy Bundle Resources should include MyApp.icns. (You can drag it here from the Project Navigator.) (If you're not using the normal Build Phases for some reason, you need some other way to get it copied to Contents/Resources/MyApp.icns at build time.)
Your Info.plist should have an Icon file (raw name CFBundleIconFile) named MyApp, with no extension.
That's all there is to it.
In the project navigator, select an asset catalog.
Choose Editor > Add Assets > App Icons & Launch Images > New OS X Icon.
An empty OS X icon set is created, with an image well for each image representation in the set.
Drag icon file from the Finder to the appropriate image well in the set viewer.
Alternatively, you can add images by selecting an asset catalog, and choosing Editor > Add Assets > Import.
I am pretty sure you will have to put your icons into the project and then recompile. Let us know how it goes.

How can I set the icon for a Mac Application in Xcode?

I have been learning a lot about writing Objective-C code and designing in Interface Builder and I wanted to set icons for my simple programs.
I added the same JPG to all the size fields in Icon Composer and got an ICNS, but I couldn't figure out how to add it to the project.
Thank you in advance.
Since Xcode 4.4 Icon Composer is no longer the recommended way to create icons and is no longer included in the standard install of Xcode.
Due to the introduction of Macs with retina display, it is now recommended to provide high resolution versions of all graphics including app icons.
To give your app an icon under Xcode > 4.4 do the following:
Create a folder [IconName].iconset in Finder
In this folder place your icon as png files. You'll need the icon in
sizes of 16px, 32px, 64px (retina only), 128px, 256px, 512px and
1024px (retina only)
These icons must be named with the pattern icon_16x16.png,
icon_32x32.png, icon_128x128.png and so on
To support retina displays you must also add icon files with double
resolution, named icon_16x16#2x.png (with size 32x32),
icon_32x32#2x.png (size 64x64) and so on up to icon_512x512#2x.png (size 1024x1024).
drag this [IconName].iconset folder to Xcode (copy if necessary)
in the info.plist file set the "CFBundleIconFile" (Icon File as Key) value to
[IconName] but without the .iconset extension
Annotations:
it is (currently) not required to provide the #2x icons
it will (usually) also work if you don't provide every icon file
the iconset folder should not contain a icon_64x64.png file. the 64px icon is only for the retina version of the icon_32x32
Update:
In the end your .iconset folder has the following 10 items:
icon_16x16.png
icon_16x16#2x.png
icon_32x32.png
icon_32x32#2x.png
icon_128x128.png
icon_128x128#2x.png
icon_256x256.png
icon_256x256#2x.png
icon_512x512.png
icon_512x512#2x.png
Official guide:
https://developer.apple.com/library/content/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Optimizing/Optimizing.html
Additional information:
To convert the iconset folder to an icns file, run the following command on the terminal:
iconutil -c icns [IconName].iconset
where [IconName] should be replaced with the prefix of the iconset folder. You now have a file called [IconName].icns. In Xcode 4.4, in the Target Summary, right click the question mark for the icon, then select the icns file. You should then see the question mark get replaced with the icon.
As of Xcode 7 (not sure when this was originally introduced), you can use the Assets.xcassets file for app icons. This file is included by default for new projects.
Simply:
Go to your target's settings and ensure that under General, App Icons the Source is set to AppIcon.
Add all 10 png icons to your Assets.xcassets's AppIcon image.
Delete derived data if you have launched the app before, otherwise it will continue to show the default icon.
Run the app; it should now show your icon in the Dock, Application Switcher, and anywhere else it should appear.
Follow these steps to add an application icon to your project. This is the icon that will be show by the MacOS in the doc bar and alt-tab display.
Create an icon .icns resource file
Place it in the "resources/macos" folder
Add it to the resources group in the xcode project
Edit the Info.plist file and change the "CFBundleIconFile" value string to "icon"
Also, img2icns tool can come handy to convert images to an icon.
It's easy
Use automatic tool (Such as IconFly) for create correct ICNS or iconset with all necessary size.
Then drag and drop created ICNS or iconset to Xcode.
in the info.plist file set the "CFBundleIconFile" value to [IconName]
Steps to add an application icon to your cocoa project.
Find 'Icon Composer' from spotlight.
Drag and drop the icon(name should be like imagename.icns) in the given boxes.
Select one box and save it.
Drag and drop the saved image in the Resources folder of your application.
Select target-->right click on project name-->Select GetInfo.
In Properties enter the name of 'Icon File'.
Now Clean Build and run your application.
Xcode 8.2.1
Convert .png 👉.icns via IconMaker
Add the AwesomeApp.icns file in the same folder as info.plist
Drag AwesomeApp.icns file into xcode in the same folder as info.plist
In info.plist set icon: to AwesomeApp.icns
Step 1: Get iconfile name from info.plist and place icns(icon file) folder in SourceCode/resources folder
Step 2: And same thing goes for xcode,you have to copy all images from xcode using copyallframeworks or copyall resource file in your xcode and build the app again.

Resources