Search code examples
iosiphonexcodeappdelegatepresentviewcontroller

Unexpected interface name - Xcode


I am working on an application that retrieves photos from iOS photo library. When the photo is selected, I want to target a .xib to show an interface where the selected photo can be edited.

However the build is failing due to this error:

"Unexpected interface name 'imageEditorView': expected expression"

Here is the code:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:    (NSDictionary *)launchOptions
{
    [self dismissViewControllerAnimated:YES completion:^{
        [self.parentViewController presentViewController:imageEditorView: animated:YES completion:nil];
    }];
}

I have all the externals imported correctly in the .h files for both controllers. Any help would be greatly appreciated.


Solution

  • There are several problems with your code:

    • imageEditorView is the name of a class. That will not work as a message argument. You need to pass a reference to an object.

    • You have an extra colon after imageEditorView, before animated. You need to remove it.

    • Sending dismissViewControllerAnimated:completion: to self inside application:didFinishLaunchingWithOptions: doesn't make any sense. Either you are defining this method in your application delegate, which doesn't understand the dismissViewControllerAnimated:completion: message, or you are defining it in a view controller, in which case application:didFinishLaunchingWithOptions: will not be called (unless you write code to explicitly call it, which would also be very unusual).

    Based on all these errors, I suspect that you do not really know much Objective-C or iOS programming at all. You need to work through some tutorials to learn the basics, because these are very basic errors.