Precondition Failure: Invalid Input Index When Using Geometryreader in Swiftui Starting with iOS 13.4

iOS 13.4 Crashes app with vague message: precondition failure: type check failed: 101, expected Text, got _HiddenModifier

Found the issue:

This line of code, which i added to avoid screen glitches in swiftUI caused it:

Text("").hidden()

commented it out and it all works fine..

weird!

precondition failure: type check failed: 104, expected Image, got _ColorInvertEffect with .colorInvert() in SwiftUI on iOS 13.4

I ended up working around this by changing my loadWitnessSignatureImage function to invert the colors of the UIImage using an extension of UIImage

The revised loadImage function:

    func loadWitnessSignatureImage() {
guard let witnessSignatureData = release.witnessSignature?.storedData() else {
return
}

let img = UIImage(data: witnessSignatureData)
if colorScheme == .dark {
witnessSignatureImage = Image(uiImage: img!.invertedColors()!)
} else {
witnessSignatureImage = Image(uiImage: img!)

}
}

The .invertedColors() extension:

extension UIImage {
func invertedColors() -> UIImage? {
guard let cgImage = self.cgImage else { return nil }
let ciImage = CoreImage.CIImage(cgImage: cgImage)
guard let filter = CIFilter(name: "CIColorInvert") else { return nil }
filter.setDefaults()
filter.setValue(ciImage, forKey: kCIInputImageKey)
let context = CIContext(options: nil)
guard let outputImage = filter.outputImage else { return nil }
guard let outputImageCopy = context.createCGImage(outputImage, from: outputImage.extent) else { return nil }
return UIImage(cgImage: outputImageCopy, scale: self.scale, orientation: .up)
}
}

iOS 13.4: didSet() not called anymore for a @Published Bool when using toggle()

It has been solved with today's Xcode 11.5 Swift 5.2.4. Good!

encrypting assets (video files) in Adobe AIR

I solved this for a DVD application encrypting all the assets in the DVD and executing a HTTP Server inside the AIR application that decrypts it.

It works in this way:

1 - The images, videos, or assets are encrypted and saved anywhere, in our case the DVD assets folder with a master key.

2 - The Air application contains inside a very simple HTTP server who reads the file decrypts it and send it only to the same Air application using a simple Flash Video Player or using a tag like <img src="localhost:5050/assetcode.jpg">

The code used inside the air application to serve the file is like:

import com.hurlant.crypto.prng.ARC4;
import com.hurlant.util.Hex;
import com.hurlant.crypto.Crypto;
import com.hurlant.crypto.symmetric.ICipher;

var key:ByteArray = Hex.toArray(Hex.fromString("masterkey"));
var rc4:ARC4 = new ARC4(key);

var fs:FileStream = new FileStream();
fs.open( content, FileMode.READ );
var ba:ByteArray = new ByteArray();


fs.readBytes( ba, 0, fs.bytesAvailable );
ba.position = 0;
fs.close();



rc4.decrypt(ba);
//cipher.decrypt(ba);

innerSendHTML(s, ext2mime[content.extension], ba );

ba.length = 0;

We use the RC4 algorithm because it's the faster in our tests.

For the HTTP Server we used a sample http application from the Flash Camp 2010, you could find it in google.

Regards

--

www.imaginacolombia.com



Related Topics



Leave a reply



Submit