Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The file InfoPlist.strings couldn't be opened

Tags:

xcode

iphone

Can anyone please help me? What should i do to fix the error "The file InfoPlist.strings couldn't be opened because there's no such file"? It's appeared after i've updated my project from SVN. Actually THERE IS InfoPlist.strings in my project, i have no idea why Xcode doesn't see it.

Maybe the following information will help you to understand what's going on: when i expand InfoPlist.strings by clicking on the triangle next to it, then it shows: InfoPlist.strings (English), InfoPlist.strings(German), InfoPlist.strings(French). The English is black, but French and German are red, so i suppose it is probable something wrong with them and it might be the cause of the error. Also, i've got Localizable.strings, which behaves in similar way. It has (when expanded) Localizable.strings (English), Localizable.strings(German), Localizable.strings(French) and just as in InfoPlist.strings English is black whereas French and German are red.

When i look inside my project's folder - there is the following there: a folder named en.lproj contains Localizable.strings and InfoPlist.strings. Folders named fr.lproj and de.lproj contains the same - Localizable.strings and InfoPlist.strings. Seems like i've described everything. Please explain me what to do. I work with Xcode 4.2

like image 931
Andrey Chernukha Avatar asked Feb 20 '12 10:02

Andrey Chernukha


2 Answers

I have just managed to fix this problem !

My second Strings.plist file (FR) had an absolute path. The drop down menu for path type (absolute, relative) was greyed out in the info pane of xcode so I could not change it to a relative path.

The solution is to change it manually in the project.pbxproj file:

If you open the file to view the source, and search for "plist", find the following line:

/* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = /Users/[YOUR-USER]/[PATH_TO_PROJECT]/fr.lproj/InfoPlist.strings; sourceTree = "<absolute>"; };

Notice that the path attribute is the full path to the file, and that the sourceTree attribute is set to <absolute>.

Now change the path so that it's relative:

/Users/[YOUR-USER]/[PATH_TO_PROJECT]/fr.lproj/InfoPlist.strings

should become

fr.lproj/InfoPlist.strings

Also change the sourceTree value from <absolute> to <group>

The line should now look like this:

/* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/InfoPlist.strings; sourceTree = "<group>"; };

Repeat these steps for all your localizations that are stuck with absolute paths.

Save the file, commit the changes, and voilà! no more no such file problem :)

like image 69
Mutix Avatar answered Nov 04 '22 17:11

Mutix


info.plist source code: like: .... {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; ....

check "path" is a absolute path?

like image 44
kai Avatar answered Nov 04 '22 17:11

kai