Search code examples
xcodeios4xcode4ibtool

doesNotRecognizeSelector exception while running ibtool on a xib resource files


Anyone knows why I get this crash from the ibtool?

ibtool --generate-strings-file "my.strings" "myViewController.xib"

Result:

2011-04-18 17:49:41.848 ibtoold[32147:107] -[NSCFString count]: unrecognized selector sent to instance 0x20055f7e0
<?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>Exception while running ibtool: -[NSCFString count]:     unrecognized selector sent to instance 0x20055f7e0
Backtrace:
  0  0x00007fff81780796 __exceptionPreprocess (in CoreFoundation)
  1  0x00007fff8300e0f3 objc_exception_throw (in libobjc.A.dylib)
  2  0x00007fff817da110 +[NSObject(NSObject) doesNotRecognizeSelector:] (in CoreFoundation)
  3  0x00007fff8175291f ___forwarding___ (in CoreFoundation)
  4  0x00007fff8174ea68 _CF_forwarding_prep_0 (in CoreFoundation)
  5  0x00000001000ea974 IBAppendStringsfileEntries (in IDEInterfaceBuilderKit)
  6  0x00000001000eac4b IBGenerateStringsfile (in IDEInterfaceBuilderKit)

Solution

  • This seems to be a bug in the new Version of ibtool. In my case it was a UISearchBar in which the placeholder text was set.

    Even removing the placeholder text does not resolve the issue, since Interface Builder leaves droppings in the .xib. Removing the search bar completely and adding a fresh one without setting the placeholder text fixes the exception.

    One workaround for this problem: use $DEVELOPER_DIR/usr/bin/ibtool3 which seems to be the old version of the tool.