I have a tableview that presents events that a user creates. When you click on one of them it takes you to a different page that presents the details of the event.
I'm using Firebase and passing the postID from the tableview to the detailed view and all the information is being passed correctly in an NSDictionary.
However, when I try to access the NSDictionary out of the viewDidLoad and in an IBAction it tells me that the NSDictionary is nil. When I check in the viewDidLoad it is not nil.
I'm very new to programming and learning along the way but I've been stuck on this for a while now and have no idea whats wrong or how I can fix it
this is my code
import UIKit
import Firebase
class BeehiveViewViewController: UIViewController {
#IBOutlet weak var eventImage: UIImageView!
#IBOutlet weak var eventName: UILabel!
#IBOutlet weak var location: UILabel!
#IBOutlet weak var eventDate: UILabel!
#IBOutlet weak var eventHost: UILabel!
#IBOutlet weak var members: UILabel!
#IBOutlet weak var joinButton: roundButton!
var beehiveID: NSDictionary?
var ref = Database.database().reference()
override func viewDidLoad() {
super.viewDidLoad()
view.setGradientBackground(colourOne: primaryColor, colourTwo: secondaryColor)
let uid = Auth.auth().currentUser?.uid
ref.child("users").child(uid!).child(self.beehiveID?["pid"] as! String).observe(.value) { (snapshot) in
let uid = self.beehiveID!["pid"] as! String
self.beehiveID = snapshot.value as? NSDictionary
self.beehiveID?.setValue(uid, forKey: "pid")
}
let imageURL = self.beehiveID!["imageDownloadURL"] as! String
let url = URL(string: imageURL)
DispatchQueue.global(qos: .background).async {
let data = NSData(contentsOf: url!)
DispatchQueue.main.async {
self.eventImage.image = UIImage(data: data! as Data)
}
}
self.eventName.text = self.beehiveID?["eventName"] as? String
self.eventDate.text = self.beehiveID?["eventDate"] as? String
self.eventHost.text = self.beehiveID?["beehiveHost"] as? String
self.location.text = self.beehiveID?["location"] as? String
let uidd = Auth.auth().currentUser?.uid
Database.database().reference().child("users").child(uidd!).child("Posts").child(self.beehiveID?["pid"] as! String).child("Members").observe(.value) { (snapshot) in
let memberCount = snapshot.childrenCount
self.members.text = "\(memberCount)"
}
let userID = Auth.auth().currentUser?.uid
Database.database().reference().child("users").child(userID!).child("Posts").child(self.beehiveID?["pid"] as! String).observe(.value) { (snapshot) in
print(snapshot)
if (snapshot.exists()){
self.joinButton.setTitle("Remove Beehive", for: .normal)
}
else{
self.joinButton.setTitle("Join Beehive", for: .normal)
}
}
}
#IBAction func buttonPressed(_ sender: Any) {
if joinButton.titleLabel?.text == "Remove Beehive"{
let uid = Auth.auth().currentUser?.uid
let dbref = ref.child("users").child(uid!).child("Posts").child(beehiveID?["pid"] as! String)
//error is the line above that beehiveID?["pid"] is nil
dbref.removeValue()
navigationController?.popViewController(animated: true)
}
if joinButton.titleLabel?.text == "Join Beehive"{
let uid = Auth.auth().currentUser?.uid
let dbref = Database.database().reference().child("users").child(uid!).child("Posts").child("Members")
Database.database().reference().child("users").child(uid!).child("Name").observe(.value) { (nameSnapshot) in
let memberName = nameSnapshot.value as! String
let userObject = [memberName: uid]
dbref.updateChildValues(userObject as! [AnyHashable : String])
}
}
}
}
I assume that you're passing beeHive's value from the previous controller as you haven't initialised or got the values of it anywhere:-
Try having a breakpoint right before the end of viewDidLoad to double-check if the dictionary isn't nil at the block
self.beehiveID = snapshot.value as? NSDictionary
Try using a check to see if the snapshot's value is nil using 'if let' or 'guard' as you could possibly just be assigning a nil value to the NSDictionary. Also, since you're using optionals for assigning each value, it doesn't return an exception but just keeps assigning the nil value to every property
Do try this and let me know. Glad to help!
Related
I’m having trouble passing data via prepareForSegue from MainVC to EditVC. The gist of the problem is I’m trying to edit quote info(quote and author) already entered(saved in a Firestore database). When swiping(UIContextualAction) and tap on edit, it’s suppose to pass the data on to the EditVC where it’ll put the quote text and author text in their own UITextView where it’s editable. Once you edit the text, hit save and it’ll update the entry in Firestore; then MainVC reloads to update it’s view. The segue to the EditVC works flawlessly but it doesn’t display the quote & author text in their respective text views. I’ve been banging my head against the wall for 3 days trying to figure it out. Any help or guidance from you all is greatly appreciated. I can provide the Github link upon request.
MainVC:
}
let edit = UIContextualAction(style: .normal, title: "Edit") { (action, view, nil) in
self.performSegue(withIdentifier: "toEditQuote", sender: self.quotes)
print("Segue initiated")
}
edit.backgroundColor = #colorLiteral(red: 0.1764705926, green: 0.4980392158, blue: 0.7568627596, alpha: 1)
return UISwipeActionsConfiguration(actions: [delete, edit])
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?){
print("preparing to segue")
if let destination = segue.destination as? EditQuoteVC {
print("Destination = EditQuoteVC")
if let quoteData = sender as? Quote {
print("data passing")
destination.quoteTxt = quoteData.quoteTxt
destination.authorTxt = quoteData.authorTxt
print("data passed")
}
}
}
}
EditQuoteVC(destination)
class EditQuoteVC: UIViewController {
//Outlets
#IBOutlet weak var quoteText: UITextView!
#IBOutlet weak var authorText: UITextView!
//Variables
var quoteTxt: String!
var authorTxt: String!
override func viewDidLoad() {
super.viewDidLoad()
quoteText.text = quoteTxt
authorText.text = authorTxt
}
Quote.swift
class Quote {
private(set) var quoteTxt: String!
private(set) var authorTxt: String!
private(set) var timestamp: Date!
private(set) var userId: String!
private(set) var documentID: String!
init(quote: String, author: String, timestamp: Date, userId: String, documentID: String) {
self.quoteTxt = quote
self.authorTxt = "- \(author)"
self.timestamp = timestamp
self.userId = userId
self.documentID = documentID
}
class func parseData(snapshot: QuerySnapshot?) -> [Quote] {
var quotes = [Quote]()
guard let snap = snapshot else { return quotes}
for document in snap.documents { //Grabs the documents...
let data = document.data()
let quote = data[QUOTE_TEXT] as? String ?? ""
let author = data[AUTHOR_TEXT] as? String ?? ""
let timestamp = data[TIMESTAMP] as? Date ?? Date()
let userId = data[USER_ID] as? String ?? ""
let documentID = document.documentID
let newQuote = Quote(quote: quote, author: author, timestamp: timestamp, userId: userId, documentID: documentID)
quotes.append(newQuote)
}
return quotes
}
}
In your prepareForSegue function, you are assigning destination to sender. It should be:
if let destination = segue.destination as? EditQuoteVC
This question already has answers here:
Passing data between view controllers
(45 answers)
Closed 5 years ago.
I am trying to pass data in a UITextField that the user will input to go into a cell in a Collection View in another View Controller.
I want to create new 'posts' to be added to my feed every single time someone presses the 'upload' button, so the Collection View cell needs to somehow upload the given information and then clear the cell.
I don't know how to approach passing the data to the Collection View.
Here is my View Controller and my Cell code.
import UIKit
import Firebase
class UploadViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
#IBOutlet weak var previewImage: UIImageView!
#IBOutlet weak var postBtn: UIButton!
#IBOutlet weak var selectBtn: UIButton!
#IBOutlet weak var thisTextField: UITextField!
#IBOutlet weak var thatTextField: UITextField!
var picker = UIImagePickerController()
#IBAction func thisPhotoUpload(_ sender: Any) {
if thisTextField.text != "" || thatTextField.text != ""
{
performSegue(withIdentifier: "segue", sender: self)
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
var postCell = segue.destination as! PostCell
postCell.thisString = thisTextField.text!
postCell.thatString = thatTextField.text!
}
override func viewDidLoad() {
super.viewDidLoad()
picker.delegate = self
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
if let image = info[UIImagePickerControllerEditedImage] as? UIImage {
self.previewImage.image = image
selectBtn.isHidden = true
postBtn.isHidden = false
}
self.dismiss(animated: true, completion: nil)
}
#IBAction func selectPressed(_ sender: Any) {
picker.allowsEditing = true
picker.sourceType = .photoLibrary
self.present(picker, animated: true, completion: nil)
}
#IBAction func postPressed(_ sender: Any) {
AppDelegate.instance().showActivityIndicator()
let uid = FIRAuth.auth()!.currentUser!.uid
let ref = FIRDatabase.database().reference()
let storage = FIRStorage.storage().reference(forURL: "gs://instagram-f3f20.appspot.com")
let key = ref.child("posts").childByAutoId().key
let imageRef = storage.child("posts").child(uid).child("\(key).jpg")
let data = UIImageJPEGRepresentation(self.previewImage.image!, 0.6)
let uploadTask = imageRef.put(data!, metadata: nil) { (metadata, error) in
if error != nil {
print(error!.localizedDescription)
AppDelegate.instance().dismissActivityIndicatos()
return
}
imageRef.downloadURL(completion: { (url, error) in
if let url = url {
let feed = ["userID" : uid,
"pathToImage" : url.absoluteString,
"likes" : 0,
"author" : FIRAuth.auth()!.currentUser!.displayName!,
"postID" : key] as [String : Any]
let postFeed = ["\(key)" : feed]
ref.child("posts").updateChildValues(postFeed)
AppDelegate.instance().dismissActivityIndicatos()
self.dismiss(animated: true, completion: nil)
}
})
}
uploadTask.resume()
}
}
CollectionViewCell subclass
import UIKit
import Firebase
class PostCell: UICollectionViewCell {
#IBOutlet weak var postImage: UIImageView!
#IBOutlet weak var authorLabel: UILabel!
#IBOutlet weak var likeLabel: UILabel!
#IBOutlet weak var likeBtn: UIButton!
#IBOutlet weak var unlikeBtn: UIButton!
#IBOutlet weak var thisLabel: UILabel!
#IBOutlet weak var thisButton: UIButton!
#IBOutlet weak var thatLabel: UILabel!
#IBOutlet weak var thatButton: UIButton!
var postID: String!
var thisString = String()
var thatString = String()
override func awakeFromNib() {
super.awakeFromNib()
thisLabel.text = thisString
thisButton.setTitle(thisString, for: UIControlState.normal)
thatLabel.text = thisString
thatButton.setTitle(thisString, for: UIControlState.normal)
}
#IBAction func likePressed(_ sender: Any) {
self.likeBtn.isEnabled = false
let ref = FIRDatabase.database().reference()
let keyToPost = ref.child("posts").childByAutoId().key
ref.child("posts").child(self.postID).observeSingleEvent(of: .value, with: { (snapshot) in
if let post = snapshot.value as? [String : AnyObject] {
let updateLikes: [String : Any] = ["peopleWhoLike/\(keyToPost)" : FIRAuth.auth()!.currentUser!.uid]
ref.child("posts").child(self.postID).updateChildValues(updateLikes, withCompletionBlock: { (error, reff) in
if error == nil {
ref.child("posts").child(self.postID).observeSingleEvent(of: .value, with: { (snap) in
if let properties = snap.value as? [String : AnyObject] {
if let likes = properties["peopleWhoLike"] as? [String : AnyObject] {
let count = likes.count
self.likeLabel.text = "\(count) Likes"
let update = ["likes" : count]
ref.child("posts").child(self.postID).updateChildValues(update)
self.likeBtn.isHidden = true
self.unlikeBtn.isHidden = false
self.likeBtn.isEnabled = true
}
}
})
}
})
}
})
ref.removeAllObservers()
}
#IBAction func unlikePressed(_ sender: Any) {
self.unlikeBtn.isEnabled = false
let ref = FIRDatabase.database().reference()
ref.child("posts").child(self.postID).observeSingleEvent(of: .value, with: { (snapshot) in
if let properties = snapshot.value as? [String : AnyObject] {
if let peopleWhoLike = properties["peopleWhoLike"] as? [String : AnyObject] {
for (id,person) in peopleWhoLike {
if person as? String == FIRAuth.auth()!.currentUser!.uid {
ref.child("posts").child(self.postID).child("peopleWhoLike").child(id).removeValue(completionBlock: { (error, reff) in
if error == nil {
ref.child("posts").child(self.postID).observeSingleEvent(of: .value, with: { (snap) in
if let prop = snap.value as? [String : AnyObject] {
if let likes = prop["peopleWhoLike"] as? [String : AnyObject] {
let count = likes.count
self.likeLabel.text = "\(count) Likes"
ref.child("posts").child(self.postID).updateChildValues(["likes" : count])
}else {
self.likeLabel.text = "0 Likes"
ref.child("posts").child(self.postID).updateChildValues(["likes" : 0])
}
}
})
}
})
self.likeBtn.isHidden = false
self.unlikeBtn.isHidden = true
self.unlikeBtn.isEnabled = true
break
}
}
}
}
})
ref.removeAllObservers()
}
}
Right now I'm getting the error in my View Controller on the 'var postCell = segue.destination as! PostCell' line. The error says 'Bad Execution'
Any and all help would be great.
Segue.destination returns a UIViewController not a UICollectionViewCell
You should create a variable in the next viewcontroller and assign to it the text then show it there.
let vc = segue.destination as! NextViewController
vc.thisText = thisTextField.text!
vc.thatText = thatTextField.text!
And then in the NextViewController you will have the inputs in thisText and thatText
I'm new to ios dev and i'm trying to develop my first app! :)
so far so good...
Now I'm trying to pass data from main controller to the item details view.
It seems i can't figure out what i'm doing wrong but i keep getting an error:
"fatal error: unexpectedly found nil while unwrapping an Optional value"
now i understand that the value is not assigned but i don't understand why...
here's my code:
-------> MainVC
struct Ananlysys {
var descrizione: String!
var data: String!
var immagine: String!
var seganle: String!
var oraUpload: String!
var valuta: String!
}
var analysisList = [Ananlysys]()
var alertsRef = FIRDatabase.database().reference().child("analisi")
override func viewDidLoad() {
super.viewDidLoad()
fetchDataFromDB()
}
func fetchDataFromDB(){
alertsRef.observe(.childAdded, with: { snapshot in
if let dict = snapshot.value as? [String: AnyObject] {
let descrizione = dict["descrizione"] as! String
let data = dict["data"] as! String
let stato = dict["stato"] as! String
let immagine = dict["imageURL"] as! String
let seganle = dict["segnale"] as! String
let oraUpload = dict["oraupload"] as! String
let valuta = dict["valuta"] as! String
self.analysisList.insert(Ananlysys(descrizione: descrizione,
data:data, immagine:immagine, seganle: seganle, oraUpload: oraUpload,
valuta: valuta), at: 0)
self.tableView.reloadData()
}
})
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "ItemDetailVC"{
if let indexPath = self.tableView.indexPathForSelectedRow {
let destination = segue.destination as! ItemDetailVC
let cell = tableView.cellForRow(at: indexPath) as? ItemCell
destination.valuta = (cell?.valutaLabel.text)!
destination.segnale = (cell?.signalLabel.text)!
destination.desc = (cell?.descriptionLabel.text)!
destination.immagine = (cell?.imageThumb.image)!
}
}
And in My ItemDetailsVC controller (which is the destination) i've just created the IBoutlet. Here' the code:
class ItemDetailVC: OpenAlertsVC {
#IBOutlet weak var crossLabel: UILabel!
#IBOutlet weak var signalLbl: UILabel!
#IBOutlet weak var imageDetail: UIImageView!
#IBOutlet weak var analysisDesc: UILabel!
var valuta = ""
var segnale = ""
var immagine: UIImage!
var desc = ""
}
override func viewDidLoad() {
super.viewDidLoad()
crossLabel.text = valuta
signalLbl.text = segnale
analysisDesc.text = desc
imageDetail.image = immagine
}
Probably i'm just doing some stupid error... :) but it's my first app and i really don't know how to figure this out!
If anybody could help that would be much appreciate! :)
Thank you!
Cheers!
UPDATE:
I think my problems is because of the image.
I have an url which i retrive from firebase in this way:
let url = analysisList[indexPath.row].immagine
and then i download async the images:
cell.imageThumb.downloadImageFrom(link: url!, contentMode:
UIViewContentMode.scaleToFill)
in the segue i do this:
destination.immagine = (cell?.imageThumb.image)!
and in my DetailVC:
var immagine: UIImage!
imageDetail.image = immagine
this is the screen of the error
enter image description here
Saw this recently passing variables between views. I was able to get them moving by first setting the value to a top level variable (when a row is selected) and then re-reference that variable during the segue prepare function. Hope this helps.
Set a top level variable:
var valuta: String!
Breakout the self.tableView.indexPathForSelectedRow section into it's own delegate. This tutorial is a great example. (http://shrikar.com/swift-ios-tutorial-uisearchbar-and-uisearchbardelegate)
Using the "didSelectRowAt indexPath" delegate, set the top level variable value.
func tableView(_ tableView: UITableView, didSelectRowAt IndexPath: IndexPath){
let cell = tableView.cellForRow(at: indexPath)!
valuta = cell?.valutaLabel.text
}
Sample adjustments to the prepare function:
override func prepare(for segue: UIStoryboardSegue, sender: Any?){
if segue.identifier == "ItemDetailVC"{
if let destination =
segue.destination as? name_of_your_next_view_controller {
destination.passedValuta = valuta
}
}
Make sure to put a receiving variable in the next view
var passedValuta: String!
Hi guys I'm really having troubles trying to pass data from a tableview to another view controller. I have a tableview that displays a list of every user but when I click on a user it goes to the next view controller without showing any data of that particular user. The code below is pretty much the same from an example I followed but for some reason its not working for me. Please help, I've tried searching for solutions but can't find anything. Im also using firebase to store and retrieve my data. Thanks in advance
#IBOutlet weak var searchTableView: UITableView!
var profiles = [user]()
var ref: FIRDatabaseReference!
override func viewdidload(){
databaseRef = FIRDatabase.database().reference()
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
performSegue(withIdentifier: "guestSegue", sender: self)
self.searchTableView.deselectRow(at: indexPath as IndexPath, animated: true)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "guestSegue" {
if let indexpath = searchTableView.indexPathForSelectedRow {
let guestVC = segue.destination as! guestProfileViewController
guestVC.ref = profiles[indexpath.row].ref
}
}
}
user array
class User {
var backgroundProfileImage: String!
var fullName: String!
var profilePic: String!
var ref: FIRDatabaseReference!
var key: String
init(backgroundProfileImage: String, fullName: String, profilePic: String, key: String = ""){
self.backgroundProfileImage = backgroundProfileImage
self.fullName = fullName
self.profilePic = profilePic
self.key = key
self.ref = FIRDatabase.database().reference()
}
init(snapshot: FIRDataSnapshot){
self.backgroundProfileImage = value["backgroundProfileImage"] as! String!
self.fullName = (snapshot.value as! NSDictionary)["fullName"] as! String
self.profilePic = (snapshot.value as! NSDictionary)["profilePic"] as! String
self.uid = (snapshot.value as! NSDictionary)["uid"] as! String!
self.key = snapshot.key
self.ref = snapshot.ref
}
guestViewController
class guestProfileViewController: UIViewController, UINavigationControllerDelegate {
#IBOutlet weak var profileImage: UIImage!
#IBOutlet weak var backgroundProfileImage: UIImageView!
#IBOutlet weak var fullNameLabel: UILabel!
var ref: FIRDatabaseReference?
override func viewDidLoad() {
super.viewDidLoad()
ref = FIRDatabase.database().reference()
loadProfileData()
}
func loadProfileData(){
if let ref = ref {
ref.observe(.value, with: { (user) in
let user: User = User(snapshot: user)
self.fullNameLabel.text = user.fullName
self.profileImage.sd_setImage(with: URL(string: user.profilePic), placeholderImage: UIImage(named: "default"))
self.backgroundProfileImage.sd_setImage(with: URL(string: user.backgroundProfileImage), placeholderImage: UIImage(named: "default_1"))
})
}
}
}
ref is being set in viewDidLoad() of guestProfileViewController. Try removing that bit as it seems like you want ref to equal the User's ref.
So my deinit func never get called, I've already search for an answer, but none of them works for me. And the viewcontroller keep crashing because of memory issue. Thanks for your help!
Here's my code:
#IBOutlet weak var scnView: SCNView!
#IBOutlet weak var artInfoView: UIView!
#IBOutlet weak var mainTitleLbl: UILabel!
#IBOutlet weak var textView: UITextView!
#IBOutlet weak var timeLbl: UILabel!
#IBOutlet weak var stackView: UIStackView!
#IBOutlet weak var artistImg: RoundImage!
#IBOutlet weak var artistNameLbl: UILabel!
#IBOutlet weak var artistView: UIView!
var artRoomScene = ArtRoomScene(create: true)
var artImage = UIImage()
var artInfo: [Any] = []
var posts = [Art]()
var post: Art!
var user: Users!
var showInfo: Bool = false
var showSimilar: Bool = false
let alert = Alerts()
override func viewDidLoad() {
super.viewDidLoad()
scnView = self.scnView!
let scene = artRoomScene
scnView.scene = scene
scnView.autoenablesDefaultLighting = true
scnView.isJitteringEnabled = true
scnView.backgroundColor = UIColor.white
if let info = self.artInfo[1] as? Art {
let image = self.artInfo[0] as? UIImage
let height = (image?.size.height)! / 900
let width = (image?.size.width)! / 900
self.artRoomScene.setup(artInfo: image, height: height, width: width)
self.mainTitleLbl.text = info.title
let date = info.postDate/1000
let foo: TimeInterval = TimeInterval(date)
let theDate = NSDate(timeIntervalSince1970: foo)
let time = timeAgoSinceDate(date: theDate as Date, numericDates: true)
self.timeLbl.text = "\(time)"
self.textView.text = "\(info.artHeight)'H x \(info.artWidth)'W - \(info.price)$ / month - \(info.type) \n \(info.description)."
DataService.instance.REF_USERS.child("\(info.userUid)").observe(.value, with: { (snapshot) in
if let postDict = snapshot.value as? Dictionary<String, AnyObject> {
let key = snapshot.key
self.user = Users(key: key, artistData: postDict)
if let user = self.user {
self.artistNameLbl.text = user.name
self.artistImg.sd_setImage(with: URL(string: "\(user.profilePicUrl!)") , placeholderImage: UIImage(named:"Placeholder") , options: .continueInBackground)
}
}
})
}
}
deinit {
print("viewcontroller is being deallocated")
}
You may need to use a weak or unowned reference to self in the closure you are giving to your DataService. Or, you may want to look into that code and make sure that it releases it's references to this closure when you expect it to. Given the observe verb, I would expect that it holds the reference to this closure indefinitely. So I recommend this:
Use a weak reference to self in the closure
Inside your dealloc, or a some other time like viewWillDisappear, tell the DataService that you wish to unsubscribe/stop observing. This is important so that you don't end up with the opposite problem: A dangling pointer from within your closure.
For #1, the key piece is just inside your closure, Swift has a designated way to declare that self should be a weak pointer:
DataService.instance.REF_USERS.child("\(info.userUid)").observe(.value, with: { (snapshot) in
becomes
DataService.instance.REF_USERS.child("\(info.userUid)").observe(.value, with: { [weak self] (snapshot) in
Note that you could also use [unowned self], but you would be asserting that you know self will never be non-nil when this block executes. I don't think you can know that when you're passing to a 3rd party. So use [weak self] and then you'll have to treat self as an optional, which is great for this case!
This will call your deinit
weak var weakSelf = self
DataService.instance.REF_USERS.child("\(info.userUid)").observe(.value, with: { (snapshot) in
if let postDict = snapshot.value as? Dictionary<String, AnyObject>, let strongSelf = weakSelf {
let key = snapshot.key
strongSelf.user = Users(key: key, artistData: postDict)
if let user = strongSelf.user {
strongSelf.artistNameLbl.text = user.name
strongSelf.artistImg.sd_setImage(with: URL(string: "\(user.profilePicUrl!)") , placeholderImage: UIImage(named:"Placeholder") , options: .continueInBackground)
}
}
})