OpenFeint Xcode 4 integration, prefix header not found - iphone

I just upgraded to Xcode 4, deleted the OpenFeint folder and added the new 2.9.1 framework according to this readme.
Then I deleted the "build"-Folder (that is now located in ~/library/Developer/...) and rebuilt the application but always get the following error:
/Users/k****/Documents/Tactica/Tactica_Prefix.pch:5:30: error: OpenFeintPrefix.pch: No such file or directory
When I have a look into OpenFeint.framework/headers there is clearly a file "OpenFeintPrefix.pch" included.
Any Idea why Xcode doesn't find it?

You have to add OpenFeint/ before any includes, like
#import "OpenFeint/OpenFeintPrefix.pch"
This should do it :)

I used OpenFeint a long time ago. The most errors I can solve with redo the instructions.
Also with updating to Xcode 4 al paths gets changed and Xcode has problems with finding files from old projects.
I recommend you to redo the instructions and if it didn't work, I'd recreate the project and add OF again, the problems should be gone then.

When I have a look into
OpenFeint.framework/headers there is
clearly a file "OpenFeintPrefix.pch"
included.
The most obvious point would be, are you looking at that location through finder or Xcode.
The file must be included in your xcode project itself rather then just in that folder on the computer?

Related

Xcode upgrade: PBXContainerItemProxy missing containerPortal key

