Unable to add Coredata Framework in iPhone - iphone

In my application I have accidentally deleted CoreData framework from my resource folder.
But after that when I tried to add framework from build settings,Coredata.framework is missing from the list. Any help will be appreciated.

I think you have deleted the framework instead of removing the reference.
Find CoreData.framwork on another PC, copy the complete framework and paste it in the folder of frameworks in your PC(/Applications/Xcode 5.0.2.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks).

First see if CoreData.framework is still in the list of your selected frameworks. If it is, select it and click the minus sign - to remove it. Then add it again.
The problem is that it is still marked as added in the configuration, but cannot find the appropriate file in your bundle because you deleted it.

Related

Xcode not allowing to copy files to bundle

I am having problem in copying files to Xcode bundle.
I have some files in my bundle and i am trashing them and copy new same named one from another project.
But regularly Xcode giving error as : Multiple errors occurred while copying the files.
I have done much RND but no solution.
Can anybody help me out.
Thanx in advance.
Because you just deleted files from your project but one copy of each file is still in folder where your project is. Delete all red lines first if there is any. And see below steps -
Right Click on your project
Show in finder
Find your files and delete them
Now delete all red line files
Command+shift+k clean your project.
Now add new files.
I realize this is an old post but am adding here in case others run into the same issue. I was working on a project where I utilized AFNetworking and performed the following steps:
I dragged and dropped the files into my project and asked xCode 5 to make a copy of the same (rather than create a reference).
I needed to delete the folder/files I just imported and right clicked on the same in the file navigator in xCode and hit Delete - I did delete the folder/files in the manner laxonline describes above.
Attempted to re-add the AFNetworking library code back into my project and got the below message.
The fix here is to follow the steps in the accepted answer - i.e. To right click on your project in xCode, select Show in Finder and then delete the offending files/folders.
I upvoted the accepted answer but am also posting this as a separate answer so I can highlight that the above can occur even if you select the correct delete option. In my case, I discovered that while the AFNetworking files were no longer in the directory, an empty folder with said name still existed.
While deleting the exicting files from Xcode. The Xcode4 asks you "Do you want to permanently delete the file “fileName” from disk, or only remove the reference to it?"
By default the alert selects "Remove Reference Only"
Change it to Delete.
while deleting files you must select move to trash option.
If you select Remove References then only the link to those files gets removed and you will have to manually delete those files from their location.

SystemConfiguration.framework appears red

I am writing the Network detection stuff for my app but when I go to Link Binary with Libraries and add SystemConfiguration.framework it appears red, and my app breaks. Has anyone got any ideas on why it might be doing this and how I can solve it?
You could have deleted it from your project by accident I have done this in the past when you delete you must have move to trash instead of remove reference, I had to download xcode again to get it back.
It may be a case of either the Framework simply not being added to the project properly, or, worst case, as it has been suggested here, you could have deleted the framework itself from your Mac altogether.
Here a few things you can try out,
Does the framework not appear at all on the project navigator in XCode? Or does it appear red? In either case, go to the 'Linked Frameworks and Libraries' section in your Target summary, and click the '+' button to try and add the framework.
If the framework exists in this list, no problem, simply add it again, and you should be all good.
If its not there at ALL, then this looks like you may have deleted the framework from you machine altogether. If so, you can either reinstall XCode, or you could simply get that framework folder from a colleagues machine and drop it in the frameworks folder.

Importing frameworks on xcode 4 issue

