Frameworks are 'red' in Xcode - iphone

I downloaded a project developed by Apple employees ( who taught course at Stanford on iPhone application development). Strangely , the frameworks are red.
http://img.skitch.com/20100730-kcjun96mp2pxnpg7w3x6njw57.jpg
I tried to locate coreGraphics.framework and UIKit.framework to add them again but i couldnt find them either.
Taimur

The red text indicates that the actual files are not at the path that the project has for them.
Get info on the framework and look under the General tab. The first section shows the name and path of the framework bundle itself. The most common cause of a problem with system supplied frameworks is that the path type has been changed to something that breaks the path. The default setting is Relative to Current SDK. Change the path until you get one that leads to the actual framework.
If you have the developer tools installed in a custom location, you are more likely to run into this problem. If you copy a project from someone with non-standard settings, you can encounter it as well.

Are you building for a Simulator or for Device?
Try building for Device.

Found a way to fix this automagically:
Right click your main Xcode project file (the blue one at the top ),
Get info,
'General' tab,
At the bottom, set 'Base SDK for All configurations' to your desired one.
Done!

Steps to fix this issue in M1 Macs:
Install "sudo gem install cocoapods-deintegrate cocoapods-clean" to install deintegrate if not installed.
Run "pod deintegrate" in terminal in your project folder to uninstall all pods.
Run "pod cache clean —all"
Run "pod install"
Go to Project Explorer Select "Pods" in blue
Select the each pods in the target section
Search for "Excluded Architecture" in Build Settings Tab under "All" sub category.
Add "Any iOS Simulator SDK" in both debug and release and set the value to "arm64"
Repeat this for each Pod with the error "Framework not found".
Clean Build the project.

#Taimur Hamza - Its happen (red color) following any one of reason,
Your downloaded project may be miss some required files
Before run the application at first time.
so, first you have to find that above reason is happen and try to solve via copy the framework from another running project and paste it your project.

I had faced this problem before. I got over it by copy the missing (in red) framework from my friend's Mac then copy it to the Framework folder.
This is the path of my framework folder:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks
You may need to change the path depend on your system or your sdk version.

