How to display images in Muti-Platform Xamarin.Forms Project on iOS - xamarin

I've got a Xamarin.Forms Project containing an Android and an iOS Platform Project.
I've got my whole application working on Android and I am now struggling on the iOS part. I can't get my images to display on iOS.
I've followed the Microsoft guide on how to work with images on Xamarin.iOS, but it's simply not working.
I have created a minimum example from a new project and uploaded it to GitHub, it can be found here.
Output: On Android, the image is being displayed fine, on iOS, the screen stays empty. In addition to that, the logs I've added to AppDelegate.cs show, that the images cannot be found by using UIImage.FromBundle()
I've also checked the CSProject file of the iOS project, but it already contains the <ImageAsset> item groups.
I am on Visual Studio Professional 2022 (Windows) Version 17.4.1
Can someone please have a look into this? I am going crazy...

I have test your project with the Visual Studio 2022 for mac. And I had the same results in the Android platform and ios platform. The small car icon will show at the top of the screen.
But for the iphone 14 pro simulator, which has a notch screen. The car icon almost be covered. So you can try to run it on the ipad or a device without notch screen to check the car icon will show or not.
In addition, I have checked your Assets.xcassets folder and the official sample on the github. There is no a such xxx_vector folder in it.

Background information:
What's deprecated (but still works) is individual resource files (aaa.png, aaa#x2.png), with no xcasset.
An xcasset containing those files is not deprecated. Nor is it likely to become deprecated in the future.
If you still want to test with .pdf containing vectors:
What is problematic about your setup is that you have TWO representations of car_settings. One with .pngs, one with vector pdf.
What happens if you remove the xcasset with .pngs, and rename the one with pdf to match the filename in it? (car_settings xcasset, with car_settings.pdf).
Close VS, and delete all .bin and .obj folders after making this change, to ensure VS correctly rebuilds with the vector version.
If this still fails, then you likely have encountered a bug. Add as an issue at github xamarin forms issues. Be sure to mention the versions of VS and Xamarin.Forms that has the problem.

Related

Missing Marketing Icon iTunes Connect

