|
Hello all, I am trying to solve the day 77 challenge of making the person tagging app. I reused the image picker from instafilter but for some reason when I try to display the image after it being picked it is still nil. Am I missing something obvious here? After running this code "setting parent image" is printed in the console and "oops" is displayed on the screen
If you need any more info please let me know. I'm very interested to know what's going on here. Thanks! |
|
|
|
Maybe you didn't give permission for the app to access the photo album on your device/simulator? |
|
Hmm I think you're right. I don't see the app in the simulators device settings app. When should I be prompted to allow access? I can see the picker show up and I added a message for "Privacy - Photo Library Usage Description" in my plist. |
|
If you completely delete the app from the simulator (Hold down on its icon and delete app just like you would on a real device) and then try to run it in the simulator again does it ask you to give it permission? |
|
I did try this but it didn't seem to do anything. What is interesting is that if I try to render the Image in the body instead of a sheet it does render properly. Does that make sense? Is there a race condition here that I'm not aware of with having that second sheet immediately appear after the first one? |
|
That may have something to do with it. I haven't completed the 100 days of SwiftUI course myself yet, so I'm not familar enough with the inner workings of the language to know. But I recently completed the day 77 milestone project, and it lead me to a similar question. At first, I had a bunch of cluttery looking code in an if/else statement in ContentView, so I tried to separate the if and else parts into separate views to make things look more clean. I broke it up into
Basically, how it worked was the When I had all of my code in The problem was that in This was confusing for me because I had thought that as soon as I was able to solve my problem by explicitly unwrapping |
|
If you want to see my full code for this project to get a better idea of what I'm talking about, it is available at this link. But, I guess my point is that it seems like the binding to So, I'm not sure if there is a similar issue being caused in your project or not, but it may be possible. |
SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.
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.