Post

Replies

Boosts

Views

Activity

Reply to Having problems accessing data out of dictionary.
Cut down what you're trying to do so it's easier to figure out what's going wrong. Start with accessing the videos element. If it's there and can be accessed, try to access the mp4 element, and so on. At some point you'll either find the problem, or you won't experience the problem because your code is working properly. So, you have movieDict which is a Dictionary<String, Any>, I guess? (I've added line numbers so I can refer to them in a bit) 1: videos: { 2:   mp4 =  { 3:    1080 = "https://videos.kaiserclix.com/AVideo/videos/_YPTuniqid_6061fbc1c89a53.50466226_1080.mp4"; 4:    240 = "https://videos.kaiserclix.com/AVideo/videos/_YPTuniqid_6061fbc1c89a53.50466226_240.mp4"; 5:    360 = "https://videos.kaiserclix.com/AVideo/videos/_YPTuniqid_6061fbc1c89a53.50466226_360.mp4"; 6:    480 = "https://videos.kaiserclix.com/AVideo/videos/_YPTuniqid_6061fbc1c89a53.50466226_480.mp4"; 7: }; Are you sure the mp4 line is mp4 = { and not mp4: {? Anyway: let movieDict: Dictionary<String, Any> = <whatever function gives you the dictionary> let videosDict: Dictionary<String, Any> = movieDict["videos"] as! Dictionary<String, Any> // This gets the 'videos' item as a Dictionary, line 1. ! means crash if it's nil let mp4Dict: Dictionary<String, String> = videosDict["mp4"] as! Dictionary<String, String> // This gives you the Dictionary of 'mp4', lines 2-7. Again, ! means crash if it's nil print(videosDict) print(mp4Dict) print(mp4Dict["1080"]) // Should print https://videos.kaiserclix.com/AVideo/videos/_YPTuniqid_6061fbc1c89a53.50466226_1080.mp4 This is all pseudo-code and I haven't actually written this in Xcode, but it should be pretty easy to work with.
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’22
Reply to Xcode IPhone display
I think this is likely a bug in Xcode as I have this issue, too. Can you raise a bug? These are the sizes for the various iPhones: 375x667@2x - iPhone 8, SE2 414x736@3x - iPhone 8 Plus 375x812@3x - iPhone X, XS, 11 Pro, 12 mini, 13 mini 414x896@2x - iPhone XR, 11 414x896@3x - iPhone XS Max, 11 Pro Max 390x844@3x - iPhone 12, 12 Pro, 13, 13 Pro, 14 428x926@3x - iPhone 12 Pro Max, 13 Pro Max, 14 Plus, 14 Pro Max 393x852@3x - iPhone 14 Pro The iPhone X, XS, 11 Pro, 12 mini and 13 mini all share the same sresolution, and are all missing from the popup in your image.
Sep ’22
Reply to I cannot find my physical device in the menu below.
Yes, it isn't a full simulator, but every other model of iPhone is catered for in that popup, but the ones that share the same resolution as the iPhone XS are not present. There is no reason to put everything in except one family of iPhones. Present: 375x667@2x - iPhone 8, SE2 414x736@3x - iPhone 8 Plus 414x896@2x - iPhone XR, 11 414x896@3x - iPhone XS Max, 11 Pro Max 390x844@3x - iPhone 12, 12 Pro, 13, 13 Pro, 14 428x926@3x - iPhone 12 Pro Max, 13 Pro Max, 14 Plus, 14 Pro Max 393x852@3x - iPhone 14 Pro Not present: 375x812@3x - iPhone X, XS, 11 Pro, 12 mini, 13 mini
Sep ’22
Reply to Image stored in documents directory disappears on app relaunch/rebuild
As Vlad has mentioned, the app is completely rebuilt and is located in a different UUID folder so you cannot access files from the older build. If you're expecting to be able to use files from a different installation - which is what it is - you're going to be disappointed. The app is sandboxed so you cannot access files from other apps. If you were able to use files from a previous install, iPhones and Watches would fill up pretty quickly with files that cannot be deleted (the user deleted your app but you left some files hanging around that can only be accessed from a new version of your app which the user isn't guaranteed to install). You need to rethink/remodel what you want to happen in the lifecycle of your app. Why do you need to refer to files from previous installs? Can't you just download the files you need for the current install?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’22