Cannot replace an image by replacing the image files in Finder - xcode

I would like to update some images (gif) in my application. After replacing the gif files in the folder, I build the application and run it; the images shown in simulator are not updated. I tried to "Clear all target" and then re-built the application; the new images can be shown in the simulator.
Does it mean the images will be successfully updated in the devices which have installed the older version of the application? Should I modify the code?

You would need to "Replace" those image by the same names as in the earlier build.In this way even if your app is in the App Store, after submitting your update with the new images having the same names can be updated easily.
No need to modify your code.

Related

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

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.

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

Xcode icon / launch screen catalogs with empty images

I have an old project (xcode 6) which is using icons and launch images by naming (placed in the root folder and added them through the info.plist).
The thing is, I would like to start using xcode catalogs for icons and launch images but I realized I don't have many of the assets they are requesting in those catalogs.
I was thinking in just filling the ones I have, but I'm afraid Apple will reject my version once I upload it to the itunes. Anyone knows if you can just leave empty images?
Use this - "Migrating Your Images to an Asset Catalog" Xcode will give you warning for all missing icons based on your deployment target
https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/AppDistributionGuide/ConfiguringYourApp/ConfiguringYourApp.html#//apple_ref/doc/uid/TP40012582-CH28-SW5

Launch image doesn't update in xcode 4.5 with Cordova 2.1

I'm using Xcode 4.5, Cordova 2.1 , iPhone4 (IOS6). 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. And I have try to delete the app in my devices.In the simulator it works well.But in my iPhone4(with ios6) it doesn't.I have tried this again and again.But I can't find the solution.
In before,I often use my images to change the default launch images in the folder.But this time,it doesn't work.
Does anybody know the solution of this problem?
You have to change these images in your project
Splash/Default#2x~iphone
Splash/Default~iphone
Either be sure to have the option of splash screen in Cordova.plist, AutoHideSplashScreen to YES.
But putting my images in the right format works fine.
For me it display firstly an image full screen, and then the image of splash directory.
"The launch image remains the same as the old one" - this is unfortunately not a Cordova thing, there's just something screwy going on with Xcode and your device. Try rebooting it. For the Simulator, sometimes it fixed it for people once they Reset the simulator as well.
Finally I solve this problem by myself.Follow these steps and hope that you would success.
1,Prepare your image files and add into the project folder.Remember that you should use xcode to add your files in to the Group.
2,Edit your info.plist file.Add a key -> "Launch Image" , Value -> "[Your File name]"; key -> "Launch Image (iPhone)" -> "[Your File Name]";
Try to test your project.If it doesn't work,you should edit your CDVViewController.m.(It is in the CordovaLib(Cordova Lib -> Classes -> Cleaver -> CDVViewController.m ).
3,Replace "Default" as your File name in CDVViewController.m
Ok.It works now.
(P.S where the default png files come from ... ? :-( )

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