I just upgraded my Xcode, now when I try to open my project, I get this error:
Project /Users/xxx/xxxx/xxxxx/xxxxxx/xxxxxxxx.xcodeproj cannot be opened: PBXContainerItemProxy (xxxxxxxxxxxxxxxxx) is missing a containerPortal key
I have searched the web and stackoverflow, but cannot get anything relevent to come up at all regarding this.
I do have Three20 as part of my project, I don't know if that matters. I just upgraded to xcode 4.4.1
Thanks for any insight.
-D
the project icon which we see i.e projectname.xcodeproj, is actually a directory, you do this
1. in terminal do cd yourproject.xcodeproj
2.ls
3.vi project.pbxproj
4. scroll down till /* Begin PBXContainerItemProxy section */
5.there you will see all sections check for the section which is missing a portal key edit it and save it :wq it will work
in image if you see the first section is missing container portal key.just pic it from other section and replace it..
it will work :D see this link
Now I should start with that I do not know the actual error, never seen it before, but I did find a reference to a "PBXContainerProxy"-error in this post (As soon as I add a project to XCode 4.0.2 it crashes) and thought you might try the solutions from there?
"Apparently this is due to the new version of XCodeProjects. I found a
work around by pre-compiling the library that was causing the issue
and then using the linker to link to the .a file. I also had to copy
the .a library into the DerivedData path.
The real solution was to remove the project and replace it with an
updated project for the new version of XCode."
Hope that helps somewhat :)
Never saw that error either, but if you're upgrading directly from XCode 3.X I'd suggest you to go to https://developer.apple.com/downloads/index.action?name=Xcode
and download/install a previous version of Xcode somewhere else. (You can have several different copies installed on your machine, just google it if you don't know how but just remember to use xcode-select to pick the one you want to use). Repeat with all the versions back to 4.0.1 until (hopefully) it works. I know it's tedious but it might help.
If it does, validate the project settings and try to open it with 4.4.1. That should work.
Good luck

iOS Devtools.Core Framework pbxcp missing in Xcode?

I downloaded the Doomclassic Source Code and wanted to have a look at it. First I wanted to compile it to see if it actually works. So I followed the instructions and copied the .wad files into the base folder, openend the project and hit compile. Aside from the over 300 warnings and the missing files (mostly Images, which I mostly fixed) I have a strange error during teh compile phase and google is no help at all.
It says:
/Users/tobias/Library/Developer/Xcode/DerivedData/Doom-egfadrxunamfwjdsdaylawcyppkc/Build/Intermediates/Doom.build/Debug-iphonesimulator/Doom.build/Script-435F41A90F532CA300887552.sh: line 3: /Applications/Xcode.app/Contents/Developer/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp: No such file or directory
When I check my Xcode.app the only framework in the PrivateFrameworks folder is IDEBundleInjection.framework
I also had a look at the script:
!/bin/sh -x
PBXCP=${DEVELOPER_DIR}/Library/PrivateFrameworks/DevToolsCore.framework/Resources/pbxcp
${PBXCP} -exclude .svn "${PROJECT_DIR}/../../base" "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/"
So it seems that I need this framework - but even with google I couldn't find it and I wouldn't know how to integrate it into the Xcode App? I have updated Xcode to 4.4 just now but it's still the same error.
Does anyone has any advice please?
The pbxcp command was removed from XCode 4.4, so you'll have to find a replacement for it. See this mailing list thread to alternatives to the command.

RestKit/RestKit.h file not found error - version 0.10.0

I am losing my hair in my attempts to get RestKit to build and work. I get the dreaded "Lexical or Preprocessor issue: RestKit/RestKit.h file not found" message. I use Xcode 4.2 & my project is for iOS.
Earlier, I had debug mode working perfectly with RestKit 0.9.0. Then I ran into issues while trying to archive. After reading this forum and attempting some solutions, I decided to upgrade to 0.10.0 with hopes that it will solve the issue.
Now, my project is not even building in debug mode and I get the same RestKit/RestKit.h file not found error.
I have this under Header search path: "$(BUILT_PRODUCTS_DIR)/../../Headers". Can you please suggest (for 0.10.0 version):
1) Where should the physical location of RestKit be? (It may not matter, but which one worked for you - with hopes that I can mirror your setting)
2) I tried to point my header search path to "/Developer/Library/RestKit-RestKit-69adee9/" and later to "/Developer/Library/RestKit-RestKit-69adee9/Build"
Throughly confused and frustrated..
EDIT1: After several hours, I gave up. Nuked my project. Created a fresh project. Re-created the files (copy paste from prev project). Now "RestKit not found" error is gone! But now, I am getting this other error:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_RKObjectMapping", referenced from:
objc-class-ref in myclassname1.o
"_OBJC_CLASS_$_RKObjectManager", referenced from:
objc-class-ref in myclassname2.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I checked & made sure that I did NOT add RestKit.framework... I've no idea why the clang error is happening now
EDIT2: The libRestKit.a was red. It is OK according to https://github.com/RestKit/RestKit/wiki/Installation-Troubleshooting Just for the heck of it, I removed all the linked dependencies. Removed the "Other linker flags". Closed & reopened Xcode. Put them all back. That error is gone. Maybe I missed a framework which resulted in clang error. But it is highly unlikely for I checked & double checked. It works now.
It builds & archives on debug mode. I haven't tried the distribution mode yet.
EDIT3: Apple approved my app in the first go & it is live! I still do not know what caused the issue here. Nuking an existing project & creating a new one & copying over the old files (& periodically checking if build goes through) cannot be a solution. So I am leaving this question open.
I think I can shed some light on this.
When you upgrade to 0.10.0, you change your header search paths to "$(BUILT_PRODUCTS_DIR)/../../Headers", right?
The install guide only says to do this for the project settings. However in many cases, mine included, you'll need to also update them for the target settings as well.
The target settings will still have the old header search paths, and for whatever reason decide not to inherit from the project settings.
Mind you - its a total hack - but it got my project running.
Assuming that you've already followed the installation steps from the RestKit Github
https://github.com/RestKit/RestKit/blob/master/README.md#quick-start-aka-tldr
In the RestKit target, goto Build Phases. Under the Copy Headers dropdown, move all of the header files from "Project" to "Public".
Clean, Build, Run.
Solution I found was not to copy and past the "$(BUILT_PRODUCTS_DIR)/../../Headers" to your target's Header Search Paths.
After five hours I deleted the copy and pasted " and manually typed them in and it worked.
I recently played around with upgrading from RestKit 0.9.3 to 0.10.0 and had the same thing. Did you delete the RestKit/build directory? This contains a copy of the .h files and is created as part of the build process when building 0.9.x. Doing Product -> Clean doesn't seem to delete these files. 0.10.0 doesn't seem to create this build directory. I suspect that your build errors are due to those files still being picked up.
Also, to answer your question fully, I keep RestKit files in:
(project dir)/Frameworks/RestKit
This is a git submodule so it contains a clone of the RestKit git repo at a particular revision.
And the header search path is:
$(BUILT_PRODUCTS_DIR)/../../Headers
The header search path for 0.9.3 was:
$(SOURCE_ROOT)/RestKit/Build
I found this guide helpful (maybe this is what you are already following): https://github.com/RestKit/RestKit/wiki/Installing-RestKit-in-Xcode-4.x
and note the section about only having libRestKit.a in the project for the latest RestKit versions where earlier versions had all of:
libRestKitNetwork.a
libRestKitObjectMapping.a
libRestKitSupport.a
libRestKitJSONParserJSONKit.a
libRestKitXMLParserLibxml.a
libRestKitCoreData.a
If you have all of these, delete them from your project.
Been fighting with the same issue for the past few hours. What finally worked for me (and I'm not saying this is a definite fix, but at least it's something to try).
Delete RestKit from your Project
Close your project
Move the RestKit folder next to your main xcodeproject
Open the RestKit project and build it
Close the RestKit project
Open your project, and re-import the RestKit project into your xcodeproject
Fix the Dependencies and Linkings in the target settings
Add the "$(BUILT_PRODUCTS_DIR)/../../Headers" search path to BOTH the project settings and the target settings. (it only worked for me when they were listed in both).
This last step might be all that's necessary to fix it, but since I too was pulling my hair out over this, I tried a lot of different solutions and didn't want to assume that this last step was the sole reason it fixed itself.
(and my setup is XCode 4.3.2 and OS X 10.7.3)
After spending 2 days on this same error and navigating to every possibile google result I finally got it!
It's not due to Derived Data settings, those are fine already in XCode 4.3.2.
The problem is that you are doing a #import "RKObjectMapping.h" or some other include.
Instead use #class RKObjectMapping or if you really nead the .h use <RestKit/RKObjectMapping.h>
I went with #class since I just need to compile...
Hope this help!
Had this problem too. It would build and run just fine on simulator, but would not archive. Here's where I went wrong...
I did this:
#import "RestKit.h"
Rather than the correct way:
#import <RestKit/RestKit.h>
I had the exact same error today. All our code is in a github repo and the restkit folder is ignored so none of the restkit files were in there. Now, when xcode opens the project and finds stuff missing, it assumes all hell broke loose. So, deleted the folder, re cloned it and then grabbed a fresh copy of the restkit and threw it in there and voila, everything worked.
I found that I need to manually build the RestKit target for the header files to be copied into the build directory. Apparently the master project build does not reliably run the subproject build?
So, my steps for fixing this issue:
Select the RestKit run target
Build
Make sure the header search path was set on all target (apparently on project itself is not enough)
Build main project
Had a very similar problem. It turned out to be I had accidentally added the build setting to "User Header Search Paths" rather than "Header Search Paths".
My solution:
When adding "$(BUILT_PRODUCTS_DIR)/../../Headers" to
Targets -> Build Settings -> Search Paths -> Header Search paths,
the value was not set.
Instead the value has have been set up to User Header Search Paths.
So you double click to Header Search Paths, some pane with lines appear, you click + down left, paste that string there, click somewhere else to dismiss the window and... nothing.
The Header Search Paths didnt get updated but User Header Search Path did.
?!!!
So you click on the disclosure button on Header Search Paths.
Click + sign right of the attribute and add the value...
Here's a common mistake that'll make you want to slap yourself after you fix it.
Yes, you definitely do want to add "$(BUILT_PRODUCTS_DIR)/../../Headers" to your target's Header Search Paths, but don't forget to include the quotes!
I'm talking about the quotes that are before $(BUILT and after _DIR)/../../Headers
If your build configuration has a space in the name (e.g. mine is 'Ad Hoc') and you've just added $(BUILT_PRODUCTS_DIR)/../../Headers without the leading and trailing quotes, you may end up getting the "Lexical or Preprocessor issue: RestKit/RestKit.h file not found" problem.
This is a problem that I don't think has enough answers for this problem, because if you have this problem it feels like there is nothing to be done! After trying all of the proposed solutions (none of them worked). I finally found the problem
The problem was that one of my folders had a space in it. Don't use spaces in your source folder names!
Used to be : (/Xcode projects/basicRestkit etc...) -- lots of pain and suffering
changed to : (/projects/basicRestkit) -- lots of rejoicing
This caused the header search paths not to work, and therefore not to find the files. There may very well be a way to use alter the header search paths to find your files even with spaces.
This might not help you, but it very well could. Good luck.
For me only these steps works. Check here Hope this will help.

