我想從此URL獲取數據:http://webservices.ns.nl/ns-api-stations。該URL需要登錄。如何把這個登錄信息放入我的代碼中?這段代碼是我現在使用的。從URL中獲取密碼數據
- (無效){fetchStationData // 法數據
//First lets check wheater there is an internet connection and if the host is reachable
if(internetActive) {
//Internet is active
//Init the parser
parser = [[RSSParser alloc] init];
//Set he parser context
parser.context = context;
//The array to het the data from
NSURL *url = [NSURL URLWithString:@"http://webservices.ns.nl/ns-api-stations"];
//The XML elements to fetch
NSArray *elements = [[NSArray alloc] initWithObjects:@"naam",nil];
//The actual fetchin
[parser fetchStationItemsForUrl:url forElements:elements];
//Save the context ?
[context save:nil];
//Clean up
[elements release];
}
添加框架後工作很好:CFNetwork,SystemConfiguration,MobileCoreServices和libz。謝謝。 – Dawid