问题
Is there a way to convert NIB
files to XIB
files so that I can open them in Xcode 4? Once I have edited them, is there a way to convert them back to NIB
?
回答1:
Once a nib file has been flattened and stripped (which is now a default part of the compilation process), then it is challenging to open it in IB. You may want to look at NibUnlocker, which is useful in converting a flattened nib file into xib, but it is not a lossless round-trip and it may not even work in all cases. As with most decompilers, much of the useful editing information has already been thrown away.
For more information on xib compilation, see ibtool(1).
回答2:
I have made a simple application to accomplish this task, here is the link: NibToXibConverter
Here is the code: NibToXibConverter@github
Hope it helps :-)
回答3:
It's impossible to open a compiled "nib" file. I have tried to achieve that on a compiled nib file from an "ipa" downloaded from the AppStore with the tool "ibtool". Below is a result:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.ibtool.errors</key>
<array>
<dict>
<key>description</key>
<string>Interface Builder cannot open compiled nibs.</string>
<key>recovery-suggestion</key>
<string>Try opening the source document instead of the compiled nib.</string>
</dict>
</array>
</dict>
</plist>
This is a result of NibUnlocker App:
The document “MainViewController.nib” could not be opened. The NIB file “file://localhost/Users/xxx/MainViewController.nib” does not contain a keyedobjects.nib file. Perhaps it is of a later format that NibUnlocker does not yet recognize.
来源:https://stackoverflow.com/questions/10064108/convert-nib-files-to-xib-files