1

I'm writing a custom build script that processes .storyboard files. Sometimes a storyboard does not fulfill a requirement to be processed and thus I want to output an error message.

There error messages are shown correctly when my script writes this output:

 warning: View controller has no storyboardIdentifier (class "ShoppingCartViewController", title "ShoppingCartViewController")

But of course they lack context when shown in the Issue Navigator:

Issue Navigator with warning, but without file name context

If I prefix the error output of my build script with file name and file number like this, I get more context:

 /Users/l_schimmel/full/path/to/file.storyboard:1: warning: view controller has no storyboardIdentifier (class "", title "ItemSelectionViewController@04_shop_articles")

Issue Navigator with contextual warning

If I view my storyboard as souce, I even get inline annotaions (let's forget about the fact that line 1 is not the most appropriate line number here):

XML source code with annotation in line 1

But of course, linking storyboard erros to a specific line in the source XML is rather useless. It would be nicer to link to the specific node in the graphical storyboard view in the Interface Builder. Apples own tools can do this. I found out they output error messages like this:

/* com.apple.ibtool.document.warnings */
/Users/l_schimmel/full/path/to/file.storyboard:uKR-Dw-A3n: warning: Plain Style unsupported in a Navigation Item [9]

When I click the warning in the Issue Navigator, the storyboard opens up in the Interface Builder and the item with the id uKR-Dw-A3n is pre-selected.

However, when I use such id instead of a line number, the warning will completely disappear from the Issue Navigator:

/* com.apple.ibtool.document.warnings */
/Users/l_schimmel/full/path/to/file.storyboard:iSw-vh-ZUi: warning: view controller has no storyboardIdentifier (class "ShoppingCartViewController", title "ShoppingCartViewController")

'Empty issue navigator

What am I missing?

Community
  • 1
  • 1
Lena Schimmel
  • 7,203
  • 5
  • 43
  • 58
  • Hey, have you got any solution? I want to display custom error message in file editor area. I would be grate help for me.... Thanks – Punita Jun 18 '15 at 06:56
  • @Punita: I didn't find any solution beyond what's already in the question. Can you explain what excactly you are trying to do? Is it about messages in the code or in the graphical storyboard editor? – Lena Schimmel Jun 18 '15 at 10:26
  • I am creating xcode plugin, which will display custom warning message with warning icon near line-number in xcode editor area. do you have any idea of display Tool-tip text like same as warning message? Please let me know. – Punita Jun 19 '15 at 06:07
  • I only know how to do this from within a build script / tool: if you output a line like "$PATH:$LINENUMBER: warning: $MESSAGE" it will show up at the corresponding line in the editor area. (Note the presence and absence of spaces at different places). If your plugin does not integrate with the build process in that way, then I have no idea. – Lena Schimmel Jun 19 '15 at 11:08
  • Okay np I will try. thank you so much for your time and reply – Punita Jun 19 '15 at 11:13
  • I have tried your suggestion and it work successfully. how to run build script at run time??? e.g. I want to display warning message whenever user click on file name in xcode IDE. – Punita Jun 22 '15 at 13:02

0 Answers0