refactor function error - "is not part of the build phase of any targets in the Xcode 3 projects in this workspace and so can't be refactored"

Trying to rename a function's name via the refactor->rename button in a categoriy's .h file in XCode 4.1 I'm getting this error: (error and body)
UINavigationController+ZG.h is not part of the build phase of any targets in the Xcode 3 projects in this workspace and so can’t be refactored.
Add the file to the build phase of a target in an Xcode 3 project in this workspace, or make a selection in another file.
Not sure what it wants and why it's saying something about xcode 3 when i don't have any xcode 3 projects or anything like that.
I had this issue today on a project which don't use workspace at all.
I couldn't get why Xcode behave wired. Auto complete worked, but return some really unrelevant results as my FAMILY NAME (?!) for a class I was working on.
I found it to be a bug in Xcode 4.1 under OS X 10.7.1 along side with other issues i had.
When I reopen my project, the message was gone, refactoring worked as expected and auto-completing worked as well.
September 2013 Update:
It seems that this bug is happening also on Xcode 5 & 10.8.5.
Restarting Xcode did not fix this for me (although it does normally fix a lot of things). I also didn't like the idea of File >> Save As Workspace. As the workspace should already be in my .xcodeproj file, so I didn't want another one. I found another solution that fixed it for me: Window >> Organiser and then Delete Derived Data for my project. Found it mentioned in this other question.
I was able to get past this error by choosing File >> Save As Workspace.
For me personally it was a combination of things.
Deleted derived data from Organizer > projects. (Didn't work after this step)
Restarted Xcode. (Worked after this step)
I have just run into this issue as well. I found that running:
Product->Clean
Fixed the problem, and I can now use refractor again.
I replaced some dead values in project.xcworkspace (Show Package Contents on your Xcode project file) and the problem went away
Have you ever deleted .xcworkspace in Finder? Although the file will be auto-generated by Xcode again, yet its content will be changed. I think that causes your problem.
I saw a post recommends to delete .xcworkspace for the purpose of enhancing build speed. Well, mind the catch.

Upgrade to iPhone SDK 3.0 Causing UIKit Problems

I have an existing project that I was working on, and I recently decided to update my iPhone SDK and updated to the latest 3.0 SDK.
I update my SDK and go to open my existing project. Sure enough, there are some problems including some certificate problems and so on. Anyway, google and I were able to solve most of them, but I haven't had any luck on what I hope to be the last of my problems.
When running my program in the simulator, I now get
dyld: Library not loaded:
/System/Library/Frameworks/UIKit.framework/UIKit
Referenced from:
/Developer/iGameLib/iGameLib/build/Debug-iphonesimulator/iGameLib.app/iGameLib Reason: image not found
Now, I discovered the UIKit has moved to
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0sdk/
System/Library/FrameWorks/UIKit
and I have updated my target and project settings to point to that new framework location, but still when I build it, no luck.
I have also tried clearing out the simulator's applications and settings, still no luck.
The referencing .app is cleared when I run the "clean" menuitem, I have confirmed this, so clearly something in my project settings are still pointing to use the old UIKit location.
Where should I be looking?
I've gone as far as I can to help myself but I'm afraid I'm at a loss here. I don't see it under the target settings, or the project settings, or the plist, or any of the other files within my project.
I was getting the same error
dyld: Library not loaded: /System/Library/Frameworks/UIKit.framework/UIKit
The solution on my case was simply quit Xcode and try again.
OK, SO I HAVE THE ANSWER!!!
Quite simply, Xcode is not changing all of the variables correctly in the actual .xcodeproj file. So, here are the steps I took.
Get out of Xcode, you've got to do this job at the terminal. Bring up a terminal and go to where your project is. Find your .xcodeproj and go into it as if it were a directory. It looks like an actual file in finder, but it is one of those package directories.
Now, I couldn't get textedit to allow me to edit it, but you can go into nano, so like I did
sudo nano project.pbxproj which is under my .xcodeproj file/folder/package/whatever.
In this file, you need to find where the SDKROOT is set. Chances are there are a few places it is referenced, but you're looking for SDKROOT = iphoneos2.2.1 or something similar. Change ALL OF THESE (there are a few) to SDKROOT = iphoneos3.0
Now, you're half way there. do ctrl x and save the file. Next you're going to do ls and find out what the .pbxuser file is. Mine is myname.pbxuser. run the same command of
sudo nano myname.pbxuser
In this file, there are a HUGE number of references to the 2.1 iphone sdk directory. Do a search/replace of iPhoneSimulatorOLDVERSION.sdk, in my case it was iPhoneSimulator2.1.sdk
and change the 2.1 to 3.0. Be very careful with this though, I wouldn't want to know what happens when you mess this file up.
Save it and open xcode. CLEAN the project and build and run. Presto!
Check your target settings
Make sure you're actually linking to all of those frameworks in the Target (check under "link binary with libraries")
Make sure you've chosen the 3.0 sdk as your base SDK
Create a blank project and add your frameworks as before; if you still have issues, probably a borked SDK install
BTW, you shouldn't have to re-add sdk frameworks, as the paths are relative to the current SDK
Just trying to be helpful… not sure I can debug from here :)
I have had some similar problems with Xcode that seem to have no apparent cause. The fact of the matter is that Xcode does still have bugs here and there and sometimes you WILL run into a wall.
My Experience: Similar to your situation somewhat, on one particular occasion, an Xcode project I was working just stopped building for whatever mysterious reason, and no amount of cleaning, googling or SO-ing provided me any answers. So I simply created a FRESH, NEW project and filled the source-code from my corrupt project into that of the new project. The new project used the SAME source, libraries, resources, settings, mind you -- and yet it built with no problems. It took about 20-25 minutes to make the transfer but considering that I had spent several HOURS trying to address a bug that would not reveal itself in the corrupt project, the time was well worth it.
So, I'd suggest doing what I did: Maybe try creating a fresh project and transfer your old source and resources over.
Good Luck
I just deleted the UIKit.framework from the 'Frameworks' folder, right-clicked and added it back again.
Clean build, and no problem..
I had the same problem using Xcode 3.2.1 but it was solved in an easier manner. I realized I had recently disabled my target's environment variables, specifically ones to do with memory debugging (NSDebugEnabled, NSZombieEnabled, NSAutoreleaseFreedObjectCheckEnabled, MallocStackLogging, MallocStackLoggingNoCompact). The app ran once in the simulator after removing the environment variables but never again after that.
Quitting Xcode, the Simulator, restarting Xcode and doing a complete clean of the target (including it's dependencies off course) brought me back to a good state.
Same problem when launching my application without debugging.
In my experience the produced binary does not seem to be the culprit.
I created an app from the xcode wizard which does launch OK in the simulator (let's call it testApp, my application being called myApp), I tried to figure out where is the difference with my app.
otool -L myApp
gives correct (relative paths) to the frameworks, same as testApp
ps -E
DYLD_ROOT_PATH, DYLD_FALLBACK_FRAMEWORK_PATH, DYLD_FRAMEWORK_PATH, DYLD_LIBRARY_PATH environment variables needed by ld to locate the framework
are OK for myApp compared to the values of these variables when testApp is launched
I suspect that the problem lies somewhere in the communicartion between XCode and the simulator once the app is launched ... altough I can't find what's wrong ...
The solution that worked (at least for me) have certainly some big side effects but here it is :
quit xcode
browse the content of the package myApp.xcodeproj
unlock .model1v3 and .pbxuser for modification (the lock in the information panel (cmd-I on the file))
delete these two files
start xcode and retry to launch your application from there