I have uploaded a couple of applications to the app store with ease. Sometimes I noticed this warning in xCode when I uploaded my app:
Missing Marketing Icon. iOS Apps must include a 1024x1024px Marketing Icon in PNG format. Apps that do not include the Marketing Icon cannot be submitted for App Review or Beta App Review.
But that was not impeding me to send my app for review in iTunes connect... until now.
I have found a few questions about this but none of those have helped me solving my problem. For example, following advise given here I tried adding my icon width xCode in the AppIcon.iconset file but it doesn't work if I do it after packaging my app with appcelerator (I guess that is the normal outcome). But if I do it and the package again, the icon disappears from the file (I think this is because appcelerator generates those files on its own).
How do I add that icon so appcelerator won't remove it when I package?
Or how do I add it to appcelerator so it generates the iconset including my marketing Icon??
I believe I have followed the guidelines completely (My icon is a .png file, its size is 1024x1024 and has no alpha channels nor transparencies) maybe the naming is not correct but I have not found any specific naming for this case.
Use the latest SDK (6.2.2.GA). It was fixed in 6.2.1.GA (https://github.com/appcelerator/titanium_mobile/pull/9451).
If you can't use it you could add the changes in the PR to your _build.js file

Appcelerator App Conversion iOS to Android.

One of our developer developed an app in appcelerator using alloy framework for iOS which works fine. Now we want to run the same app in Android, since the appcelerator is a cross platform tool, we wish to make the Android version of the App. I tried searching about it and explored the applcelerator ide for options but couldn't find it. Can some one please guide me into the right direction?
First of all have a look at this link : http://docs.appcelerator.com/platform/latest/#!/guide/Supporting_Multiple_Platforms_in_a_Single_Codebase this will guide you to update the application for multiple platforms.
Their are basically two different ways to port any application from android to iOS or vise-versa, but before that just let me clear one more thing to you about tiapp.xml.
In the tiapp.xml of your project you need to updated the Development Target by checking for which platform you are developing the application for (iPhone, iPad, android, Mobile Web).
Option 1 :
Cross Platform is build to make code re-usable (i.e. re-use same code for all the platforms), but we have exceptions with many things. Their are lot of components that work fine in iOS but when you use them in android then you will face errors. So in that case you just need to apply conditions for android and iOS like below :
if(OS_ANDROID)
// do something
else if(OS_IOS)
// do something
What you need to do is that you need run the application in android simulator and test the application for these changes and then apply the changes accordingly.
Basically a developer has to target the UI for both the platforms, as their will not be any logical differences between the two. Also their will be UI changes between the same components, like for example a picker in iOS will not look the same as it will when you look it in an android application.
Option 2 :
Now in the project you have assets folder with the platform that you have selected in the tiapp.xml (i.e. iPhone, android etc).
You can create similar structure in the style and view folder, create two folders iOS and android in both the directory (i.e. style and view).
First, move .tss of style folder (except app.tss and index.tss) in the iOS folder, then copy the files in the android folder also.
Repeat the similar process with the View folder also.
Now you have two different structures (i.e. view and styles) according to their platform. Now you can run the application in android simulators and resolve the error that you face.
Hope this small information helps the cause, you can also have look at the documentation of all the components from below link :
http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.TableView

why there is so much confusion surrounding launch screen in xamarin.ios

In image asset editor we can add launch image but it'll not appear in devices I can say atleast iPhone devices but If you ignore to add LaunchImage in assets xamarin won't let you compile the app.so you have to add the LaunchImage and at the same time you have to have Launch Screen.storyboard Why is this anomaly ? and how to keep on using static images
I have created separate imageset in asset library and added a image view in launch screen and referred that newly added imageset but its not working screen appears empty
It's not a Xamarin problem, but iOS itself.
Launch image required for iOS version lower than 8.0. So if you want to support them, you need to add all images in to assets.
LaunchStoryboard you can use for all iOS version above 8.0 (included). It will stretch out automatically for each device.
You can select most appropriate solution for your project in Info.plist

ERROR ITMS-90022 Missing Required Icon File

I was hoping someone could help me with an issue. I was attempting to upload my app to the App Store when suddenly I received an error message stating that I had a missing icon file. The error was:
ERROR ITMS-90022: "Missing required icon file. The bundle does not
contain an app icon for iPhone / iPod Touch of exactly '120x120'
pixels, in .png format for iOS versions >= 7.0."
I haven't modified any of my icons but I did notice that when I updated the info.plist file to change the Build Number I noticed that the file had additional settings for "Car Play" and a few other devices which I hadn't specified any images for.
My plist.info file references an Asset Catalog and I have icons for IOS 7-9 specified. Im not sure what Ive done wrong.
Ive built my icons using the website https://makeappicon.com/ and Ive uploaded two previous versions of my app to the app store already without any issues. This is the first time this has happened.
Ive update XCode to v7.2, also updated the OS and applied all updates to Xamarin Studio.
Ive seen a few other people on the forums with this problem and they suggest changing the plist.info file to include the following:
<key>CFBundleIconFiles</key>
<array>
<string>Icon-60#2x.png</string>
<string>Icon-76.png</string>
<string>Icon-76#2x.png</string>
</array>
This still doesn't work and the verification process fails. Furthermore, I don't think I should have to do this if my plist.info is referencing the asset catalog.
Has anyone got any ideas?
Thank you
Adam
As unsatisfying as it is, I was able to resolve the same issue with my default issue resolution steps I have.
Updating Xcode (to v7.2.1 in this case)
Launch Xcode to install extras
Updating Xamarin (Xamarin.iOS to v9.4.1.25 in this case; Xamarin Studio stayed at v5.10.2)
Restarting machine
Clean the project (obliterating the output first probably doesn't hurt)
Archiving again
I had this ITMS-90022 and two ITMS-90023 errors that both went away after that.

Launch image doesn't update

I'm using Xcode 4.3.1. Adding launch image is pretty simple -- just drag the image to the Project->Summary->Launch Images window.
So I set a launch image before and it worked. But when I dragged a different image and run the app on my iPhone again, the launch image still remain the same as the old one. Even after I delete the launch image from the Launch Images window, the old image still shows up upon launching.
I've tried clearing the build as well. Didn't work.
Help please. Very much appreciated!
I had the same issue, but with launch storyboard. I had to rename the image I've used as a background.
Deleting from the device didn't help with Xcode 4.5.1. The build process is caching the image. With a hint from Zorayr's answer to related question "Xcode, can't remove “Launch image” from project," I decided to track the cached image down and destroy it, so it wouldn't keep being built and showing up in my test App.
Eventually, I found that Xcode (at least 4.5) builds the images by default in the following path off your home directory:
~/Library/Developer/Xcode/DerivedData/<ProjectName>-<uniqueID>/Build/Products/<Scheme>-iphone{os,simulator}/<ProjectName>.app/
So in addition to removing the old App image from the device (or simulator,) you also need to remove the image file(s) from the build cache. But just doing something like
rm ~/Library/Developer/Xcode/DerivedData/MyProject-fpwnjlbayydgzxcdlyrwxrwntapr/Build/Products/Debug-iphoneos/MyProject.app/Default*.png
won't always solve your problem. Instead, you might get a strange error in a popup window saying something like "Signed product moved or deleted." (I can't reproduce it right now to get the exact text.) It doesn't show up in the log file, and it just hangs the build process (in Xcode 4.5.1.) To get around that, I deleted all of the files under the <ProjectName>.app/ directory tree and the sibling directory tree <ProjectName>.app.dSYM/ containing (seemingly) the symbol tables and signature files for the parallel products. The build process will then re-create everything with no more complaints.
What worked for me on iOS 10.2.1, iPhone 5s hardware test device, Xcode 8.2.1
I think it has nothing to do with Xcode. The test device appears to be caching the LaunchScreen.storyboard image. I needed to reboot my device by holding home + top button. Then I rebuilt, low and behold, the image updated.
You should delete the app from the device, then launch it again.
Quit the simulator and then run the project again.
For device, as mentioned in other answers, delete the app from the device and then run the app again.
Steps that worked for me in 2020 (xCode Version 11.4.1):
Delete derived data
Restart xCode
Delete app on device
Restart device
Clean rebuild and run
Except the last step, I think the order doesn't matter.
It's really annoying though and I'm not even sure if it always works.
Pretty pathetic on apple's side. Good luck guys!
If you were using an asset catalog, it can also help to delete the images from the Images.xcassets file, and then load them manually in General>Launch Images.
This is what worked for me
Put the new image in project folder
Run app on device/simulator
Put image in xcassets under a different name
Run app again and it works
I thought I would create an update for anyone who is XCode 10 (and possibly XCode 9) and experiencing a blank black or white screen after modifying a launch image.
In my case I had to create launch images for the iPhone XR, iPhone X, iPhone XS and iPhone XS Max.
Originally I just had a sample white launch image for testing. After creating my proper image for the XR and replacing the sample the change would simply never show (on the XR device). I would still get a white screen.
I tried all of these in combination and failed:
-deleting the app beforehand.
-deleting xcode derived data and cleaning the build.
-restart Xcode and the device and the computer.
-deleting any existence of the white launch image on the computer.
-manually editing the JSON in a new images asset with the correct file names
The XR device would continuously show a white screen and after meddling with the build setting and migrating back to image packs it turned to black.
Solution:
Ultimately it started working after I also replaced the white 'XS' launch image with a new one as well. Even though the device is an XR. This is an odd solution but solutions like this have helped with launch images throughout the years.
For me, quitting the Simulator and restarting it worked -- I can finally see the updated launch image. The note above from Emil Korngold triggered me to try this.

Resources