当我做一个地理编码器时,我得到了以下errortext的崩溃:" System.ArgumentNullException,参数不能为null"

时间:2015-12-29 02:57:22

标签: c# xamarin xamarin.forms maps

我正在做一个地理编码器,我的字符串有问题(有一个值),我收到了这个错误:

  

" System.ArgumentNullException,参数不能为null"

以下代码:

async void loadItem ()
    {
    var getItems = await parseAPI.getOurMainInfo (Application.Current.Properties ["sessionToken"].ToString ());

        foreach (var currentItem in getItems["results"]) {

        infoString = currentItem ["ourInfoDatabase"].ToString (); //gets stored on the database.
        }

var info = infoString; //it says i get the error here. 
// my string is not empty/null. 
// when I run it in system.diagnostics.debug.writeline it gives me a value and it gets stored on the database.

        Geocoder gc = new Geocoder ();
        Task<IEnumerable<Position>> result =
            gc.GetPositionsForAddressAsync (info);

        IEnumerable<Position> data = await result;

        foreach (Position p in data) {

        }
 }

我可以创建一个防止崩溃的代码吗?

0 个答案:

没有答案