开发者

I have a link to my terms and conditions data and I want to show this data by reading it

开发者 https://www.devze.com 2023-01-09 22:21 出处:网络
How do I read data from an USL link, and display it on my textview? The URL link content contains only normal text

How do I read data from an USL link, and display it on my textview? The URL link content contains only normal text

I am using:

NSString *userAgreementStringURL = [NSString stringWithFormat:@"%@/requestConfigurationData.php?ownerID=%@&view=userAgreement", serverURL, ownerID];
NSURL *userAgreementURL = [NSURL URLWithString:userAgreementStringURL];
NSURLRequest *userAgreementRequest = [NSURLRequest requestWithURL:userAgreementURL];
userAgreementData = [[NSMutableData alloc] init];
[UIApplication shar开发者_StackOverflow社区edApplication].networkActivityIndicatorVisible = YES;
userAgreementConnection = [[NSURLConnection connectionWithRequest:userAgreementRequest delegate:self] retain];  

[userAgreementTextView setText:[NSString stringWithContentsOfURL:@"http://medicinephone.com/dev2/visit/requestConfigurationData.php?ownerID=13&view=userAgreement" encoding:NSUTF8StringEncoding error:NULL]];


Show us your code. If you are trying what I think you are trying passing an array to text view's setText method won't work. You need to get the string from the array prior to that. If you array contains one word per array element you might want to try using componentsJoinedByString.


[myTextView setText:[NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://apple.com" encoding:NSUTF8StringEncoding error:NULL]]];

one line of code, thank you apple.

Edit: forgot to make a NSURL from the string.

0

精彩评论

暂无评论...
验证码 换一张
取 消