Function wont run all lines












2














I have the bellow function but it seems to not get passed the if let snapshotValue line I believe its because snapshotUrl.value is not a dictionary. If so How do I convert it to one?



func fetchAllPostImages() {
print("fetchAllPostImages function")
self.ref.child("Posts").child(self.userID).child(self.postNum).child("Images").observe(.childAdded, with: { snapshot in
var snapshotUrl = snapshot.childSnapshot(forPath: "ImageUrl")
var snapshotTimeStamp = snapshot.childSnapshot(forPath: "timeStamp")
print("fhdsjaklhfkjdsfksahdjksfjlashfkljdhs")
print(snapshot.childSnapshot(forPath: "ImageUrl"))
print(snapshotUrl.value, "value")

if let snapShotValue = snapshotUrl.value as? [String: String] {
print("jkdfbhksafgsaghsjbbvcbcbcbccbbbbbbbbbbbbbbb")

for (_, value) in snapShotValue {
print(value)

if let imageURL = URL(string: value) {
print(imageURL, "image url here")

do {
let imageAsData = try Data(contentsOf: imageURL)
let image = UIImage(data: imageAsData)
// let ImageObject = Media()
// ImageObject.image = image
var timeStamp = 0.0
self.arrayOfImgObj.append(Media(image: image!, timeStamp: timeStamp))
self.tableView.reloadData()
print(self.arrayOfImgObj.count, "array.count")
} catch {
print("imageURL was not able to be converted into data")
}
}
}
}
})
}


Output of the func:



