How to add deleted frameworks again

2020-02-05 07:47发布

问题:

I accidentally deleted AVFoundation , CoreFoundation , Foundation and UIKit.framework , CoreGraphics.frameworks frameworks form my Xcode. Is there any ways to restore them.. or i will have to re-install the Xcode again.

回答1:

If you haven't emptied the trash yet, close Xcode and open the Trash in Finder. Find the framework folder you accidentally deleted. In Finder, open another window with the path /System/Library/Frameworks (beginning on Macintosh HD if you want to open the folder manually), and drag-copy the framework from the Trash to the Frameworks folder. Reopen Xcode and you should be able to add the framework again in the target settings.



回答2:

If you haven't emptied your trash, you'll find your frameworks there. In case the deleted frameworks are iOS frameworks just copy/move them back from your trash to your XCode frameworks directory, which would be the following for most installations to date (XCode 5 + iOS 7):

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/

For OS X frameworks the path posted by 555nick may be the right one (haven't tested that though): /System/Library/Frameworks

Btw: You can fast-open such paths by opening the finder and using the Shift+Cmd+G shortcut.



回答3:

Above method will not work if your xCode's location is different. For that Open xCode click top project blue icon. Click Target-> build Phases -> Link Binary With Libraries

Now right or control click any existing framework and Show in Finder.

This way you will get all existing framework's default location. Now go to that location and add your deleted framework again.

Restart xcode then you will see your deleted framework as it was before.



回答4:

Ok. So if you have deleted the frameworks from finder as well as from trash here is a solution. If you have another version of xcode installed in your mac then open that. In any of your projects try to add any of the frameworks that you have recently deleted. right click on it and go to the finder window and copy it.

Now go to the xcode from where the frameworks have been deleted, go to the fnder window in the same process above and paste the framework yoy just copied. i had the same problem as yours and it helped me.