'downloadURL()' is deprecated: Use `StorageReference.downloadURLWithCompletion()` to obtain a current...





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















Storage.storage().reference().child(ImageUid).putData(ImageData, metadata: metadata) { (metadata, error) in
if error != nil {
print("Couldn't Upload Image")
} else {
print("Uploaded")
let downloadURl = metadata?.downloadURL()?.absoluteString
if let url = downloadURl {
self.SetUpUser(Image: url)
}
}
}

}
}


Error:




'downloadURL()' is deprecated: Use
StorageReference.downloadURLWithCompletion() to obtain a current
download URL.




How do I fix this?










share|improve this question

























  • And you are using a external library I guess? Do you mind telling which one?

    – Larme
    Apr 24 '18 at 15:53











  • using google firebase and accessing photo library for app building

    – Wahaj Uddin
    Apr 24 '18 at 16:25











  • @larme shown extension below

    – Wahaj Uddin
    Apr 25 '18 at 21:49




















0















Storage.storage().reference().child(ImageUid).putData(ImageData, metadata: metadata) { (metadata, error) in
if error != nil {
print("Couldn't Upload Image")
} else {
print("Uploaded")
let downloadURl = metadata?.downloadURL()?.absoluteString
if let url = downloadURl {
self.SetUpUser(Image: url)
}
}
}

}
}


Error:




'downloadURL()' is deprecated: Use
StorageReference.downloadURLWithCompletion() to obtain a current
download URL.




How do I fix this?










share|improve this question

























  • And you are using a external library I guess? Do you mind telling which one?

    – Larme
    Apr 24 '18 at 15:53











  • using google firebase and accessing photo library for app building

    – Wahaj Uddin
    Apr 24 '18 at 16:25











  • @larme shown extension below

    – Wahaj Uddin
    Apr 25 '18 at 21:49
















0












0








0


1






Storage.storage().reference().child(ImageUid).putData(ImageData, metadata: metadata) { (metadata, error) in
if error != nil {
print("Couldn't Upload Image")
} else {
print("Uploaded")
let downloadURl = metadata?.downloadURL()?.absoluteString
if let url = downloadURl {
self.SetUpUser(Image: url)
}
}
}

}
}


Error:




'downloadURL()' is deprecated: Use
StorageReference.downloadURLWithCompletion() to obtain a current
download URL.




How do I fix this?










share|improve this question
















Storage.storage().reference().child(ImageUid).putData(ImageData, metadata: metadata) { (metadata, error) in
if error != nil {
print("Couldn't Upload Image")
} else {
print("Uploaded")
let downloadURl = metadata?.downloadURL()?.absoluteString
if let url = downloadURl {
self.SetUpUser(Image: url)
}
}
}

}
}


Error:




'downloadURL()' is deprecated: Use
StorageReference.downloadURLWithCompletion() to obtain a current
download URL.




How do I fix this?







ios xcode firebase-realtime-database firebase-storage






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 24 '18 at 17:48









Kevinosaurio

1,2312514




1,2312514










asked Apr 24 '18 at 15:49









Wahaj UddinWahaj Uddin

153




153













  • And you are using a external library I guess? Do you mind telling which one?

    – Larme
    Apr 24 '18 at 15:53











  • using google firebase and accessing photo library for app building

    – Wahaj Uddin
    Apr 24 '18 at 16:25











  • @larme shown extension below

    – Wahaj Uddin
    Apr 25 '18 at 21:49





















  • And you are using a external library I guess? Do you mind telling which one?

    – Larme
    Apr 24 '18 at 15:53











  • using google firebase and accessing photo library for app building

    – Wahaj Uddin
    Apr 24 '18 at 16:25











  • @larme shown extension below

    – Wahaj Uddin
    Apr 25 '18 at 21:49



















And you are using a external library I guess? Do you mind telling which one?

– Larme
Apr 24 '18 at 15:53





And you are using a external library I guess? Do you mind telling which one?

– Larme
Apr 24 '18 at 15:53













using google firebase and accessing photo library for app building

– Wahaj Uddin
Apr 24 '18 at 16:25





using google firebase and accessing photo library for app building

– Wahaj Uddin
Apr 24 '18 at 16:25













@larme shown extension below

– Wahaj Uddin
Apr 25 '18 at 21:49







@larme shown extension below

