I am trying to set image to UIImageView. Its working well in older version.
In Xcode 9.4.1
But in Xcode 10
When I am trying to type name of image, image suggestion is not showing.
Even "Image Literal" is not working. Double clicking on above icon also not working.
Is there any setting in Xcode preferences?
How to enable image suggestion like before?
In Xcode 10 and Swift 4.2, only the code completion function (or auto-complete) of the Xcode IDE has been discontinued for the old way. Here is the new way:
Just type image literal and it will complete with default icon.
Double click on this icon and it will open the media library right side of it.
Just choose your image and it work like before!
Hope I am able to help you!
https://download.developer.apple.com/Developer_Tools/Xcode_10_beta_3/Release_Notes_for_Xcode_10_beta_3.pdf
Code Completion for Swift image literals has been removed in Xcode 10. (38087260)
There seem to be some real issues with how Xcode 10 handles image literals, especially when the name you provide your assets doesn't align with the filename of those assets.
The following are the steps I've found will restore image literal previews.
Add an image via the media library picker.
If you have multiple resolutions for your image (e.g. #1x, #2x, #3x), Xcode will inconveniently drop them all into your code and throw an error to let you know you've done something naughty.
Delete two of the faulty image previews, if necessary. You may be left with a default image icon instead of a preview of your actual image.
Comment out the lines on which you're setting the image. You'll see the image literal references the filename of your asset rather than the name you've provided in the asset catalog.
If you've renamed your assets after adding them to your asset catalog, this seems to sometimes prevent Xcode from reading the asset appropriately.
Change the filenames to the appropriate asset names.
You can find the asset names in your asset catalog.
Uncomment the code and, if the default image icon is still visible, double click on the image icon. It should then display a preview of your actual asset.
You may also need to clean and rebuild your project.
use command + shift + M to popup the Media Library then Simply Drag and Drop into your Code
OR
I have some code that will select an image from either the user's photo library or from their camera and display it in an image view. I'm accessing the photo URL from the following line of code:
let pickedPhotoURL: URL = (info["UIImagePickerControllerImageURL"] as? URL)!
This works perfectly when accessing a photo from the user's library. However, I'll always get a nil value at this line why trying to access the photo via the camera. Anyone have any ideas / suggestions?
It's because that value isn't set for a camera. Use UIImagePickerControllerOriginalImage (or edited image if you are using that).
That key gives you a UIImage -- if you need a URL, you need to save it somewhere.
Also, don't use strings, there are keys defined for you.
When I tried to submit an App to Itunes Connect I got the following error.
iTunes Store Operation Failed
Error ITMS-90717: "Invalid App Store Icon. The App Store Icon in the asset catalog in 'YourApp.app' can't be transparent nor contain an alpha channel."
I made sure that I submitted a file with no transparency. So the error persisted in submission to iTunes Connect.
The below solution worked for me
Click & open the App Store icon (1024*1024) in the preview app.
Export it by unticking the Alpha channel.
Replace the current App Store icon with the newly exported icon image.
Validate and upload.
Note: This will not work on Mac OS High Sierra, please try a lower version to export without alpha or use any one of the image editing applications or try out the below alternatives.
Alternative 1: (Using Sierra or High Sierra and Ionic)
Copy and Paste the App Store icon to the desktop.
Open the image. Click File Menu->Duplicate.
Save it by unticking the Alpha channel.
Replace the current App Store icon with this one.
Validate and upload.
Alternative 2: If duplicate does not work, try doing opening it in preview and then doing file export. I was able to unselect the alpha channel there. – #AlejandroCorredor.
Alternative 3 : Using High Sierra and Ionic, found the problem image in the following folder: [app name]/platforms/ios/[app name]/Images.xcassets/Appicon.appiconset/icon-1024.png. We have to copy it to the desktop and Save As while unchecking Alpha, then rename it to icon-1024.png, then delete the original and copy the new file back to the original folder. Export did not work though no error was displayed and all permissions were set/777. – #RalphHinkley
I faced the same problem and wasn't able to fix it with the provided solution by Shamsudheen TK. Ionic somehow added transparency to my icons even if the source icon did not have any transparency at all. In the end I was able to resolve it by:
Install imagemagick (MacOS):
brew install imagemagick
Remove alpha channel from all images in resource folder:
find ./resources/ -name "*.png" -exec convert "{}" -alpha off "{}" \;
Here is a solution that have worked for me on High Sierra
Open the App Store icon (1024*1024) in Preview app(default OSX image viewer).
Click on the File menu from the menu bar and select Export.
view screenshot
Uncheck Alpha, select where you would like to export the image and click on the Save button. view screenshot
Replace the current App Store icon with the newly exported icon image.
Validate and upload.
For anyone arriving to this question from Flutter, like myself:
In your pubspec.yaml:
flutter_icons:
android: false. // I already had android icons
ios: true
remove_alpha_ios: true
image_path: 'assets/images/icon.png' // Your image path
Run flutter pub get
Run flutter pub run flutter_launcher_icons:main to generate the iOS icons without alpha.
This fixed it for me after days of struggling. And yes, I did try all the solutions suggested here. Nothing else worked.
If you are here and you are using Flutter, try this package https://pub.dev/packages/flutter_launcher_icons
Then add
flutter_launcher_icons:
flutter_icons:
android: true
ios: true
remove_alpha_ios: true
image_path: "assets/images/logo.png"
to your pubspec.yaml file
It solved my own problem for me
Whatever way you try above you need to test it by upload it to app connect like me to make sure it works and save your valuable time
If showing this error for ionic3 project when you upload to iTunes Connect, please check this ANSWER
This is my project error when I try to vilidated.
Finally follow this ANSWER, error solved.
Dumb mistake from my part, didn't archive the app after removing alpha. Just kept submitting my old archived app and finding same alpha/transparency error. Hope it helps someone.
Invalid App Store Icon. The App Store Icon in the asset catalog in 'YourApp.app' can't be transparent nor contain an alpha channel.
Solved in Catalina
copy to desktop
open image in PREVIEW APP.
File -> Duplicate Close the first opened preview
after try to close the second duplicated image, then it will prompt to save there you will available to untick AlPHA
look into my screenshot
An error message itself says:
"Invalid App Store Icon. The App Store Icon in the asset catalog in
'YourApp.app' can't be transparent nor contain an alpha channel."
All app icon must be square without transparency or semi transparent (alpha value != 1.0).
Hint: App icon may have rounded corners. (Share your app icons here)
Here is Apple guidelines for App Icon - Human Interface
If you’re using Sierra or later
Navigate to AppIcon.appiconset folder within your Runner folder
Open App Icon image using preview.
At the topmost left of your screen select File its beside edit.
Within the file drop down select export.
Deselect alpha list item.
Replace the deselected alpha image with old one.
Replicate this for all App Icon images in your Assets.xcassets
Generate App icon from here https://appicon.co/
Delete Assets.xcassets file (project->ios->runner)
Copy Assets.xcassets from newly generated icons folder and past here (project->ios->runner)
perform clean build folder from XCode
then archive and upload new build
I tried several of the things mentioned in this post (besides swapping to a .jpg) with no success. I solved it by opening the file in photoshop and using 'export to web'. Within that process/window is a checkbox for transparency.
If you don't have a mac, on windows you can open Paint and save as PNG with correct dimensions 1024x1024
Remove the alpha channel using this command in the folder 'Images.xcassets', this command will remove all alpha channels from your .png files and it will put the background color to white
for i in `ls *.png`; do convert $i -background white -alpha remove -alpha off $i; done
If you're facing this issue in Flutter then you're good to go here.
Issue is indicating you're using .png as image asset. Just try to replace .png to .jpg and build your project again..!!
Use this plugin. - flutter_launcher_icons: ^0.8.1
flutter_icons:
android: "ic_launcher"
image_path_android: "assets/logo_panda.jpg"
ios: true
image_path_ios: "assets/logo_panda.jpg"
Make sure you're using the .jpg image extension as the image path.
This help me to upload the app to the App Store.
Use Alpha Channel Remover. It lets you drag icons into the app and it'll remove transparency.
Download it from here: http://alphachannelremover.blogspot.com
Update: this is not my site
I had this problem and it was because my app store icon wasn't explicitly listed in my config.xml. Once I added the line
<icon height="1024" src="www/res/icon/ios/icon-1024.png" width="1024" />,
cordova copied it over correctly without adding an alpha channel.
I was able to get around the Mac Sierra OS issue by duplicating the file, dragging the new file onto my desktop, open in preview, then click the export option (in the File menu) , then the option to save it without “alpha” comes up
I also shell script using ffmpeg to resize images without alphachannel. It worked for png format fine.
# Export ios app icons by ffmpeg scale command
# usage: sh export_ios_icons.sh {path_to_your_img}
# example: sh export_ios_icons.sh ./app_icon.png
# sizes of images
# you can get other size images by editing thisarray
size=(20 40 60 29 58 87 80 120 180 76 152 167 1024)
for i in "${size[#]}"
do
:
ffmpeg -i $1 -vf scale=$i:$i output_$ix$i.png
done
Alternative:(Using Sierra or High Sierra and Ionic)
Copy and Paste the App Store icon to the desktop.
Open the image. Click File Menu->Duplicate.
Save it by unticking the Alpha channel.
Replace the current App Store icon with this one.
Validate and upload.
I also tried exporting without alpha it did not work for me but I figured it out that why I was getting error. I create an AppIcon using Figma & Sketch, but I tried to make a 2D geometry shape to 3D viewable. So I assume that I can achieve it by using some shadows & the same geometry but with lower alpha-like %70. After that, I got the AppIcon and export it without Alpha ticking but the problem was the main source of the image includes a container with lower alpha-like I did. So I change it to another graphical shape without alpha and it worked.
I am using Windows so in my case I used paint.net.
Open the icon in question and click Ctrl+S
A Save configuration dialog will pop out.
Select 24-bit Depth
After this icons got accepted.
P.S
Another option colleague suggested was to simply open with ms paint and save it, since paint does not support transparency, but I haven't tested it.
changed the icon from .png format to .jpg and everything went well.
I am writing an app that has a simple form with a photo upload tool, the user uploads their photo to the form and it is displayed in an image view, i then want that image to be in the blank e-Mail that opens up upon clicking submit. I am using the following code to try and achieve this:
let messageBody = "\n\nPhoto: \(imageView.image!)"
The photo gets uploaded and shows in the image view fine but the email displays the following where the image is supposed to be " size {1334, 70} orientation 0 scale 1.000000"
Any help would be greatly appreciated!
Your code (or my previous answer) won't work because you are converting the image to a string (messageBody). And it basically shows you a string of information about the image. So your only option is to write the message in HTML (and set isHTML to true). The good news is that it isn't too hard.
I think the code below should work.
let messageBody = "<html><body>Photo:<img src=\"yourImage.png\"></body></html>"
I want to take a photo and save them within a custom album on a iPad.
I tried a lot of things but ended always with wrong image orientation.
My current procedure is:
Take photo with Xamarin.Media and safe image somewhere in my app path
Create custom album if it's not existing
Load image from temporary path and save to the album
Add the image (asset) additionally to the custom album created in 2.
The workflow above is fully working except of saving the correct orientation. After loading an image with library.AssetForUrl() the containing orientation is every time up. Also after converting from asset -> CGImage -> UImage (uiImage.Orientation).
In step 3 I tried to set the orientation the the appropriate one with
var image = new UIImage(tempImage.CGImage, 1.0f, UIImageOrientation.MyOrientation)
and also with the save command
library.WriteImageToSavedPhotosAlbum(image.CGImage, myOrientation, SaveCompletionBlock)
But the orientation is still ignored. I checked this by opening the Album application as well as loading the file in my self written gallery app.
I want to avoid the use of the iOS picker to take photos. This will produce a mess of code!
Or is there any third party library which allows to take photos and store them in a custom album? Which takes care of all the metadata information? It doesn't matter if it's written in objective-c or c#. I will create bindings for it. But it's awful to work with the camera and albums in iOS.
There are tons of hand-made UIImagePickerController alternatives. Some of them:
https://github.com/w5mith/WSAssetPickerController
https://github.com/chute/photo-picker-plus-ios
https://github.com/B-Sides/ELCImagePickerController