Suppress warning: Meta method xx in category from xx conflicts with same method from another category - iphone

How can I suppress this compiler warning:
Meta method 'prefix' in category from '...soap+prefix.o' conflicts with same method from another category ?
here is the category soap+Prefix.h:
#interface Soap (Prefix)
+(NSString*)prefix;
#end
and soap+prefix.m:
#import "Soap.h"
#import "Soap+Prefix.h"
#implementation Soap (Prefix)
+(NSString*)prefix { return #"EInspector"; }
#end
and these two files by the way are automatically generated with SudZc wrapper for web services.
p.s. this warning is issued ONLY in XCode 4.4
thank you so much in advance.

This happened to me when I have accidentally imported an implementation file of a category (.m) instead a header file (.h).

Somewhere else in your project, +[Soap prefix] is being declared in a category. Try searching your project for other declarations of +prefix.
Another possibility is that during a large refactoring or complex merge of your project.pbxproj file, the project ended up with two references or copies of the same file, and both are being compiled. I've seen it happen, and these sorts of warnings or errors are usually what happens. Try searching in the Finder for other files with the same name to see if you have a duplicate file somewhere.

In my case the issue was due to a wrong merge of project.pbxproj (so similar to Nick Forge's case), which caused too many references to the same file (however the file was physically only once on disk). When I removed redundant references the warning stopped appearing.

You should reference a great answer by someone who also posted something similar:
Is there a way to suppress warnings in Xcode?
In my opinion the 2nd (highest voted) option is the best!

Related

prefix attribute must be followed by an interface or protocol + NSManagedObject Subclass

So I get the compile error "prefix attribute must be followed by an interface or protocol" in an xcode generated NS Managed Object subclass. The error is matched to the line #class AnswerSet, Section, SurveyStyle; and then all lines where these objects are used. The error seemed to have come at random but I am fairly convinced it originated from deleting some of the generated classes and then re-building them.
The code in the class is irrelevant as it worked before and compiles when I copy it into a new project.
So far I have tried deleting them all again and rebuilding. Cleaning the project. Restarting ect.
My last resort will be to copy everything across into a new project file and/or refactor what I have but I'm hoping someone can suggest something to save me from that!
Edit: Just attempted to rename the entity/class of the offending file. Xcode hanged and I force quit it. Renamed the file and refactored. Ended up with the same issue.
Turns out the error was a result of a stray character outside the comments at the top of a class. Not sure why it didnt pick it up but it took a long time to track it down!
Add The piece of code in implementation file(.m)import
AVFoundation/AVFoundation.h

Xcode: I just got an Apple Mach-O Linker (Id) Error and don't know why

I'm new to iOS Development, I'm using the latest version of Xcode and just got an error that said Apple Mach-O Linker (Id) Error exit code 1 and I haven't got a clue why. I think this is relevant but I'm not sure what it means:
ld: duplicate symbol _OBJC_CLASS_$_Timing1ViewController in /Users/tomkenning/Library/Developer/Xcode/DerivedData/EggTimer-ciznfdheqrtybuavrtbbcxfywyyw/Build/Intermediates/EggTimer.build/Debug-iphonesimulator/EggTimer.build/Objects-normal/i386/Mediumhb.o and /Users/tomkenning/Library/Developer/Xcode/DerivedData/EggTimer-ciznfdheqrtybuavrtbbcxfywyyw/Build/Intermediates/EggTimer.build/Debug-iphonesimulator/EggTimer.build/Objects-normal/i386/Timing1ViewController.o for architecture i386
All I've done recently is initialise and set some integer values in a .m file and then link to them from .h file from another ViewController, using #import "suchandsuch.m", there's been no errors in the code, but is that not allowed?
Thanks in advance for any help you can offer!
Don't do this:
#import "suchandsuch.m"
Do this:
#import "suchandsuch.h"
You are probably compiling suchandsuch.m, which defines the class Timing1ViewController, normally (by including suchandsuch.m in your target's list of files to build). Then your #import "suchandsuch.m" causes that same code to be inserted into a different source file, which is compiled as well. The result: two different source files try to define Timing1ViewController.
To do your constants the right way -- by declaring them extern in suchandsuch.h and defining them in suchandsuch.m -- see this answer.
You probably have two Timing1ViewController classes with the same name. If you don't try to Product -> Clean and build again.

iOS - expected '=', ',', ';', 'asm' or '__attribute__' before typedef [duplicate]

I'm trying to port the speakhere example into another app and I'm having issues. I copied all the files, and all the frameworks, but for some reason I get a bunch of compile errors that I've never seen before and thus don't know what to do. The only difference is that i'm not suing IB and so i had to change it slightly.
What does error: expected '=', ',', ';', 'asm' or '__attribute__' before 'foo' mean?... I get this error multiple times for different files
In my situation the first error is pointing at 'MeterTable'.. a class that includes <stdlib.h>,<stdio.h> and <math.h>. But those files seem to be importing fine (if i remove them i get more errors)
Any suggestions on how to debug this?
TIA!
EDIT:
I still can't seem to figure it out. I'm literally just copying files from the example into another project. Can someone check it out please ? SpeakHerePort.zip and the original is here SpeakHere.zip
Your problem is that you are compiling SpeakHerePortAppDelegate.m, which is an Objective C file, but it is indirectly including MeterTable.h which is a C++ header file.
Rename it to SpeakHerePortAppDelegate.mm (double m) so that it is compiled as Objective C++ and your problem is resolved.
Name all your files .mm and then all your code will be compiled as Objective C++
In my case, the .h and .m in question are built fine with regular target, and the App can run as well.
However after the subset of the files are moved under a static library target, it gets this compile error when the static library is built.
Was stuck for a while & tried the above mentioned techniques, unfortunately they didn't help in my case.
Noted that this error happened only for the NSString*, for e.g.,
extern double const kTimeout; // fine
extern NSString* const kImageType; // compile error
After the above analysis & little break, eventually the problem is resolved by adding the the following import to the .h - "Foundation/Foundation.h"
It sounds like an unfinished declaration, probably in a header file. Search for 'foo' (or whatever the symbol actually is) across all project files, using ⇧⌘F (Edit ▸ Find ▸ Find In Project...) in Xcode, and/or examine the headers you're including where MeterTable is declared. Sometimes the compiler gets confused about the actual location of the error, since header files are frequently #imported into other files, so the problem can be manifest in multiple locations.
This might not have applied to this exact situation, but I had this exact error too, which was caused by a bad forward declaration. In Objective-C, make sure your forward-declares begin with the # sign - e.g.
#class MyClass;
Those of us still on autopilot from C++ will forget the #, see that XCode has highlighted class as a reserved keyword, and think all is well with the world. It is not.
It means that you have a syntax error. If you paste the code in question, it's easier to debug.
I had a similar scenario to some of the posts above. I'd written a C++ class based off of the examples in the Audio Queue Services documentation, and had this compilation issue in a test project. This post helped a tremendous amount.
Today, I'm incorporating the C++ class in my project, and got the build error again. In my scenario, I had to also set the type (using the "Get Info" window) to sourcecode.cpp.objcpp for the objective-c class that was calling my C++ class.

iPhone app: "Parse issue - expected ';' after #synthesize"

I'm working on an iPhone app and got this strange things happening.
I have a property declared in my .h file:
BOOL shouldProcessVenueListRequest;
#property(nonatomic, assign) BOOL shouldProcessVenueListRequest;
So far, so good. Then in my implementation .m file:
#synthesize shouldProcessVenueListRequest;
This works perfectly well for about 20 other properties, but for this one, I'm getting an error in the implementation: "Parse Issue - Expected ';' after #synthesize" - and the error pointer is in the middle of the variable name - see the image.
I tried removing and re-adding this property manually; tried copy/paste variable name from .h - nothing worked. I'm totally confused about this now. Any help is greatly appreciated.
Thanks to all who replied. It turned out to be an issue with the XCode rather than anything wrong with my code. Apparently, when I was typing the code in, I was interrupted half-way into typing, so that error message was valid (at the time). Then, about an hour later I came back to it and completed typing - but for some reason XCode was stuck on this error message.
I did 'clean', then 'build' - didn't help. So I did 'clean' again and then closed project. When I reopened the project and did 'build' again - the error wasn't there any more.
Strange problem. Try the following:
Try another name for your property (maybe it is a keyword/name used elsewhere, namely in any of Apple's framwork or similar - you could try command-clic on the word to see if Xcode finds its definition anywhere else than in your header file maybe?)
Be sure there is no hidden (non-printable) character
Try another place for your #synthesize, moving it one or two lines below, to check if the error comes from this very property or the one above it
[EDIT] Did't see this in your screenshot the first time, but it seems you have a semicolon right in the middle of your #synthesize shouldProcessVenueListRequ;est;, between the 'qu' and the 'est'... or is it the Fix-it proposition?
Check your code to ensure a few things
There is no space between shouldProcessVenueListRequ and est (even I thought you had a ; in there between the two parts :)
If you are copy-pasting the variable name from some place, you might want to type it all out manually (as Ali suggests, there might be a hidden character)
Try doing a clean-build
Even I got the same problem. When I checked it out, I gave the same name for variables but in different files. I just gave different names for all the variables, like if I have used a variable coupon in more than one file, I made it one as couponDisplay in one and couponList as another.

Where to #include?

In my past applications I have been #importing into my *.h files where needed. I have not really thought much about this before as I have not had any problems, but today I spotted something that got me to thinking that maybe I should be #import-ing into my .m files and using #class where needed in the headers (.h) Can anyone shine any light on the way its supposed to be done or best practice?
gary
In any source file, import only what you need to make that individual file valid for compilation. #class is also preferable to importing another class's headers, because the less you load the less you compile.
As a rule of thumb it is fine to use #class in your header file and an #import in your .m files. You'll get an error if you do it wrong from the compiler :)
Basically, if you are only making reference to the class you want to use, but not any specifics of the class then #class is all that is required. It tells the compiler "I'm going to be using this class here - you don't need to know much about it, other than that it is valid". (The compiler then knows to reserve a pointer for it).
If you were going to be referencing any properties/methods within the class, the compiler would start complaining (as it wouldn't have enough information about the class) so in those cases it wants you to import the file (#import xxx) in order to provide the class specifics to the compiler.
Hope this helps