Xcode 5.1.1期望标识符或'('

时间:2014-06-21 04:32:55

标签: iphone xcode

它说当我尝试运行我的应用程序时,我需要一个预期的标识符,或者'('对于这行代码:

if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){

它在这行代码中:

if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){
if(![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]){
    [self alert:@"PhotoLibrary is not supportted in this device."];
    return;
}
    imagePicker = imagePickerPhoto;
    [self presentModalViewController:imagePicker animated:YES];
else{
    if(!popover){
        imagePicker = imagePickerPhoto;
        popover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
        [popover presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    }else{
        [popover dismissPopoverAnimated:YES];
        [popover release]; popover = nil;
    }

1 个答案:

答案 0 :(得分:0)

请从XCode复制并粘贴,并将代码括在“代码括号”

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
    if(![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {
        [self alert:@"PhotoLibrary is not supportted in this device."];
        return;
    }
    imagePicker = imagePickerPhoto;
    [self presentModalViewController:imagePicker animated:YES];

    else
    {
        if(!popover) {
            imagePicker = imagePickerPhoto;
            popover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
            [popover presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
        }
        else {
            [popover dismissPopoverAnimated:YES];
            [popover release];
            popover = nil;
        }

看起来你的第一个'其他'是在错误的地方,而你错过了一个结束}