expected expression before '.' token - iphone

Can someone tell me why this doesn't work?
-(IBAction) website_btn {
[myAppDelegate viewGallery];
}
Because I am getting this error.
error: expected expression before '.' token
I know it sounds strange. Need someone to throw me a life jacket here.

If you are compiling with GCC in Xcode, try switching to clang, clang is much better at identifying where there error is, GCC will sometime claim an error is at one location when the actually error is much higher up or even in a header file.

The code you have posted has no issues. It may be due to the error in the code above it. If still the code is fine. Then clean all your target and Build again hope this will work. As it works for many of us..

Thanks everyone!!!!
It was an error I had causing this error.
Just remember to extend your class with UIApplicationDelegate.
...
#interface YourClass : UIViewController <UIApplicationDelegate> {
....
Sorry, I am new to iPhone so I know I am not using proper terms here.

Related

How to fix error – "No Visible #interface for ARCamera"?

I'm trying to build a project that I downloaded from git and I got some errors in the Xcode beta 9.
I noticed that there are some things that are deprecated like ARWorldTrackingSessionConfiguration so I changed them and they were fixed. But I get an error that I can't fix, this is the part from the code:
matrix_float4x4 projectionMatrix = [frame.camera projectionMatrixWithViewportSize: nativeSize
orientation:[[UIApplication sharedApplication] statusBarOrientation]
zNear:(CGFloat)unityCameraNearZ
zFar:(CGFloat)unityCameraFarZ];
I could not fix this and I don't know what to do.
the error for that is this:
No visible #interface for 'ARCamera' declares the selector 'projectionMatrixWithViewportSize:orientation:zNear:zFar
Hope you can help me with this issue?
Thank you.
First of all you should update your XCode from beta to a stable version.
As for
No visible #interface for 'ARCamera' declares the selector 'projectionMatrixWithViewportSize:orientation:zNear:zFar
Here is official Apple documentation about ARCamera class which shows that there is no method projectionMatrixWithViewportSize:orientation:zNear:zFar and it's most possibly was changed to projectionMatrixForOrientation:viewportSize:zNear:zFar:. Signatures of this two methods requires the same parameters, so it won't be problem to replace the old method with a new one.

MFMailComposeViewController.h Broken

After successfully implementing the MFMailComposeViewController in my app, run it in the simulator and my iPhone, where it still works fine, it just crashed.
I get 5 MFMailComposeViewController.h issues: Cannot find protocol declaration, Expected identifier or '(', etc,...
My Controller header includes:
MessageUI/MessageUI.h
MessageUI/MFMailComposeViewController.h
and conforms to protocol:
#interface DetallViewController : UIViewController < UIActionSheetDelegate,
MFMailComposeViewControllerDelegate>
I've tried to:
1) remove and add the framework
2) Restart the device and Xcode as suggested in many posts
3) Create a separate controller to handle MFMailComposeViewController
After 3 days with this issue I'm completely stuck on this. As you can imagine, any help would be appreciate.
I would think this is a kind of reference issue since it appears whether the framework is selected or not.
Thanks in advance
Just to anybody it may help, I finally found the issue:
A missing #end in an imported header.
Thanks to everybody for the efforts.

What will be reason behind this error?

I am fresher in iphone programming.Whenever i create a new project in x-code it's giving this error.Please anybody, help me to solve this problem.I am attaching snapshot below:-
It'll be a great help. Thank you
You just need to add those missing headers to your project.
check out your .h file.
Might be you had deleted #end by mistake or somewhere ‘;’ is missing after statement declarations.

Iphone compile warning

im compiling my app , which is working great and i wanted to ask you 2 questions
1. im getting about 14 warnings like that
no '-addCategory' method found
which i know how to solve but even after i cleaned everything added the function to the header file and compile again it's still there i cant get rid of it.
2. im pretty new in coding and the code is not GREAT but it's ok how do i know apple will accept it ?
thank you very much !!
Declare that method in .h file
Implement that method in .m [implementor of .h] file .with the same signature.
Clean in once.
And try..
It should work..!

How to fix "Cannot find interface declaration for 'NSManagedObject', superclass of"?

Can anyone please help me to solve the following error:
Error cannot find interface declaration for 'NSManagedObject', superclass of
Try
#import <CoreData/CoreData.h>
Are you missing an include statement?
Are you subclassing NSManagedObject? If so, go here in Apple's documentation and scroll to Xcode Generated Subclasses. They give you instructions to have Xcode generate class files from your data model.
A suggestion: Core Data is rather difficult, and you should be comfortable with iPhone development before you start working with it.
import CoreData to your xxx-Bridging-Header.h will make sense.