我正在将视频从我的应用上传到 YouTube。我已经完成了,但有一个小问题。我使用选择器来允许用户选择视频的类别。我正在尝试使用 Apple 在其上传页面中列出的类别,其中包括“汽车和车辆”等项目。但是,如果您查看 YouTube 接受的类别,则该类别是“汽车”。为了解决这个问题,我使用“汽车和车辆”为选择器创建了数组,但后来我将它们转换为“汽车”。
我使用以下代码执行此操作。
pickerArray = [[NSMutableArray alloc ]init ];
[pickerArray addObject: @"Autos & Vehicles" ];
[pickerArray addObject:@"Comedy"];
[pickerArray addObject:@"Education"];
[pickerArray addObject:@"Entertainment"];
[pickerArray addObject:@"Film & Animation"];
[pickerArray addObject:@"Gaming"];
[pickerArray addObject:@"Howto & Style"];
[pickerArray addObject:@"Music"];
[pickerArray addObject:@"News & Politics"];
[pickerArray addObject:@"Nonprofits & Activism"];
[pickerArray addObject:@"People & Blogs"];
[pickerArray addObject:@"Pets & Animals"];
[pickerArray addObject:@"Science & Technology"];
[pickerArray addObject:@"Sports"];
[pickerArray addObject:@"Travel & Events"];
[catagoryPicker selectRow:1 inComponent:0 animated:NO];
catagoryField1.text = [pickerArray objectAtIndex:[catagoryPicker selectedRowInComponent:0]];
//and then to convert this code
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
catagoryField1.text = [pickerArray objectAtIndex:row];
if (catagoryField1.text == @"Comedy") {
catagoryField.text =@"Comedy";
}
else if (catagoryField1.text == @"Autos & Vehicles") {
catagoryField.text =@"Autos";}
else if (catagoryField1.text == @"Gaming") {
catagoryField.text =@"Games";}
else if (catagoryField1.text == @"Education") {
catagoryField.text =@"Education";}
else if (catagoryField1.text == @"Entertainment") {
catagoryField.text =@"Entertainment";}
else if (catagoryField1.text == @"Film & Animation") {
catagoryField.text =@"Film";}
else if (catagoryField1.text == @"Howto & Style") {
catagoryField.text =@"Howto";}
else if (catagoryField1.text == @"Music") {
catagoryField.text =@"Music";}
else if (catagoryField1.text == @"News & Politics") {
catagoryField.text =@"News";}
else if (catagoryField1.text == @"Nonprofits & Activism") {
catagoryField.text =@"Nonprofit";}
else if (catagoryField1.text == @"People & Blogs") {
catagoryField.text =@"People";}
else if (catagoryField1.text == @"Pets & Animals") {
catagoryField.text =@"Animals";}
else if (catagoryField1.text == @"Science & Technology") {
catagoryField.text =@"Tech";}
else if (catagoryField1.text == @"Sports") {
catagoryField.text =@"Sports";}
else if (catagoryField1.text == @"Travel & Events") {
catagoryField.text =@"Travel";}
}
这适用于只有“游戏”这样的单个词,但在使用“汽车和车辆”时不起作用。如果我使用“汽车/车辆”它不起作用,但“汽车/车辆”可以。所以我假设空间的使用会搞砸一些事情。有人可以告诉我如何解决这个问题,以便我可以使用“汽车和车辆”。
谢谢