0

EDIT:

I'm now also having issues setting a UIImageView to a PDF File thats in the Assets.xcassets folder.


Relatively new. (~8 months) so this is my first time experience a major software release.

I have some code the preloads data on the first launch to populate CoreData. And in iOS 14, theres an issue with some of the images being converted from a PDF file in the Assets folder into JPEG binary Data. (Note: Not all of the images, but some)

Replacing the image in the folder doesn't fix it, but adding other images works just fine.

I also tried the iOS 13 simulator and it is (still) working and loads data as intended.

It appears theres an issue with this line of code:

// images: [UIImage]?

if let imagesArray = images {
for (i, imageData) in imagesArray.enumerated() {
    if let imagePNGData = imageData.jpegData(compressionQuality: 0.9) {

imagesArray makes the optional Array non-optional. And then it runs a loop to convert the UIImage into Data.

However, I added some print commands and got this:

images?.count:  Optional(3)
Inside:  if let imagesArray = images {
Inside: for (i, imageData) in imagesArray.enumerated() {

New Loop: --- 0
(i, imageData):  0 :  <UIImage:0x600000a7e1c0 named(main: untAmberCelodonthree) {792, 612}>
inside:  if let imagePNGData = imageData.jpegData(compressionQuality: 0.9) { 
imagePNGData:  0 bytes
End: Loop 0:

New Loop: --- 1
(i, imageData):  1 :  <UIImage:0x600000a7df80 named(main: untAmberCelodonTwo) {612, 792}>
inside:  if let imagePNGData = imageData.jpegData(compressionQuality: 0.9) { 
imagePNGData:  0 bytes
End: Loop 1:

New Loop: --- 2
(i, imageData):  2 :  <UIImage:0x600000a7e2e0 named(main: untAmberCelodon) {612, 792}>
inside:  if let imagePNGData = imageData.jpegData(compressionQuality: 0.9) { 
imagePNGData:  1035328 bytes
End: Loop 2: 
End:  if let imagesArray = images {

I'm not entirely sure why the UIImage isn't being converted to data...

But basically, is this an Xcode/IOS14 issue? Or am I doing something wrong?

StonedStudio
  • 507
  • 3
  • 20
  • 1
    "I'm now also having issues setting a UIImageView to a PDF File" Could you ask about that one separately? – matt Sep 18 '20 at 19:40
  • Hey Matt, Thank you for the response. I believe the problems are related. And has to do with something with the Xcode 12 update causing issues loading files inside the Assets folder into a UIImageView. So I'm not sure asking the question so soon in a different way would be beneficial? – StonedStudio Sep 18 '20 at 19:45
  • 1
    OK, well, that's up to you. If you wanted _me_ to help then I'd need the PDF separately because that's something I know something about. – matt Sep 18 '20 at 20:03
  • I understand. I don't believe it's the PDF as theres multiple different PDF files made at the same time that do work. But I'm by no means have any idea what I'm doing. And I'm very lost. But things were working just fine before updating to Xcode 12. – StonedStudio Sep 18 '20 at 20:12

0 Answers0