dot42 WebClient.DownloadString错误甚至有权限

时间:2013-10-01 14:43:49

标签: android dot42

我使用dot42开发Android应用程序,但是在点击DownloadString

行时会出现错误
using System;
using System.Collections;
using System.Collections.Generic;
using System.Net;
using Android.App;
using Android.Os;
using Android.Widget;
using Dot42;
using Dot42.Manifest;

[assembly: Application("innosia.com")]
**[assembly: UsesPermission(Android.Manifest.Permission.INTERNET)]**
[assembly: Dot42.FreeAppsKey("##censored##")]
namespace innosia.com
{
    [Activity]
    public class MainActivity : Activity
    {
        protected override void OnCreate(Bundle savedInstance)
        {
            base.OnCreate(savedInstance);
            SetContentView(R.Layouts.MainLayout);

            var textView = FindViewById<TextView>(R.Ids.MyText);

            List<string> titles = GetTitles();

            textView.SetText(string.Join(",", titles));
        }

        public List<string> GetTitles()
        {
            var webClient = new WebClient();
            **var data = webClient.DownloadString("http://www.sorainnosia.com/animea");**
            string[] temps = data.TagMatch("<td><a href=\"javascript:Submit(", "</a>");
            List<string> result = new List<string>();
            foreach (string str in temps)
            {
                string t = str.Substring(str.IndexOf("\">") + 2);
                result.Add(t);
            }
            return result;
        }
    }
}

粗线会导致错误,但VS无法显示错误详细信息,我已经添加了UsePermission Internet但它仍然出错,有人知道原因吗?

1 个答案:

答案 0 :(得分:0)

我没有尝试过,但您可能也需要权限ACCESS_NETWORK_STATE。