Most likely you decided to remove some of the frameworks you don't need and you deleted them but selected "Move to Trash" instead of "Remove reference".
The problem is that this framework was not included in your project's folder. It sits in a System folder when it can be used by multiple projects. So not only did you cause the current project not to compile, but also all projects on your computer.
If you have any frameworks left, you can right-click on them and check "Show in Finder". Than you can find your deleted frameworks in the trash (if it's not wiped already), and put them back in the system's Frameworks folder.
If you can't find this folder, for me it was here:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library
Of course, when you go in Applications folder and select Xcode, you have to right-click on it and click "Show Package Contents".
If you deleted your frameworks even from the trash, than I guess you could re-install Xcode...

Related

How to take framework from one project to another Swift

I want to ask how to take a framework from one project and implemented it in my project. So I am interested in using AntMedia, and I look it up in their website about how to implement it on my project, and all i get is a sample project. Right now I am having a problem at how to basically take the framework that is needed from this sample project to my project
screenshot of the sample’s project folders
In your project root, copy the Podfile from the sample and update it with your app target. I’m not sure I found the right pod, so here’s a guess of what might be in it.
target 'MyApp' do
pod 'AnyMediaToolbox', '~> 1.1'
end
Replace MyApp with your app target.
Then run a pod install inside your terminal
If you don’t have cocoapods installed, see: https://cocoapods.org
This will force you to use a workspace. See cocoapods documentation for more details
the simplest way would be to go to Project Settings, select target, choose General and under Frameworks, Libraries, and Embedded Content click on plus and in drop down menu where you will see Add Other... select Add Files and select the framework that you want to add

'Build input file cannot be found' Swift 4.2, Xcode 10.0

I am getting the following error when building in Xcode 10.0 with swift 4.2:
Moving the folders around the inspector can cause the error "Build input file cannot be found"
SWIFT 5
In Swift 5, the error came up but the identity showed no errors.
Go under build settings and select packaging.
Delete the current paths for Debug and Release and enter your new path where the info.plist is kept.
For example [APPROJECTNAME]/[THEINFOPLISTFOLDER]/info.plist
In the screenshot below, the path is API-client/Resources/info.plist
SWIFT 4
To fix it, go to the general tab and under identity reselect the info.plist that you like
Build input file cannot be found
How To fix This issue :
Go in the project-navigator, select your project
Select Build Phases tab
In Compile Sources section, check for the file(s) that Xcode is demanding of
Notice that the file(s) have the wrong path, and delete them by clicking on the minus icon
Re-add the file(s) by clicking the plus icon and search in the project.
Product > Clean Build Folder
Build
A most common error when you move Info.plist in another folder.
To fix this error you can select the Info.plist and choose Relevant to Project from file inspector.
Next step, go to Build settings and search for info.plist and fix the file path.
I got this issue after resolving the conflicts in project.pbxproj.
Step 1: Removing the "Build input files cannot be found" files from BuildPhases -> Copy Bundle resources and adding them back worked for me.
If the above Step 1 doesn't work, search for "Recovered References" folder in your project structure and remove the files that are causing this issue and repeat Step 1
For build file missing i.e. info.Plist :
Under Project navigator,
select(click) Project name and icon,
In middle pane, click target
click blue General tab on top
click / Targets
click [Choose info.plist File] button
in pop-up window, select the info.Plist file
I had the same problem with a missing view controller file that couldn't be found after cloning a project in a new folder. I deleted the view controller but the compiler continue asking for a file in a path that doesn't exist anymore.
I solved the problem as follows:
Select the project target in the Project-navigator,
Go to Build Phases tab
In Compile Sources section, check for the file that the compiler is asking for. You can filter by the name at the top right of the screen.
The deleted file is still on the list with a wrong path, delete it by clicking on the minus icon. You have to do it for all the target you may have.
In the case that you still use the file, add it on a new path by clicking the plus icon.
Clean Build Folder in the Product Menu.
It should work now :D
(Objective-C Project / Xcode Version 10.2.1 (10E1001))
This works if you get the 'Build input file cannot be found error message' and also have files that are red in the inspector:
Open your project folder in Finder
Make a copy of the affected files onto your Desktop
Delete the affected files in Xcode and then close Xcode
Re-Open Xcode and drag your copied files into your Xcode project
This worked for me. Before I got the error message I was re-organising files in the file inspector which gave me that error message and made the files I was moving around turn red. Hope this helps !!
I tried going to Compile Sources in the Build Phases tab and deleting and re-adding the selected file (and cleaning and rebuilding)but it didn't work :( Instead, this following answer worked for me if you get the 'Build input file cannot be found' error message:
Delete the affected files in Xcode (I right-clicked->Delete'd in the Navigator)
Re-add the affected file (mine was .mlmodel) and I selected "Copy items if needed" under Destination.
Cmd-shift-k to clean and then Cmd-b to build
and voila! The file was recognized and error gone!
Hope this helps!
For me this worked:
Click the app name under TARGETS
Build Settings -> Packaging -> Info.plist File
There change the file location of the Info.plist File to the new location.
DemoApp/Info.plist to DemoApp/Assets/Info.plist
I got this error when I moved my Info.plist into a folder.
When I took Info.plist out of the folder, I no longer got an error.
Change the build setting to legacy
First, open your project in XCode by double-clicking on ios/<YourApp.xcodeproj>
Then go to File > Project Settings...
Change the Build System to Legacy Build System in Per-User Project Settings:
Select general tab and under identity select the info.plist you want for your development
For me something totally different worked:
Go to Target>Build Settings>Architectures
My valid architectures before: arm64 arm64e armv7 armv7s (Defaults)
Changed it to: armv7 i386 arm64 armv7s
In my case I got this error when I renamed a ViewController name using Refactor. The view controller name occurrences were changed but the real file not.
I tried to do what #ajji said but it didn't work. So I changed the name of the real file. After that all worked like a charm
If your file(s) - that couldn't find - icon color is pale. And you right click on it and "Show in Finder" does not open Finder. It means your file name is not same as what you see in the Navigator.
to Solve it, go to where your file exist, and change its name to be same as what you see in the Navigator.
I also faced same issue while building my xcode project - "Build input file cannot be found:"
Cause: I renamed my entire project but not the build setting.
Solution: In my project's build setting--> Packaging, I updated the path of the info.plist file. Now working fine.
If all else fails:
In Xcode. Remove references of files in question from your project.
Open your project.pbxproj file as a file in Xcode. This is in .xcodeproj
Delete all lines containing the name of said files. Save.
Back in Xcode. Re-add files to your project in Xcode.
In my case the file wasn't at the right path, Xcode was expecting to find the input file at a path like /Users/Malloc/Projects/MyProject/Info.plist while in reality the file was located at a different path like /Users/Malloc/Projects/MyProject/Subfolder/Info.plist.
A quick fix to this is to simply right click on the file then select Show in Finder, then drag the file to the correct path Xcode is expecting.
I got this error when i renamed a ViewController name using "Refactor". The view controller name occurrences were changed but an old reference was somewhere still existing.
Deleting derived data & Clean build folder worked for me.
Here's how to delete Derived data:
File>Workspace settings> Click arrow & remove all folders inside Derived Data.
In my case, it was due to localization.
Here's how to fix it.
How to localise a string inside the iOS info.plist file?
Update for Projects w/ Swift Packages
How did the errors happen?
I ran into this issue when I had imported Swift Packages into my project but later cleaned DerivedData to fix an unrelated app caching issue. My existing project was not a local Swift Package but an iOS app project.
Note that we can still encounter the same issue in local Swift Package projects.
What is the reason for the errors?
Swift Packages are checked out into DerivedData and are not referenced from the ModuleCache.noindex subfolder. Thus, cleaning the app's folder in DerivedData or DerivedData itself breaks dependency resolution within Xcode for Swift Packages.
This is a misleading build error since there may be nothing wrong with the app code you've written or your dependency resolution graph. The only thing required is to refresh the dependencies.
How can I resolve the build errors?
Xcode now has nice options within the IDE itself to resolve Swift Packages. These options trigger a new checkout into DerivedData:
We can use three options, as shown in the image above depending on our use case:
Reset Package Caches: Trigger a re-install of your existing Package dependencies w/ same versions.
Resolve Package Versions: Use this option for updating Package checkouts when fixing Package Versions for cross-compatibility (in Project Settings).
Update to Latest Package Versions: Use this to update all Swift Package dependencies to the latest versions. This option may be a local breaking change if the API changes.
NOTE: Apple's documentation recommends to use Xcode for dependency resolution when working with Xcode projects excluding CLTs.
Other solutions
We can also fix the error by restarting Xcode, but I find this step breaks my workflow and is tedious.
If we are running from the command line (local Swift Package executable), we can stick with a swift build variant without jumping to Xcode at all (Source). swift build doesn't work as easily out of the box in other projects, however.
Use xcodebuild:
xcodebuild -resolvePackageDependencies
I prefer staying in Xcode for simplicity but YMMV.
Goto Project Navigator.
Click on project.
Click on Targets.
Goto Build Settings.
Search Prefix.pch.
Change the location of this file (input the updated location).
This will resolve the issue as mine.
Had the same problem with swift files. Select files that are not recognised and Delete with Remove Reference option. Right click in the folder and Add files again.
In some cases, if you Refactor your existing ViewController files or any other files using right-click -> Refactor option within the Xcode workspace then on compiling this error will come since the File name is not changed in original place but reference is updated, so in that you need to also manually change the old file to new name.
When I checked out the code first time from the Git I faced the same issue for few pod file. Updating the pod file solved my issue.
Open the project folder in the terminal window
Run 'pod update'
Clean the XCode and run.
I just had to open the project in finder and drag/drop the appropriate files in the project folder
Build input file cannot be found
How to fix this issue?
My Approach:
1.From Project Navigator ->Files ->Add Files to Lowes ->In Finder View, check to which folder this lost referenced file is moved
to and check with your team members if anyone moved it for a reason.If it occurred by mistake
then follow below steps
2.From Project navigator, directly tap on the file which is causing issue.This is the same file that XCode shows as not found in
error .So clearly this file has lost reference and we need to
restore it back
3.The Swift bird folder icon appears in light red color which is an indication of lost reference
4.Right click on it and Delete it
5.Next from Project navigator -> Files ->Add Files to Lowes -> Finder View go to the folder where this referenced file is moved to
and tap on ADD button in popup window
6.Now if you look at the Project Navigator this file swift bird icon appears in bright red , but you will also find an extra file
with the same name at the top of the Project Navigator
7.Make sure you have this file in the right folder if not move it to right folder
8.Now right click to delete the very top redundant file, here do not select " Move to Trash" option.Just select "Remove References" option
This fixed my issue.
Adjust the file path according to that provided in the Xcode Error
My issue was a missing SettingsController file.
I copied a file from projectA to projectB but forgot to tick Copy items if needed. Unbeknownst to me a couple of weeks later when I deleted projectA the SettingsController file in projectB got deleted along with it. Afterwards in projectB the error Build input file cannot be found ... path/Folder/toSomeFile was shown.
To fix it I closed Xcode, went to the main folder that it was in, opened the folder and right clicked on the blue Xcode icon with the extension .xcodeproj, then I choose Show Package Contents
From there I double clicked on the project.pbxproj icon
Once the project.pbxproj file was opened I pressed command+f and in the search field I entered the path part of the error path/Folder/toSomeFile
It took me to 1-2 lines of code that looked like this
Once I deleted those 1-2 lines, when I went back to the projectB and opened it the error was gone.
Just for a little more clarity the exact path of the error was whogotgame_42/whogotgame/Controllers/SettingsController.swift. So that is what I exactly entered in the project.pbxproj search field to get to those 1-2 lines that you see in the picture.
I got this error when I put the Info.plist file inside a folder. Then when I extracted the file to public view, the error went away.

Sparkle 10.9 Linking Error

Having an issue where when trying to add Sparkle to my project with Xcode 5 running 10.9.
I have followed the tutorial to a T, but when I get to the point where I need to copy the framework and set its copy location that is where there seems to be no way to set the copy destination in the copy bundle resources section and it just puts the framework int the /Resources folder.
I have ready through this tread thoroughly and have tried all the suggestions here.
http://www.lists.apple.com/archives/xcode-users/2012/Aug/msg00249.html
I recompiled Sparkle from the latest source and set the Installation Directory to #executable_path/../Frameworks from #loader_path/../Frameworks I get the following error.
dyld: Library not loaded: #executable_path/../Frameworks/Sparkle.framework/
when I revert and try to re add the framework I get this error.
dyld: Library not loaded: #loader_path/../Frameworks/Sparkle.framework/
If I remove the framework from the link framework from binaries altogether and just focus on the Copy Bundle Resources then I get this error.
Unknown class 'SUUpdater', using 'NSObject' instead.
The tutorial is written for Xcode 4 I know. One step says to use Copy File Location but that seems to be gone in Xcode 5 any help is appreciated.
UPDATE
I found a work around but its very messy.
Add the framework to the "Add files to build" build step.
Unlink the sparkle framework.
Open Derived Data folder and then open the App Build, then browse to Resources. Move the sparkle.framework folder to the root of the app and place the framework into a folder named Framework in the root level of the app.
Remove the framework from the "Add files to build" step.
Re-Link the framework.
Rebuild the App and voila it works.
Basically your adding the framework in a Framework folder manually and then linking it up at the end. What makes it messy is that the build changes occasionally in the Derived Data folder.
I have the same problem. And I think I have solved it.
It happens because the Sparkle.framework isn't copied to Frameworks folder(where it should be), it is copied to Resources folder when you build the application. To solved it:
Download the source of Sparkle from GIT (https://github.com/sparkle-project/Sparkle) and open the project in Xcode 5;
Go to Build Settings of every targets, then find Base SDK, change the value to macosx.
Go to Sparkle.framework's Build Settings. Find Installation Directory, Change its value from #loader_path/../Frameworks to #loader_path/../Resources under Sparkle.framework's Build Settings.
Build.
Copy Sparkle.framework under Products group in Project Navigator to your project.
Say YES and take a self highfive.
I was suffering from the same problem, then I found this:
http://www.lantean.co/sparkle-in-sandbox-mode/
The key is to add the Sparkle.framework to the Frameworks folder using the "Copy Files" section from "Build Phases".

Could not create bundle folder for versioned model?

I received project from other developer. Then i opened iOS project in Xcode and build it, i got error as below:
Volumes/Macintosh D/My workspace/HCProject/Model/HealthCareModel.xcdatamodeld:0: error:
Could not create bundle folder for versioned model at
'/Users/TomMac/Library/Developer/Xcode/DerivedData/HCProject-bdxarurbgcdbaecxaoocaroetsjt/Build/Products/Debug-iphoneos/HCProject.app/HealthCareModel.momd'
Sorry if this is a basic question,please help me out.
Thanks a lot.
I don't know what causes this but I have experienced this error before.
The simplest way to fix it for me was to delete everything in in the "/Users/TomMac/Library/Developer/Xcode/DerivedData" directory.
There will be multiple directories under here you can probably get away with just deleting the one for the particular project that failed, but I haven't tested this.
I had this same problem after a large Git merge. It turned out I had a duplicate .xcdatamodeld in my Compile Sources. I deleted one and haven't had the problem since.
In case you're not sure where to look, open your project in Xcode and click the project name to view it's properties. Go to the 'Build Phases' tab, then expand the 'Compile Sources' heading.
iOS simulator, Select "iOS Simulator"
Select "Reset Content and Settings"
I had this and I thought I'd got rid of it but it kept coming back every few builds. I now seem to have permanently got rid of it with the following steps:-
Locate the model file in Finder and take a copy of it to another (safe) location.
In Xcode, delete the file from the project (selecting move to trash).
Build the project just to make sure the project file is saved.
Close Xcode.
Locate the derived data directory in Finder and delete everything. (I actually deleted the entire DerivedData directory just to be sure).
Re-open XCode.
Copy the model file back from your safe location to your project directory location.
Drag it into the Xcode project navigator in order to put it back in the project.
Build - it should now work...
I had same issue and got it resolved by deleting content of derived data.
Below is step for the same :
1. Press cmd + comma (,) shortcut key to open preference window of Xcode.
Or Goto Xcode menu on top and select Preference
2. Select Locations tab present in last
3. You can see Derived Data under Locations section
4. Click on small arrow present next to path. This open directory where project’s derived data content is present.
5. Select your project and delete it. Also delete the module cache folder.
Note : You can even delete all content of Derived Data folder.
The content of this folder is generated again when it run. It is like cache.
6. Quit your project
7. Open your project.
8. Clean your project (cmd+shift+k)
9. Build your project. This should build your project with no issues.
I had the same problem this morning. After multiple cleans, Xcode restarts, and finally a system restart, I looked in the system log. I found this error message that corresponded to the time of the build error.
"Interface Builder Cocoa Touch Tool[89487]: BUG in libdispatch client: kevent[EVFILT_VNODE] add: "Bad file descriptor" - 0x9"
I changed permissions on Library/Developer/ folder and granted read/write privileges to "everyone", then restarted Xcode. The build was successful.
I don't know for certain that the build error was caused by a permissions problem but it's worth a try. (If you have a lot of projects in the Developer folder, the permissions change can take several minutes to complete.)
In my case it was a duplicate version of the data model. Right click on the .xcdatamodel file in your project explorer and select "Show in Finder". Check for duplicates and delete them.
In my case I had to follow two steps to get this entirely fixed:
Delete the problematic version's hidden files. Note that FILENAME.xcdatamodeld is a folder and if you browse it you'll see the different versions you have there. The one that gave me the error was still there so I first had to look for hidden files and then delete it.
Clean Xcode's DerivedData folder as suggested by others here.
Hope this helps folks.
In my case my testsFileName.xctest (in workspace > Products > testsFileName.xctest) somehow has the application target as his target membership.

is there any way to solve 'com.apple.product-type.framework' issue?

I am trying to implement cover flow effect in my application by using objectiveFlickr project, But it shows
"target specifies product type 'com.apple.product-type.framework', but there's no such product type for the 'iphonesimulator' platform"
error whenever I am going to be run the application.
Note: I have included all the framework and objectiveflickr library.
I have made necessary changes in project setting.
There is any solution available for this issues or shall I follow with another sample?
I just ran into the same problem. Something in my project got messed up as I switched back and forth between Mac targets and iOS targets, causing Xcode to become confused. Reverting the project.pbxproj file inside the xcodeproj package didn't fix the problem. Deleting my entire source tree and updating it from source control did fix the problem.
This leads me to believe that the problem lies in the other files inside the xcodeproj package. Try the following:
Close your project in Xcode.
Navigate into your xcodeproj package (either through Terminal, or in Finder by right-clicking and selecting "Show Package Contents")
Delete your pbxuser and perspectivev3 files. They will be re-created.
Open your project in Xcode.