Post

Replies

Boosts

Views

Activity

Loading an Image in an Widget View
Primary Objective My Widget displays pictures from a list. If I load in all the pictures when setting up the timeline, I run into a memory issue (EXC_RESOURCE RESOURCE_TYPE_MEMORY), because Widgets have a strict limit on how much memory they can use. My Solution Instead of storing a UIImage in my timeline entry, I store the URL to the picture, and load it with a .taskattached to the view. This works, when the view is displayed in the app, and is also shown in the Preview window. The Problem The image is apparently loaded, but not updated for the Widget. Not if running in the simulator or on device, or in the Preview canvas. The Question Obviously: Am I doing it wrong? Do I need to update my timeline more conservatively? Can I load the pictures on demand? Is there a different way of doing this? The Sample Sample code illustrating this can be found here: https://github.com/below/WidgetSample
0
0
2.1k
Oct ’22
Diffie Hellman Key exchange with .Net Cryptography
Hello, I am attempting to perform a Diffie Hellman Keyexchange with a server running on .Net. However, the secretKey I am creating on the client side does not match with the secretKey on the server side, which I have for testing purposes. I can import the server secret key as a SymetricKey, and if I use it to seal and open a box, it works. However, if I seal the box with my client key, I can not open it with the server shared key. I create the SymetricKey like this: let sharedHash = SHA256.self let sharedInfo = serverPublicKey.rawRepresentation let sharedLength = 32 let symetricKey = sharedSecret.x963DerivedSymmetricKey( using: sharedHash, sharedInfo: Data(), outputByteCount: sharedLength) The server key is created using .Net like this: bob.KeyDerivationFunction = ECDiffieHellmanKeyDerivationFunction.Hash; bob.HashAlgorithm = CngAlgorithm.Sha256; bobPublicKey = bob.PublicKey.ToByteArray(); bobKey = bob.DeriveKeyMaterial(CngKey.Import(Alice.alicePublicKey, CngKeyBlobFormat.EccPublicBlob)); My assumption is the keys should be the same. Is that correct? How can I find out what format the server key is in? The .Net documentation is not particularly precise on that You can find a Playground of my code, and when you google for ECDiffieHellmanCng Class, you will find an example on what .Net does. Any help is appreciated
2
0
1.4k
Aug ’23
WKWebView: Select Text and scroll beyond what's visible
Prime Objective I am trying to have a scroll view with a fixed header, a fixed footer, and a WKWebView in between. Using JavaScript, the height of the webView is determined and set to be large enough to hold the entire content. The Problem When selecting text on the webView, the view does not scroll when the edges are reached (this works if the webView is shown without being embedded in a Scroll view, or if it is the last element) What did I try? I tried reading the scroll view, or adding a gesture recognizer, but all of that does not work because the selection is essentially a system task Sourcecode Sourcecode to demonstrate the issue can be found on GitHub
1
0
334
Mar ’25
Recording WKWebView
I am trying to record the requests and responses in a WKWebView, but instruments does not seem to record them. Is this to be expected? The webView is set to inspectable, and I am using the HTTP Traffic instrument. All the requests the app is doing are recorded, but neither the original request for the webView, nor subsequent traffic is recorded. When I use Safari to inspect the webView, all I see is the last page (even when I start the inspector before the first request is made). How can I see these requests?
0
0
115
May ’25