Hi,
I have imported my Parse data and my images are linked with data, so when I want to call data with images it fetch only a link. See below the script. How can I call images as UIImage?
func fetching() {
let backendless = Backendless()
let query = BackendlessDataQuery()
backendless.persistenceService.of(Menu.ofClass()).find(
query,
response: { ( menu : BackendlessCollection!) -> () in
let currentPage = menu.getCurrentPage()
print(“Loaded (currentPage.count) Menu objects”)
for menu in currentPage as! [Menu] {
print(“Menu name = (menu.name)”)
self.name.text = menu.name
self.type.text = menu.type
print(“Type = (menu.type)”)
print(menu.image)
}
},
error: { ( fault : Fault!) -> () in
print(“Server reported an error: (fault)”)
}
)
}
Hi Edis,
Please clarify your use case:
- did you upload your images using FileService?
- did you save image url in Menu table using PersistenceService?
- when you retrieved the Menu object - what are you going to do with it?
Add Menu class and some screenshots of your backendless app dashboard here.
We need more information to help you.
Regards,
Slava
Hi Vya,
I just figured out , here is the extra script I have added to func:
dispatch_async(dispatch_get_main_queue())
{
let url = NSURL(string: menu.image)
let dataimage = NSData(contentsOfURL: url!)
self.images.image = UIImage(data: dataimage!)
}
Thank you in advance.