I’m making a iOS game which will pick a random clue(text) and image (clue and image come in a set, 1 row) from the clue repository in the database. I have a web service with webMethods and functions that allow me to pull the database row out. (tested for clue) I’ve been searching on Google for articles on how to import image to iOS from db but to no avail.
how to import image from DB by web service (build using c#)? Can anyone please guide me in the right direction? I would like it to be stored in mutableArray so that after the player are done playing, the clue and image will be wipe off the temp array. (i don’t want to put the image in the app as that will make the app very large and that user are able to upload their own clues and image, so live feed from database is the ideal method.
Right now I’m stuck on the web service side on importing the image over. I’m currently using List to store the clue, but have no idea on what to use to store image. I am thinking of using ArrayList which store object, but have no idea how to convert it to image at the iOS side. And as I mentioned above, I can’t seem to find any tutorial or example that import image to iOS app via web service. (or am I using the wrong search term)
Will be helpful if any1 can help me out, or give alternate solution which enable live update of image and clues.
EDIT – I found ImageList() and List. which one should I be using now?
Also found out to make image file is just -> image testfile;
EDIT2 - problem I'm facing
-dealing with image file (image? imagelist?
-when drawing datarow from DB in webservice, how do i deal with the image file. (guessing ImageList or List<image> (after some luck on research)
-assuming 2nd point works fine, i should be able to solve the client side
(sorry, noobie at webservice, )
.
what I have
-webservice that draw datarow from database for clue(string) (tested and working fine with my function)
-iOS client side with RESTful architecture
.
what I need
-webservice that draw datarow from database for picture(image (format not so important yet)) (code should be similar to drawing clue, only which function to store it in. (using List<string> for clues)
Sounds like you might be getting a bit ahead of yourself. Try solving just one problem at a time; you’ll make much more progress.
First, do you know how to download an image to your iOS application? Try downloading a very simple publicly available image like a Google doodle:
https://www.google.com/logos/2012/gymnastics-2012-hp.jpg. Whatever IOS application toolkit you’re using should have a walkthrough for how to download an image and present it via HTTP.Second, do you know how to host an image file on your web server? Try downloading a random JPG or PNG image yourself and hosting it on your server as a static file. Then point your IOS application at that static file and download it just like you did with the Google doodle.
If both of those steps work, you can then begin to host dynamic images on your server. Create a page (if you’re using ASP.NET) or a controller path (if you’re using MVC) and have your C# code use
Response.TransmitFileto upload an image to the clickstream. Again, download that image to your IOS application to verify it worked.Finally, modify your server application to take a parameter – either by a querystring (example:
myhost.com/mypage.aspx?image_id=1) or by an MVC path (example:myhost.com/images/1). Use that ID number to retrieve the image information from your database. Then transmit the image to the client. If all goes well, you should then be able to retrieve this image in your IOS app.I hope this helps you get closer to your project!