2

I have a website, require input username, pass and captcha to login.

Now, I develop an application on iPhone to login that website.

I don't know how to get that captcha and show on iphone. I can get that Captcha in NSData and convert it into NSInputStream. But how can show image from InputStream in iOS?

In Android, I finished application with same function. I use:

Drawable.createFromStream(inputstream, source) to show Image on Android.

What function in iOS similar to createFromStream?

Should have parameter source, because my captcha is in that source. Thanks.

Irfan
  • 4,301
  • 6
  • 29
  • 46
Brave
  • 371
  • 1
  • 3
  • 10
  • It is different to my case. I get captcha from my server, and can't see it in text. In page of captcha, have a hidden token, so if I show captcha from URL with image, I can't store that token. If don't have that token, after sign in, can't access next page. If access url captcha 2 times, it means different captcha and token too. So, in my case, only get by NSData or NSInputStream to show captcha. – Brave Mar 20 '14 at 17:18

2 Answers2

0

This is how you can display images from the web:

UIImage *web_image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:SET_YOUR_URL_HERE]]];
k.gemmricher
  • 126
  • 6
0

Create an UIImage from a NSData object using [UIImage imageWithData:data] (documentation). Then display it in an UIImageView.

Or you could use a UIWebView to display the image directly or in a web page.

Krumelur
  • 31,081
  • 7
  • 77
  • 119
  • Yes, I did like that before asking. But [UIImage imageWithData:data] don't have source parameter. I mean my captcha image is from "src" in data, like this command in Android: Drawable.createFromStream(inputstream, "src"); In iOS have a function like that? – Brave Mar 20 '14 at 17:27