fetchAllPostImages function 
fhdsjaklhfkjdsfksahdjksfjlashfkljdhs
Snap (ImageUrl)
https://firebasestge.googleapis.com/v0/b/copyyubidatabase.appspot.com/o/rVNvbWrC9aarXOTSHNXGoaIeR5B3%2Fpost:563592299%2Fimage1?alt=media&token=a0c4aeda-769a-48ac-85c8-ab595ccfdf08
Optional(https://fireestorage.googleapis.com/v0/b/copyyubidatabase.appspot.com/o/rVNvbWrC9aarXOTSHNXGoaIeR5B3%2Fpost:563592299%2Fimage1?alt=media&token=a0c4aeda-769a-48ac-85c8-ab595ccfdf08)
value









share|improve this question
























  • You should share snapshotUrl.value. Without seeing snapshotUrl.value how you would expect someone would be able to help you.
    – Satish
    Nov 12 at 21:54










  • @Satish I added above
    – The Great Visionary
    Nov 12 at 21:57










  • Aaaahhh. My eyes
    – canister_exister
    Nov 12 at 22:22










  • @canister_exister?
    – The Great Visionary
    Nov 12 at 22:23










  • @canister_exister fixed
    – The Great Visionary
    Nov 12 at 22:34
















2














I have the bellow function but it seems to not get passed the if let snapshotValue line I believe its because snapshotUrl.value is not a dictionary. If so How do I convert it to one?



func fetchAllPostImages() {
print("fetchAllPostImages function")
self.ref.child("Posts").child(self.userID).child(self.postNum).child("Images").observe(.childAdded, with: { snapshot in
var snapshotUrl = snapshot.childSnapshot(forPath: "ImageUrl")
var snapshotTimeStamp = snapshot.childSnapshot(forPath: "timeStamp")
print("fhdsjaklhfkjdsfksahdjksfjlashfkljdhs")
print(snapshot.childSnapshot(forPath: "ImageUrl"))
print(snapshotUrl.value, "value")

if let snapShotValue = snapshotUrl.value as? [String: String] {
print("jkdfbhksafgsaghsjbbvcbcbcbccbbbbbbbbbbbbbbb")

for (_, value) in snapShotValue {
print(value)

if let imageURL = URL(string: value) {
print(imageURL, "image url here")

do {
let imageAsData = try Data(contentsOf: imageURL)
let image = UIImage(data: imageAsData)
// let ImageObject = Media()
// ImageObject.image = image
var timeStamp = 0.0
self.arrayOfImgObj.append(Media(image: image!, timeStamp: timeStamp))
self.tableView.reloadData()
print(self.arrayOfImgObj.count, "array.count")
} catch {
print("imageURL was not able to be converted into data")
}
}
}
}
})
}


Output of the func:



fetchAllPostImages function 
fhdsjaklhfkjdsfksahdjksfjlashfkljdhs
Snap (ImageUrl)
https://firebasestge.googleapis.com/v0/b/copyyubidatabase.appspot.com/o/rVNvbWrC9aarXOTSHNXGoaIeR5B3%2Fpost:563592299%2Fimage1?alt=media&token=a0c4aeda-769a-48ac-85c8-ab595ccfdf08
Optional(https://fireestorage.googleapis.com/v0/b/copyyubidatabase.appspot.com/o/rVNvbWrC9aarXOTSHNXGoaIeR5B3%2Fpost:563592299%2Fimage1?alt=media&token=a0c4aeda-769a-48ac-85c8-ab595ccfdf08)
value









share|improve this question
























  • You should share snapshotUrl.value. Without seeing snapshotUrl.value how you would expect someone would be able to help you.
    – Satish
    Nov 12 at 21:54










  • @Satish I added above
    – The Great Visionary
    Nov 12 at 21:57










  • Aaaahhh. My eyes
    – canister_exister
    Nov 12 at 22:22










  • @canister_exister?
    – The Great Visionary
    Nov 12 at 22:23










  • @canister_exister fixed
    – The Great Visionary
    Nov 12 at 22:34














2












2








2


1





I have the bellow function but it seems to not get passed the if let snapshotValue line I believe its because snapshotUrl.value is not a dictionary. If so How do I convert it to one?



func fetchAllPostImages() {
print("fetchAllPostImages function")
self.ref.child("Posts").child(self.userID).child(self.postNum).child("Images").observe(.childAdded, with: { snapshot in
var snapshotUrl = snapshot.childSnapshot(forPath: "ImageUrl")
var snapshotTimeStamp = snapshot.childSnapshot(forPath: "timeStamp")
print("fhdsjaklhfkjdsfksahdjksfjlashfkljdhs")
print(snapshot.childSnapshot(forPath: "ImageUrl"))
print(snapshotUrl.value, "value")

if let snapShotValue = snapshotUrl.value as? [String: String] {
print("jkdfbhksafgsaghsjbbvcbcbcbccbbbbbbbbbbbbbbb")

for (_, value) in snapShotValue {
print(value)

if let imageURL = URL(string: value) {
print(imageURL, "image url here")

do {
let imageAsData = try Data(contentsOf: imageURL)
let image = UIImage(data: imageAsData)
// let ImageObject = Media()
// ImageObject.image = image
var timeStamp = 0.0
self.arrayOfImgObj.append(Media(image: image!, timeStamp: timeStamp))
self.tableView.reloadData()
print(self.arrayOfImgObj.count, "array.count")
} catch {
print("imageURL was not able to be converted into data")
}
}
}
}
})
}


Output of the func:



fetchAllPostImages function 
fhdsjaklhfkjdsfksahdjksfjlashfkljdhs
Snap (ImageUrl)
https://firebasestge.googleapis.com/v0/b/copyyubidatabase.appspot.com/o/rVNvbWrC9aarXOTSHNXGoaIeR5B3%2Fpost:563592299%2Fimage1?alt=media&token=a0c4aeda-769a-48ac-85c8-ab595ccfdf08
Optional(https://fireestorage.googleapis.com/v0/b/copyyubidatabase.appspot.com/o/rVNvbWrC9aarXOTSHNXGoaIeR5B3%2Fpost:563592299%2Fimage1?alt=media&token=a0c4aeda-769a-48ac-85c8-ab595ccfdf08)
value









share|improve this question















I have the bellow function but it seems to not get passed the if let snapshotValue line I believe its because snapshotUrl.value is not a dictionary. If so How do I convert it to one?



func fetchAllPostImages() {
print("fetchAllPostImages function")
self.ref.child("Posts").child(self.userID).child(self.postNum).child("Images").observe(.childAdded, with: { snapshot in
var snapshotUrl = snapshot.childSnapshot(forPath: "ImageUrl")
var snapshotTimeStamp = snapshot.childSnapshot(forPath: "timeStamp")
print("fhdsjaklhfkjdsfksahdjksfjlashfkljdhs")
print(snapshot.childSnapshot(forPath: "ImageUrl"))
print(snapshotUrl.value, "value")

if let snapShotValue = snapshotUrl.value as? [String: String] {
print("jkdfbhksafgsaghsjbbvcbcbcbccbbbbbbbbbbbbbbb")

for (_, value) in snapShotValue {
print(value)

if let imageURL = URL(string: value) {
print(imageURL, "image url here")

do {
let imageAsData = try Data(contentsOf: imageURL)
let image = UIImage(data: imageAsData)
// let ImageObject = Media()
// ImageObject.image = image
var timeStamp = 0.0
self.arrayOfImgObj.append(Media(image: image!, timeStamp: timeStamp))
self.tableView.reloadData()
print(self.arrayOfImgObj.count, "array.count")
} catch {
print("imageURL was not able to be converted into data")
}
}
}
}
})
}


Output of the func:



fetchAllPostImages function 
fhdsjaklhfkjdsfksahdjksfjlashfkljdhs
Snap (ImageUrl)
https://firebasestge.googleapis.com/v0/b/copyyubidatabase.appspot.com/o/rVNvbWrC9aarXOTSHNXGoaIeR5B3%2Fpost:563592299%2Fimage1?alt=media&token=a0c4aeda-769a-48ac-85c8-ab595ccfdf08
Optional(https://fireestorage.googleapis.com/v0/b/copyyubidatabase.appspot.com/o/rVNvbWrC9aarXOTSHNXGoaIeR5B3%2Fpost:563592299%2Fimage1?alt=media&token=a0c4aeda-769a-48ac-85c8-ab595ccfdf08)
value






ios swift firebase firebase-realtime-database






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 at 0:33









rmaddy

237k27309375




237k27309375










asked Nov 12 at 21:46









The Great Visionary

109115




109115












  • You should share snapshotUrl.value. Without seeing snapshotUrl.value how you would expect someone would be able to help you.
    – Satish
    Nov 12 at 21:54










  • @Satish I added above
    – The Great Visionary
    Nov 12 at 21:57










  • Aaaahhh. My eyes
    – canister_exister
    Nov 12 at 22:22










  • @canister_exister?
    – The Great Visionary
    Nov 12 at 22:23










  • @canister_exister fixed
    – The Great Visionary
    Nov 12 at 22:34


















  • You should share snapshotUrl.value. Without seeing snapshotUrl.value how you would expect someone would be able to help you.
    – Satish
    Nov 12 at 21:54










  • @Satish I added above
    – The Great Visionary
    Nov 12 at 21:57










  • Aaaahhh. My eyes
    – canister_exister
    Nov 12 at 22:22










  • @canister_exister?
    – The Great Visionary
    Nov 12 at 22:23










  • @canister_exister fixed
    – The Great Visionary
    Nov 12 at 22:34
















You should share snapshotUrl.value. Without seeing snapshotUrl.value how you would expect someone would be able to help you.
– Satish
Nov 12 at 21:54




You should share snapshotUrl.value. Without seeing snapshotUrl.value how you would expect someone would be able to help you.
– Satish
Nov 12 at 21:54












@Satish I added above
– The Great Visionary
Nov 12 at 21:57




@Satish I added above
– The Great Visionary
Nov 12 at 21:57












Aaaahhh. My eyes
– canister_exister
Nov 12 at 22:22




Aaaahhh. My eyes
– canister_exister
Nov 12 at 22:22












@canister_exister?
– The Great Visionary
Nov 12 at 22:23




@canister_exister?
– The Great Visionary
Nov 12 at 22:23












@canister_exister fixed
– The Great Visionary
Nov 12 at 22:34




@canister_exister fixed
– The Great Visionary
Nov 12 at 22:34












1 Answer
1






active

oldest

votes


















0














It looks like snapshotUrl.value is an Optional-wrapped URL. If you want to convert it to a Dictionary you just need a key and a value.



We don't have access to the data structure of snapshot to tell you how to use it exactly.



Here is some playground code that demonstrates what I mean. This works as-is:



import UIKit
import PlaygroundSupport

struct SnapShot {
func childSnapshot(forPath: String) -> URLWrapper? {
return URLWrapper(url: URL(string: "https://image.shutterstock.com/image-vector/sample-red-square-grunge-stamp-260nw-338250266.jpg")!)
}
}

struct URLWrapper {
var url:URL

var value:String? {
get {
return url.absoluteString
}
}
}

func fetchAllPostImages() {
let session = URLSession.shared

print("fetchAllPostImages function")
let snapshot = SnapShot()
if let snapshotUrl = snapshot.childSnapshot(forPath: "ImageUrl"), let snapShotValue = snapshotUrl.value, let imageURL = URL(string: snapShotValue) {
let task = session.dataTask(with: imageURL, completionHandler: { (data, response, error) in
if let data = data {
let image = UIImage(data: data)
print(image ?? "none")
}
})
task.resume()
}
}

PlaygroundPage.current.needsIndefiniteExecution = true

fetchAllPostImages()





share|improve this answer























  • So i think it worked i get this when i print snapshotValue: ["ImageUrl": firebasestorage.googleapis.com/v0/b/… So how do I then convert this into a string on its onw so i can then convert to URl
    – The Great Visionary
    Nov 12 at 22:09






  • 1




    What is your data source? It seems to me that you are probably going about this wrong. You should be using an asynchronous model -- URLSession.dataTaskWithRequest() or URLSession.downloadTaskWithRequest() is the right way to go about fetching multiple images over the network.
    – David S.
    Nov 12 at 22:17










  • Could you show in your answer how to do what you are saying?
    – The Great Visionary
    Nov 12 at 22:22










  • I get Initializer for conditional binding must have Optional type, not 'DataSnapshot' on the 4th line
    – The Great Visionary
    Nov 12 at 22:45










  • I moved some of teh continues if let lines and seperated them and now it wont go past the session.dataTask line
    – The Great Visionary
    Nov 13 at 0:15











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53270568%2ffunction-wont-run-all-lines%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














It looks like snapshotUrl.value is an Optional-wrapped URL. If you want to convert it to a Dictionary you just need a key and a value.



We don't have access to the data structure of snapshot to tell you how to use it exactly.



Here is some playground code that demonstrates what I mean. This works as-is:



import UIKit
import PlaygroundSupport

struct SnapShot {
func childSnapshot(forPath: String) -> URLWrapper? {
return URLWrapper(url: URL(string: "https://image.shutterstock.com/image-vector/sample-red-square-grunge-stamp-260nw-338250266.jpg")!)
}
}

struct URLWrapper {
var url:URL

var value:String? {
get {
return url.absoluteString
}
}
}

func fetchAllPostImages() {
let session = URLSession.shared

print("fetchAllPostImages function")
let snapshot = SnapShot()
if let snapshotUrl = snapshot.childSnapshot(forPath: "ImageUrl"), let snapShotValue = snapshotUrl.value, let imageURL = URL(string: snapShotValue) {
let task = session.dataTask(with: imageURL, completionHandler: { (data, response, error) in
if let data = data {
let image = UIImage(data: data)
print(image ?? "none")
}
})
task.resume()
}
}

PlaygroundPage.current.needsIndefiniteExecution = true

fetchAllPostImages()





share|improve this answer























  • So i think it worked i get this when i print snapshotValue: ["ImageUrl": firebasestorage.googleapis.com/v0/b/… So how do I then convert this into a string on its onw so i can then convert to URl
    – The Great Visionary
    Nov 12 at 22:09






  • 1




    What is your data source? It seems to me that you are probably going about this wrong. You should be using an asynchronous model -- URLSession.dataTaskWithRequest() or URLSession.downloadTaskWithRequest() is the right way to go about fetching multiple images over the network.
    – David S.
    Nov 12 at 22:17










  • Could you show in your answer how to do what you are saying?
    – The Great Visionary
    Nov 12 at 22:22










  • I get Initializer for conditional binding must have Optional type, not 'DataSnapshot' on the 4th line
    – The Great Visionary
    Nov 12 at 22:45










  • I moved some of teh continues if let lines and seperated them and now it wont go past the session.dataTask line
    – The Great Visionary
    Nov 13 at 0:15
















0














It looks like snapshotUrl.value is an Optional-wrapped URL. If you want to convert it to a Dictionary you just need a key and a value.



We don't have access to the data structure of snapshot to tell you how to use it exactly.



Here is some playground code that demonstrates what I mean. This works as-is:



import UIKit
import PlaygroundSupport

struct SnapShot {
func childSnapshot(forPath: String) -> URLWrapper? {
return URLWrapper(url: URL(string: "https://image.shutterstock.com/image-vector/sample-red-square-grunge-stamp-260nw-338250266.jpg")!)
}
}

struct URLWrapper {
var url:URL

var value:String? {
get {
return url.absoluteString
}
}
}

func fetchAllPostImages() {
let session = URLSession.shared

print("fetchAllPostImages function")
let snapshot = SnapShot()
if let snapshotUrl = snapshot.childSnapshot(forPath: "ImageUrl"), let snapShotValue = snapshotUrl.value, let imageURL = URL(string: snapShotValue) {
let task = session.dataTask(with: imageURL, completionHandler: { (data, response, error) in
if let data = data {
let image = UIImage(data: data)
print(image ?? "none")
}
})
task.resume()
}
}

PlaygroundPage.current.needsIndefiniteExecution = true

fetchAllPostImages()





share|improve this answer























  • So i think it worked i get this when i print snapshotValue: ["ImageUrl": firebasestorage.googleapis.com/v0/b/… So how do I then convert this into a string on its onw so i can then convert to URl
    – The Great Visionary
    Nov 12 at 22:09






  • 1




    What is your data source? It seems to me that you are probably going about this wrong. You should be using an asynchronous model -- URLSession.dataTaskWithRequest() or URLSession.downloadTaskWithRequest() is the right way to go about fetching multiple images over the network.
    – David S.
    Nov 12 at 22:17










  • Could you show in your answer how to do what you are saying?
    – The Great Visionary
    Nov 12 at 22:22










  • I get Initializer for conditional binding must have Optional type, not 'DataSnapshot' on the 4th line
    – The Great Visionary
    Nov 12 at 22:45










  • I moved some of teh continues if let lines and seperated them and now it wont go past the session.dataTask line
    – The Great Visionary
    Nov 13 at 0:15














0












0








0






It looks like snapshotUrl.value is an Optional-wrapped URL. If you want to convert it to a Dictionary you just need a key and a value.



We don't have access to the data structure of snapshot to tell you how to use it exactly.



Here is some playground code that demonstrates what I mean. This works as-is:



import UIKit
import PlaygroundSupport

struct SnapShot {
func childSnapshot(forPath: String) -> URLWrapper? {
return URLWrapper(url: URL(string: "https://image.shutterstock.com/image-vector/sample-red-square-grunge-stamp-260nw-338250266.jpg")!)
}
}

struct URLWrapper {
var url:URL

var value:String? {
get {
return url.absoluteString
}
}
}

func fetchAllPostImages() {
let session = URLSession.shared

print("fetchAllPostImages function")
let snapshot = SnapShot()
if let snapshotUrl = snapshot.childSnapshot(forPath: "ImageUrl"), let snapShotValue = snapshotUrl.value, let imageURL = URL(string: snapShotValue) {
let task = session.dataTask(with: imageURL, completionHandler: { (data, response, error) in
if let data = data {
let image = UIImage(data: data)
print(image ?? "none")
}
})
task.resume()
}
}

PlaygroundPage.current.needsIndefiniteExecution = true

fetchAllPostImages()





share|improve this answer














It looks like snapshotUrl.value is an Optional-wrapped URL. If you want to convert it to a Dictionary you just need a key and a value.



We don't have access to the data structure of snapshot to tell you how to use it exactly.



Here is some playground code that demonstrates what I mean. This works as-is:



import UIKit
import PlaygroundSupport

struct SnapShot {
func childSnapshot(forPath: String) -> URLWrapper? {
return URLWrapper(url: URL(string: "https://image.shutterstock.com/image-vector/sample-red-square-grunge-stamp-260nw-338250266.jpg")!)
}
}

struct URLWrapper {
var url:URL

var value:String? {
get {
return url.absoluteString
}
}
}

func fetchAllPostImages() {
let session = URLSession.shared

print("fetchAllPostImages function")
let snapshot = SnapShot()
if let snapshotUrl = snapshot.childSnapshot(forPath: "ImageUrl"), let snapShotValue = snapshotUrl.value, let imageURL = URL(string: snapShotValue) {
let task = session.dataTask(with: imageURL, completionHandler: { (data, response, error) in
if let data = data {
let image = UIImage(data: data)
print(image ?? "none")
}
})
task.resume()
}
}

PlaygroundPage.current.needsIndefiniteExecution = true

fetchAllPostImages()






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 13 at 13:46

























answered Nov 12 at 22:03









David S.

4,77211437




4,77211437












  • So i think it worked i get this when i print snapshotValue: ["ImageUrl": firebasestorage.googleapis.com/v0/b/… So how do I then convert this into a string on its onw so i can then convert to URl
    – The Great Visionary
    Nov 12 at 22:09






  • 1




    What is your data source? It seems to me that you are probably going about this wrong. You should be using an asynchronous model -- URLSession.dataTaskWithRequest() or URLSession.downloadTaskWithRequest() is the right way to go about fetching multiple images over the network.
    – David S.
    Nov 12 at 22:17










  • Could you show in your answer how to do what you are saying?
    – The Great Visionary
    Nov 12 at 22:22










  • I get Initializer for conditional binding must have Optional type, not 'DataSnapshot' on the 4th line
    – The Great Visionary
    Nov 12 at 22:45










  • I moved some of teh continues if let lines and seperated them and now it wont go past the session.dataTask line
    – The Great Visionary
    Nov 13 at 0:15


















  • So i think it worked i get this when i print snapshotValue: ["ImageUrl": firebasestorage.googleapis.com/v0/b/… So how do I then convert this into a string on its onw so i can then convert to URl
    – The Great Visionary
    Nov 12 at 22:09






  • 1




    What is your data source? It seems to me that you are probably going about this wrong. You should be using an asynchronous model -- URLSession.dataTaskWithRequest() or URLSession.downloadTaskWithRequest() is the right way to go about fetching multiple images over the network.
    – David S.
    Nov 12 at 22:17










  • Could you show in your answer how to do what you are saying?
    – The Great Visionary
    Nov 12 at 22:22










  • I get Initializer for conditional binding must have Optional type, not 'DataSnapshot' on the 4th line
    – The Great Visionary
    Nov 12 at 22:45










  • I moved some of teh continues if let lines and seperated them and now it wont go past the session.dataTask line
    – The Great Visionary
    Nov 13 at 0:15
















So i think it worked i get this when i print snapshotValue: ["ImageUrl": firebasestorage.googleapis.com/v0/b/… So how do I then convert this into a string on its onw so i can then convert to URl
– The Great Visionary
Nov 12 at 22:09




So i think it worked i get this when i print snapshotValue: ["ImageUrl": firebasestorage.googleapis.com/v0/b/… So how do I then convert this into a string on its onw so i can then convert to URl
– The Great Visionary
Nov 12 at 22:09




1




1




What is your data source? It seems to me that you are probably going about this wrong. You should be using an asynchronous model -- URLSession.dataTaskWithRequest() or URLSession.downloadTaskWithRequest() is the right way to go about fetching multiple images over the network.
– David S.
Nov 12 at 22:17




What is your data source? It seems to me that you are probably going about this wrong. You should be using an asynchronous model -- URLSession.dataTaskWithRequest() or URLSession.downloadTaskWithRequest() is the right way to go about fetching multiple images over the network.
– David S.
Nov 12 at 22:17












Could you show in your answer how to do what you are saying?
– The Great Visionary
Nov 12 at 22:22




Could you show in your answer how to do what you are saying?
– The Great Visionary
Nov 12 at 22:22












I get Initializer for conditional binding must have Optional type, not 'DataSnapshot' on the 4th line
– The Great Visionary
Nov 12 at 22:45




I get Initializer for conditional binding must have Optional type, not 'DataSnapshot' on the 4th line
– The Great Visionary
Nov 12 at 22:45












I moved some of teh continues if let lines and seperated them and now it wont go past the session.dataTask line
– The Great Visionary
Nov 13 at 0:15




I moved some of teh continues if let lines and seperated them and now it wont go past the session.dataTask line
– The Great Visionary
Nov 13 at 0:15


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53270568%2ffunction-wont-run-all-lines%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)