– Wahaj Uddin
Apr 25 '18 at 21:49














1 Answer
1






active

oldest

votes


















5














The error says that you need to use StorageReference.downloadURLWithCompletion() well you need to use it:



let storageItem = Storage.storage().reference().child(ImageUid)
storageItem.putData(ImageData, metadata: metadata) { (metadata, error) in
if error != nil {
print("Couldn't Upload Image")
} else {
print("Uploaded")
storageItem.downloadURL(completion: { (url, error) in
if error != nil {
print(error!)
return
}
if url != nil {
self.SetUpUser(Image: url!.absoluteString)
}
}
}
}





share|improve this answer


























  • error: "Cannot convert value of type 'URL?' to expected argument type 'String'" - didn't work

    – Wahaj Uddin
    Apr 24 '18 at 16:43













  • @WahajUddin Your function accept a string and the value is url. You need to use absoluteString. I edited my answer.

    – Kevinosaurio
    Apr 24 '18 at 16:52











  • @Kevinoaurio - Great man thank you

    – Wahaj Uddin
    Apr 24 '18 at 17:47











  • @WahajUddin Your welcome. If this answer or any other one solved your issue, you can mark it as accepted.

    – Kevinosaurio
    Apr 24 '18 at 18:11






  • 1





    Yeah sorry being such a noob I figured it out thank you - it was because I hadn't allowed access to storage in firebase

    – Wahaj Uddin
    Apr 27 '18 at 14:47












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%2f50005963%2fdownloadurl-is-deprecated-use-storagereference-downloadurlwithcompletion%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









5














The error says that you need to use StorageReference.downloadURLWithCompletion() well you need to use it:



let storageItem = Storage.storage().reference().child(ImageUid)
storageItem.putData(ImageData, metadata: metadata) { (metadata, error) in
if error != nil {
print("Couldn't Upload Image")
} else {
print("Uploaded")
storageItem.downloadURL(completion: { (url, error) in
if error != nil {
print(error!)
return
}
if url != nil {
self.SetUpUser(Image: url!.absoluteString)
}
}
}
}





share|improve this answer


























  • error: "Cannot convert value of type 'URL?' to expected argument type 'String'" - didn't work

    – Wahaj Uddin
    Apr 24 '18 at 16:43













  • @WahajUddin Your function accept a string and the value is url. You need to use absoluteString. I edited my answer.

    – Kevinosaurio
    Apr 24 '18 at 16:52











  • @Kevinoaurio - Great man thank you

    – Wahaj Uddin
    Apr 24 '18 at 17:47











  • @WahajUddin Your welcome. If this answer or any other one solved your issue, you can mark it as accepted.

    – Kevinosaurio
    Apr 24 '18 at 18:11






  • 1





    Yeah sorry being such a noob I figured it out thank you - it was because I hadn't allowed access to storage in firebase

    – Wahaj Uddin
    Apr 27 '18 at 14:47
















5














The error says that you need to use StorageReference.downloadURLWithCompletion() well you need to use it:



let storageItem = Storage.storage().reference().child(ImageUid)
storageItem.putData(ImageData, metadata: metadata) { (metadata, error) in
if error != nil {
print("Couldn't Upload Image")
} else {
print("Uploaded")
storageItem.downloadURL(completion: { (url, error) in
if error != nil {
print(error!)
return
}
if url != nil {
self.SetUpUser(Image: url!.absoluteString)
}
}
}
}





share|improve this answer


























  • error: "Cannot convert value of type 'URL?' to expected argument type 'String'" - didn't work

    – Wahaj Uddin
    Apr 24 '18 at 16:43













  • @WahajUddin Your function accept a string and the value is url. You need to use absoluteString. I edited my answer.

    – Kevinosaurio
    Apr 24 '18 at 16:52











  • @Kevinoaurio - Great man thank you

    – Wahaj Uddin
    Apr 24 '18 at 17:47











  • @WahajUddin Your welcome. If this answer or any other one solved your issue, you can mark it as accepted.

    – Kevinosaurio
    Apr 24 '18 at 18:11






  • 1





    Yeah sorry being such a noob I figured it out thank you - it was because I hadn't allowed access to storage in firebase

    – Wahaj Uddin
    Apr 27 '18 at 14:47














5












5








5







The error says that you need to use StorageReference.downloadURLWithCompletion() well you need to use it:



let storageItem = Storage.storage().reference().child(ImageUid)
storageItem.putData(ImageData, metadata: metadata) { (metadata, error) in
if error != nil {
print("Couldn't Upload Image")
} else {
print("Uploaded")
storageItem.downloadURL(completion: { (url, error) in
if error != nil {
print(error!)
return
}
if url != nil {
self.SetUpUser(Image: url!.absoluteString)
}
}
}
}





share|improve this answer















The error says that you need to use StorageReference.downloadURLWithCompletion() well you need to use it:



let storageItem = Storage.storage().reference().child(ImageUid)
storageItem.putData(ImageData, metadata: metadata) { (metadata, error) in
if error != nil {
print("Couldn't Upload Image")
} else {
print("Uploaded")
storageItem.downloadURL(completion: { (url, error) in
if error != nil {
print(error!)
return
}
if url != nil {
self.SetUpUser(Image: url!.absoluteString)
}
}
}
}






share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 25 '18 at 22:46

























answered Apr 24 '18 at 16:02









KevinosaurioKevinosaurio

1,2312514




1,2312514













  • error: "Cannot convert value of type 'URL?' to expected argument type 'String'" - didn't work

    – Wahaj Uddin
    Apr 24 '18 at 16:43













  • @WahajUddin Your function accept a string and the value is url. You need to use absoluteString. I edited my answer.

    – Kevinosaurio
    Apr 24 '18 at 16:52











  • @Kevinoaurio - Great man thank you

    – Wahaj Uddin
    Apr 24 '18 at 17:47











  • @WahajUddin Your welcome. If this answer or any other one solved your issue, you can mark it as accepted.

    – Kevinosaurio
    Apr 24 '18 at 18:11






  • 1





    Yeah sorry being such a noob I figured it out thank you - it was because I hadn't allowed access to storage in firebase

    – Wahaj Uddin
    Apr 27 '18 at 14:47



















  • error: "Cannot convert value of type 'URL?' to expected argument type 'String'" - didn't work

    – Wahaj Uddin
    Apr 24 '18 at 16:43













  • @WahajUddin Your function accept a string and the value is url. You need to use absoluteString. I edited my answer.

    – Kevinosaurio
    Apr 24 '18 at 16:52











  • @Kevinoaurio - Great man thank you

    – Wahaj Uddin
    Apr 24 '18 at 17:47











  • @WahajUddin Your welcome. If this answer or any other one solved your issue, you can mark it as accepted.

    – Kevinosaurio
    Apr 24 '18 at 18:11






  • 1





    Yeah sorry being such a noob I figured it out thank you - it was because I hadn't allowed access to storage in firebase

    – Wahaj Uddin
    Apr 27 '18 at 14:47

















error: "Cannot convert value of type 'URL?' to expected argument type 'String'" - didn't work

– Wahaj Uddin
Apr 24 '18 at 16:43







error: "Cannot convert value of type 'URL?' to expected argument type 'String'" - didn't work

– Wahaj Uddin
Apr 24 '18 at 16:43















@WahajUddin Your function accept a string and the value is url. You need to use absoluteString. I edited my answer.

– Kevinosaurio
Apr 24 '18 at 16:52





@WahajUddin Your function accept a string and the value is url. You need to use absoluteString. I edited my answer.

– Kevinosaurio
Apr 24 '18 at 16:52













@Kevinoaurio - Great man thank you

– Wahaj Uddin
Apr 24 '18 at 17:47





@Kevinoaurio - Great man thank you

– Wahaj Uddin
Apr 24 '18 at 17:47













@WahajUddin Your welcome. If this answer or any other one solved your issue, you can mark it as accepted.

– Kevinosaurio
Apr 24 '18 at 18:11





@WahajUddin Your welcome. If this answer or any other one solved your issue, you can mark it as accepted.

– Kevinosaurio
Apr 24 '18 at 18:11




1




1





Yeah sorry being such a noob I figured it out thank you - it was because I hadn't allowed access to storage in firebase

– Wahaj Uddin
Apr 27 '18 at 14:47





Yeah sorry being such a noob I figured it out thank you - it was because I hadn't allowed access to storage in firebase

– Wahaj Uddin
Apr 27 '18 at 14:47




















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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50005963%2fdownloadurl-is-deprecated-use-storagereference-downloadurlwithcompletion%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

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python