I added the Parse SDK today (1.2.15) to an existing project which targets iOS7 and is built in Xcode5. I followed the instructions on https://parse.com/apps/quickstart#ios/native/existing exactly. Some things work, like creating and saving a PFObject. Certain functions however cannot be found by the compiler. For instance [PFUser enableAutomaticUser]; generates the error
AppDelegate.m:21:13: No known class method for selector 'enableAutomaticUser'
and [PFAnalytics trackAppOpenedWithLaunchOptions:launchOptions]; generates the error
AppDelegate.m:20:6: Use of undeclared identifier 'PFAnalytics'
Are the docs out of date and have these methods moved? I have tried restarting Xcode and cleaning my project. I can see the PFAnalytics.h file if I expand Parse.Framework in Xcode, and when I look at PFUser.h I can see a declaration of enableAutomaticUser;. Why can Xcode see some Parse classes and methods but not others?
My problem was that Framework Search Paths in Build Settings contained two directories, and one was invalid, resulting in this very strange behavior where some methods in Parse worked and others didn't.
When I'm typing up a Cocoa object and calling a selector on that object, I sometimes can see 'documentation' or 'help' information about that method. For instance, as I type [NSArray alloc], I see two help hints. One for NSArray, and one for alloc. Both of these appear in the popup autocomplete suggestions listbox as I type the code.
How do I produce similar method/class decorated help hints which will appear when I type? I want to see my comments as I type my custom class name and custom methods. How can I do this?
For instance, C# provides this feature through XML documentation which can be placed before any method, class, or interface/protocol declaration.
You have to create a “docset”. There are tools like appledoc for creating docsets from your comments. You could set up a build phase that runs appledoc on your code.
The problem is that there's no way to make Xcode 4 reload a docset except by restarting Xcode. So even if you run appledoc automatically as part of your build, you will have to restart Xcode to make it see the changes to your docset.
Is it possible to access the properties of objects in xCode console?
If I try the following I get an error that he property doesn't exist.
po someObject.someprop
If I don't breakpoint the code and run the app it works fine so I know someObject.someprop exists. I don't think I have the grasp on xCode console yet? What I loved about Flex/Flash development is that I could set a break point and in the console window or variables view I could traverse every structure down to the ends of the earth.
I could see SomeDicionary[key].someArray[1].someObject.prop and it would show me the value. Is this not possible in xCode console or is there a trick to get to it?
You'll actually have to use the bracket syntax notation:
po [someObject someprop]
The debugger is sometimes very finnicky about syntax. This is filled with all sorts of helpful tips for debugging in XCode.
Just a side note, variables/properties declared in the implementation file (*.m) instead of the header file (*.h) can sometimes be invisible to the debugger variable list display depending on if the breakpoint is in that class's code, because of scope. Not necessarily required here, but useful to know seeing as how it is kind of relevant.
I'm using a static lib thats giving me a warning when uploading my binary for review by apple.
The method in the static lib that causes the warning(non-public selectors) is never called by me, its corresponding .h is deleted from my proj, but warning still persists.
Given that I know the method name causing the problem, is there a way for me to open/edit this .a and comment/delete the offending piece of code and then use the modified .a in my project.
I don't have access to the .a source to recompile it, and its very old and the creator of it has no contact details for me to track down.
Many Thanks,
-Cake
Quick and dirty solution: Open the .a file in a hex editor and change all instances of the name. Leave the function name the same length so that offsets in the file don't change, just change a letter or something like that. I did a quick test, adding a dummy function to a subproject we're building as a static library then tweaking the function name in the .a file (there were five instances, for what that's worth) and everything built okay. I don't see any reason it wouldn't pass the App Store check after that.
I'm really surprised the function was still there in the final build, though—I thought Dead Code Stripping was supposed to clean out any unused code. Huh.
http://opensource.apple.com/source/cctools/cctools-809/
I don't presume to get your bounty, because I haven't provided an easy solution. But yes, it in theory is possible. You have your work cut out for you.
There are several solutions, depending on your lib and project.
In your build settings :
Enable "dead code stripping" if possible : If the method is never used (even internally), the symbol will be deleted.
Use "Unexported symbol file" : Simply add the symbol into a file and it will be removed from the binary. This will work even if the symbol is used internally.
Enable "Deployment Postprocessing" and "Strip Linked Product" with "Strip Style" set to "All symbol"
(Not sure) Use "Symbols Hidden by Default". This is related to the code generation and should not affect linking, but just in case everything above failed...
No need to hack the binary files. Just turn off the compiler's "unused selectors" warning: -fno-unused-selectors.
I am trying to run my cocos2d application and facing this error, as I have recently upgraded my sdk to 4.2 and my cocos2d to 0.99.5.
I tried to clean my project even change the Target ios Deployment but error remains the same. Also rename the className aswell in order to avoid duplication from Library classes names of cocos2d.
ld: duplicate symbol _OBJC_METACLASS_$_MenuSceneNew in
/Users/umaidsaleem/Desktop/functionalityTest/build/Debug-iphonesimulator/libcocos2d
libraries.a(MenuScene.o) and
/Users/umaidsaleem/Desktop/functionalityTest/build/functionalityTest.build/Debug-iphonesimulator/functionalityTest.build/Objects-normal/i386/MenuScene.o
Another rather simple thing to check is that you did not accidentally #import a .m file instead of a .h header file.
Happened to me.
You are linking the file MenuScene.m twice. You apparently have it in a static library and also in your main application.
Another reason for this, for those out there who did the same as I just did, might be that you re-created a managed object class. By doing that and choosing another group in the project structure, you accidentally create another reference to the same files.
I ended up with two references for header and implementation in both the root of the project and in my model group. Removing the topmost references to .h and .m files got rid of the linking failure.
Sometimes Core Data inserts AnyProjectNameModel.xcdatamodeld to the Compile Sources of the Build Phases. Check it and delete it and everything is run again...
The error message just indicates the generated ManagedObjects...
The correct place for the AnyProjectNameModel.xcdatamodeld is the Copy Bundle resources in the Build Phases.
Check the Compile Sources of your target and see if a class.m file is included twice
A stupid mistake that I made was that I named my #implementation the same as my superclass.
In the .h
#interface Subclass : Superclass
#end
In the .m
#import "Subclass.h"
#implementation Superclass
#end
None of the regular suggestions from google seemed to help, so if someone is as crazy or tired as I am (maybe a healthy mix of both), make sure you haven't duplicated an #implementation!
In my case this was happening because of Xcode automatically generating my NSManagedObject class, which then clashed with my manually created NSManagedObject class. In this case you can set "Codegen" to "Manual/None" in the Data Model Inspector for your newly created Entity.
Another thing to check for the double linking - its possible to have the same file in two different places in the file list on the left. Then the compiler compiles and links it twice.
This happens when playing with organizing your file hierarchy, for example.
You don't have to be making a library or anything fancy - just drag a .m in to two different locations in the project tree.
Remember to only remove the reference to one of them, no file trashing is needed.
To me, removing -all_load from 'Other Linker Flags' fixed the problem.
I have also had this particular error occur when a file that has not been added to the project, is referenced somewhere in the project. The two cases where I have experienced this are where I have deleted/removed files from the project without removing references to them, and when working cooperatively on a project where a teammate added the reference but I have not added the file to my version of the project.
I know the OP has resolved their problem, but I felt this might help someone else who reads this question while looking for help.
I have figured out the solution myself, sorry for posting little delayed. All assistance are much appreciated the but problem arises when I add new CCLayer derived class and checkmark cocos2d 0.99.5 static library which was wrong. Then I re-Ad my class without checking and clean my targets and then build and go. Problem solved now.
I had a project with 2 targets. A target named Component and the second named Sample. Sample was using component as a link library.
Then Component was using a pod named MyPod (installed with cocoapod).
The Podfile was written like this :
def shared_pods
pod 'MyPod'
end
target 'Component' do
shared_pods
end
target 'Sample' do
shared_pods
end
Both targets was referencing the shared pod list. When building Component target, no problem appears, but when building sample i get a duplicate symbol _OBJC_METACLASS_$_ClassName.
I have changed the Podfile to :
def shared_pods
# empty
end
target 'Component' do
pod 'MyPod'
shared_pods
end
target 'Sample' do
shared_pods
end
And that solve the problem.
3 hours spent, hope to save somebody time.
XCode Beta crashed for me while deleting a reference to a class. This caused the problem described in the answer, the fix was different again.
In my Target's Build Phase, under "Compile Sources", the item giving me grief was red. I couldn't remove it with the minus button, but typing "skip" in the compiler flags caused the red class to disappear after reloading the project. I'm assuming you could type anything in there.
It took me two hours to find the solution to my prob, I put it in here for another option to those having this problem, although it is probably not going to be a common one.
None of the Answers worked for me, so what I did was remove the files from the project and choose only Remove References.
Then I added back the same files and it worked.
That fixed my error. Maybe XCode got lost references stored somewhere since the project is multi-collaboration.
Hope that helps someone.
Another possibility for error like this is when there is a class name collision. Either 2 classes with the same name within your project, or class from your project clashing with one defined in some of dependency libraries.
Remove target from right panel and again add target. This will remove any duplicate references.
It may happen if 2 programmer add the same target and commit the project file.
In my case I was using a binary library includes the same class name I was using outside,
So I changed my class name and It's working fine :)
In my case, I had added the libxxxx.a to Link Binary with Libraries section in the subProjects as well as in the mainProject. Hence there were duplicate symbols. Removing from subProjects fixed it.