|
My question relates to using Paul's RemoteImage view, an example of which is in this solved post: https://www.hackingwithswift.com/forums/swiftui/loading-images/3292/6902 Specifically, I'm trying to constuct the image url on the fly, by concatenating some constants and each image's base name, to match the remote images' long absolute path. But with the code below, I get this error: nw_protocol_get_quic_image_block_invoke dlopen libquic failed The key lines in my code are in prefixed with an asterisk just to highlight them here:
Any tips on what this newbie needs to know to make something like this work? Thanks! |
|
I imagine, given that
Try printing this value to see what it is and if it's correct. It's hard to say for certain, though, without more code showing what your |
|
I know it looks strange, but that's the cumbersome image path on the server. I've printed the value to confirm that it's indeed what I need. RemoteImageView's url works fine if I use a single constant (stored above the VStack) or an actual static URL in quotes, but it doesn't seem to like either of the concatenate options that I've tried below (as I get that same error): RemoteImageView(url: (thumbnailPrefix + image.url + thumbnailInfix + image.url + thumbnailSuffix)) RemoteImageView(url: ("(thumbnailPrefix)(track.url)(thumbnailInfix)(track.url)(thumbnailSuffix)")) FetchJSON() gets a JSON feed of data that gets modeled by a struct that includes each image's base url path (e.g., "15490"), which is only part of the actual file's absolute path on the server, which is this: https://my-subhost-at.amazonaws.com/15490/thumbnail-15490-optimized.jpg (just an example, not a real file). |
|
Maybe I could make a custom RemoteImageView and change it so that url string that it takes is just the image's base path and the RemoteImageView does the work of concatenating the current image path with the constants (prefix, infix, suffix)? UPDATE 1: I tried that idea, changing the RemoteImageView ( original version of which is here: https://www.hackingwithswift.com/forums/swiftui/loading-images/3292/6902 ) but got other errors (noted below). Here's the change I attempted:
I also tried this:
In conjunction with changing my original call to RemoteImageView(url: image.url). Here's the error: NSURLErrorRelatedURLSessionTaskErrorKey=("LocalDataTask <F5CAD68F-C4BF-474E-84F6-C910D5D27431>.<89>"), NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <F5CAD68F-C4BF-474E-84F6-C910D5D27431>.<89>, NSUnderlyingError=0x600001ca2c10 {Error Domain=kCFErrorDomainCFNetwork Code=-1002 "(null)"}}* UPDATE 2: Ooops! My original code attempt actually worked (i.e., concatenating in the call, not customizing RemoveImageView). The problem was that I had fetched a JSON recordset from one server but was constructing the URL path that included a different subdomain on that server. Once I corrected the thumbnailPrefix constant, the remove images appeared. Uggh. |
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.