문제

I am trying to populate a UITableView from xml and using xamarin.ios to develop. After I try to run the app and select the tab the UITableView is on the app crashes and kicks out an ArgumentNullException.

The exception is as follows: "System.ArgumentNullException. Argument cannot be null. Parameter name:url" and is thrown on the line XDocument xmlDoc = XDocument.Load (clubFile);

    var clubFile = NSBundle.MainBundle.PathForResource ("FootballLeagueTeamInfo", "xml");
    XDocument xmlDoc = XDocument.Load (clubFile); 

The xml document is saved locally within the solution/app and not in any subfolders. I'm not really sure what the url is and where it would go.

Any help would be appreciated! Thanks.

도움이 되었습니까?

해결책

I managed to stumble across the answer to recently.

Basically the app could not locate the XML file in the Resource bundle because it wasn't there.

To add the XML to the resource bundle open up the solution in Xcode and click the top level of the solution in the solution explorer on the left hand side. Along the top there is now listed General, Capabilities etc. Go to Build Phases > Copy Bundle Resources > + > Locate the XML file that you have already added to the solution.

This should resolve the problem of not stating that the XML file URL is null.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top