【发布时间】:2011-06-23 19:11:54
【问题描述】:
我正在努力通过读取 XML 文件 http://www.calvaryccm.com/ServiceTimes.asmx/IsServiceTime 来确定事件是否处于活动状态。
它返回一个布尔结果,但我不知道如何使用objective-c 访问它。这是我目前所拥有的:
NSError * error = nil;
NSString * responseString = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://www.calvaryccm.com/ServiceTimes.asmx/IsServiceTime"] encoding:NSUTF8StringEncoding error:&error];
NSLog(responseString);
if (error) {
NSLog(@"%@", [error localizedDescription]);
}
if ([responseString isEqualToString:@"true"]) {
// Handle active content.
NSString *baseVideoUrl = @"http://streaming5.calvaryccm.com:1935/live/iPhone/playlist.m3u8";
NSLog(@" finalUrl is : %@",baseVideoUrl);
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:baseVideoUrl]];
if ([moviePlayer respondsToSelector:@selector(setFullscreen:animated:)]) {
// Use the 3.2 style API
moviePlayer.controlStyle = MPMovieControlStyleDefault;
moviePlayer.shouldAutoplay = YES;
[self.view addSubview:moviePlayer.view];
[moviePlayer setFullscreen:YES animated:YES];
}
} else {
// Inform user that the content is unavailable
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle: @"Live Service"
message: @"There is no service going on at this time"
delegate: nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
}
【问题讨论】:
-
你在 responseString 中得到了什么值?
-
操作无法完成。 (可可错误 256。)
标签: iphone objective-c xml boolean nsxmlparser