Lately any framework I attempt to add to my project fails with "No such file or directory".
Eg for GameKit:
<GameKit/GameKit.h>: No such file or directory
The strange thing is that the frameworks that I added some time ago are found, but if i try to add the same framework now, I get this error. Where should I look? Hope I don't have to re-install xcode for this:(
To add a framework I use the steps described here (to remove the suspicion that I don't add it in the right manner):
How to "add existing frameworks" in Xcode 4?
Also I've checked here:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/System/Library/Frameworks/GameKit.framework/
and the framework does exist. The base SDK is set to 4.3(latest), so that's not the problem either.
I'm not sure if this is going to work, but I use another method to add frameworks, which is go to your project (The one with the xcodeproj icon), then click on your target. There, you can add the frameworks you want.
If that doesn't work, then try go to /Library/Frameworks to see if your framework you want is still there. If it's there and it's still getting that error, try manually adding the framework which is the add other button when you add a framework.
It must not exist. It either got deleted or never existed to begin with, which makes me think it must have got deleted. Sorry, buddy.

iPhone "_OBJC_CLASS_" compilation error

I am trying to compile my project in Xcode. But i am getting the following error.
"_OBJC_CLASS_$_InfrastructureBenchmarkingViewController", referenced from:
objc-class-ref-to-InfrastructureBenchmarkingViewController in RootViewController.o
4 more of similar type.
Can't understand the meaning of this error?
Small Clarification: Actually the _InfrastructureBenchmarkingViewController was a module in another project. The files pertaining to that I have copied into the new application.
Sometimes it happens when the project definition file (.xcodeproj/project.pbxproj) is somehow messed-up, eg. because of XCode crash or project is taken from someone else, etc.
So try removing InfrastructureBenchmarkingViewController (Delete the file, then choose "Delete reference", so it is not deleted physically from disc) and then again add this file to project (Add > Existing file from the project context menu).
It worked for me several times.
you need to link in whatever framework _InfrastructureBenchmarkingViewController is a part of. Try going to the project window, right click on frameworks and choose add existing framework ....
you should be able to find the framework including _InfrastructureBenchmarkingViewController there.
Seems you have some object files that are not valid anymore. Use the clean option from menu and build it again. That should solve it.

Build Error - missing required architecture i386 in file

I'm getting this error when building my iPhone application:
ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/System/Library
/Frameworks/UIKit.framework/UIKit, missing required architecture i386 in file
It goes the same for all the frameworks in my app. It's very weird since this was not happening earlier.
This happens when you add a framework to your project and unintentionally copy the framework into your project directory.
The fix is to check your project directory (where you store your project on disk) for any iphone SDK *.Framework files and delete them.
Project will build fine afterwards.
I had this same problem, and the solution turned out to be an easy fix. Backup then open project.pbxproj (located inside your project file bundle) in TextMate or TextEdit and search for the section titled "/* Begin XCBuildConfiguration section */". Look for a key named FRAMEWORK_SEARCH_PATHS and delete it and it's contents (once per build configuration, so I removed it in two places). Here is an example of what I deleted:
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(DEVELOPER_DIR)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/System/Library/Frameworks\"",);
My project now build for both the iPhone device and the iPhoneSimulator.
What has happened here is that Xcode has mysteriously added a "Framework Search Paths" entry that points to a particular iPhone device SDK. For example, mine was recently set to:
$(DEVELOPER_DIR)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.1.sdk/System/Library/Frameworks
This leads the compiler to find frameworks of the incorrect architecture. Removing any values under the "Framework Search Paths" key in your target's build settings will resolve the issue.
I just wanted to mention that in XCode if you go to "Edit Project Settings"
and find "Search Paths" There is a field for "Framework Search Paths". Updating this should fix the problem, without having to hack the project file!
Cheers!
Jesse
Check that you didn't copy the framework into your project when you added it. If you copied it, it can't find the original paths. To fix this problem. Delete the AVFoundation framework from your frameworks folder in your project, then add it again, but this time, make sure you don't have copy check marked.
This fixed it for me!
I fixed it in a different way.The reason why i was getting this error was that i added security.framework twice in my project.I was not able to see security framework in xcode ,i opened the project in finder and found this framework which i deleted and problem solved.
If your app is meant to run on the device, make sure you are not trying to run in it on the simulator. May sound obvious, but check anyway.
Though it is possible that something got deleted, it has been my experience that something gets screwed up in the project file. I have yet to pin down what that "something" is. I've had similar issues when the SDK installation is just fine. There are a couple of options.
First, add all of your files to a new project. This seems to usually work. Kind of a pain, though.
Second, you can right-click project in XCode/Get Info/Build/Library Search Paths. Add new paths similar to /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/usr/lib. Add appropriate versions of that string for each version (2.2.1, etc) and platform (simulator or iPhoneOS). Perform a similar action for Framework Search Paths if frameworks are your problem.
Third, which is more work but more reliable, is to open project.pbxproj from within MyProject.xcodeproj (Textmate is good for this). Look for "/* Begin XCBuildConfiguration section */", then "LIBRARY_SEARCH_PATHS" and "FRAMEWORK_SEARCH_PATHS". Add or modify the paths as appropriate, and save the file.
In any case, a pain in the butt, and I'd sure like to pin-point the cause because I've had this happen a couple of times. Project builds fine, then just up and refuses to do so with what seems to be little reason.
"Edit Project Settings" and find "Search Paths" There is a field for "Framework Search Paths". delete all!!
It just happened here to me as well. Thanks to a great partner we found the answer. Your Xcode may be pointing to the simulator ..change it to a IOS device instead ..built smooth after ....
Run the file command on the framework from Terminal:
file /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/System/Library /Frameworks/UIKit.framework/UIKit
You should get back a message telling you which architectures the UIKit binary is compatible with. If you don't see "i386" listed, then you've somehow managed to remove the i386 version of UIKit, which will mean that you can't build for the simulator.To fix that, you'll have to re-install the SDK.
If you get some other error, hopefully it'll help you figure out what the actual problem is.
I just want to let you know that In my case, I was having the same problem, I realized that I had an older Xcode folder called Xcode3.1.3 I just rename it because it was an older version and that did the magic for me.
Check your library search paths in your target settings. Sometimes goofy libraries get entered in there and this will give you a similar error.
You can remove all entries in this section.
I'd just experienced something slightly different, because I work on my own library (WM_GSRecognizerLib), but the error is the same.
What'd happen: due to some updates, the path targeting the lib to include (.a) was from the "Debug-iphoneos" folder (where it is generated). Compiling for Generic iOS Devices worked fine, but not for simulator, complaining for the missing i386 architecture.
What I did for this issue, is to also include the binaries from the "Debug-iphonesimulator" folder.
It can help for this topic, because the explanation is here: devices require binaries for arm64/armv7/armv7s, while simulator does need i386.
My solution was to set on simulator target debug YES, just look on git status to see the new line added as architecture only on .project. if you don't set this the build will run to all architectures and will show some missing architecture like i386 or other.
NOTE THAT obviously the main issue is to use some framework that implements some kind of specific architecture.
I too got the same error am using xcode version 4.0.2 so what i did was selected the xcode project file and from their i selected the Target option their i could see the app of my project so i clicked on it and went to the build settings option.
Their in the search option i typed Framework search path, and deleted all the settings and then clicked the build button and that worked for me just fine,
Thanks and Regards