Recent Updates RSS Toggle Comment Threads | Keyboard Shortcuts

  • Ullrich 16:20 on 10. July 2014 Permalink | Reply  

    Changing a XIB from iPhone to iPad 

    Sadly there’s no UI to change the type of a XIB from iPhone to iPad or vice versa. The only time you can select the type is during creation of the XIB in Xcode.
    But it’s actually not that hard. Just open the XIB in your favorite text editor and change some values in the opening <document ...> tag:

    • set `type` to `com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB`
    • set `targetRuntime` to `iOS.CocoaTouch.iPad`

    This should do the trick.

     
  • toto 15:51 on 4. June 2012 Permalink | Reply
    Tags: , , ,   

    Honey, where’s my dSYM? 

    Ever wondered how Xcode can symbolicate crash reports without you telling it the appropriate dSYM file? Xcode uses Spotlight to find the dSYMs on your system by adding a special attribute to the dSYMs Spotlight metadata. So with this CLI command you can find out where Xcode is (and isn’t) looking for the dSYM files:

    $ mdfind 'com_apple_xcode_dsym_uuids = *'  

     
  • Ullrich 17:59 on 20. March 2012 Permalink | Reply
    Tags: , ,   

    Tabs… Don't you hate tabs? 

    Tabs… Don’t you hate tabs? I mean, the idea is nice, saving bytes and stuff. But the world isn’t ready for them yet.

    Here’s our Xcode indentation settings:

    And here are two lines of shell script that will help you clean up your already messed up code base :)

    find ./ -iname '*.[hcm]' -type f -exec gsed -i 's/\t/    /g' {} \;
    find ./ -iname '*.[hcm]' -type f -exec gsed -i '/^[ \t]*$/! { s/[ \t]*$//g }' {} \;

    What they’ll do is, 1st of all replacing all existing tabs by four spaces. The second command takes care of trailing whitespace (but not in lines that only contain whitespace), because we also hate that! :-D

    All that require the GNU version of sed. OSX ships with the BSD version, so you need to install it via

    brew install gnu-sed
     
  • Ullrich 19:49 on 13. March 2012 Permalink | Reply
    Tags: ,   

    Wrapping the tableView in a custom view in UITableViewController 

    Ever wanted to add a different view north of your table view without making it the tableHeaderView?

    Here’s what you need:

    @property (nonatomic, retain) UITableView *internalTableView;
    
    - (void)loadView;
    {
        [super loadView];
        self.internalTableView = self.tableView;
        self.view = [[[UIView alloc] initWithFrame:self.view.frame] autorelease];
        [self.view addSubview:self.tableView];
        self.tableView.frame = self.view.bounds;
    }
    
    - (void)viewDidUnload;
    {
        self.internalTableView = nil;
        [super viewDidUnload];
    }
    
    - (void)dealloc;
    {
        internalTableView = nil;
        [super dealloc];
    }
    
    // here's the finesse
    - (UITableView *)tableView;
    {
        if (!self.internalTableView) {
            return [super tableView];
        }
        return self.internalTableView;
    }
     
    • Jörg 18:36 on 16. July 2012 Permalink

      I’ve done this a few times, too but since came to the conclusion that it’s not a good idea to fiddle with UITableViewController. The alternative really is to use
      UIViewController
      and add a property
      @property (weak, nonatomic) UITableView * tableView;
      Then you build loadView like you did and assign the container view to self.view and the table view to self.tableView and all of a sudden you have all flexibility to put your table view wherever you like.

      That way you are safe against implementation details in the UITableViewController which really assumes it owns the whole space of a container view and sometimes resizes the TableView. It’s especially an issue if you want to throw the whole thing into a NavigationController or if you have views to the left and right of the TableView. Except for that it’s really the same thing, everything you want to do to a TableViewController will work with this fake one, too.

    • Jörg 18:38 on 16. July 2012 Permalink

      OK, what’s the syntax of this blog? The “UIViewController” thing was supposed to have protocols for UITableViewDataSource, UITableViewDelegate and UIScrollViewDelegat but the site did eat the stuff in between the brackets. Is this BBCode or something?

    • Ullrich 18:55 on 16. July 2012 Permalink

      @Jörg: Comments are not yet optimized for code, sorry.
      About implementing the UITableViewController functionality yourself: We went down that road & ended up in problems with keyboard support & contentInset in table views. Keeping as much functionality of the original UITableViewController never caused us any trouble.

    • Jörg 19:24 on 16. July 2012 Permalink

      Surprises me, I’m using both, too, no trouble. There’s also nothing really you need to implement yourself, only the delegate protocols but that’s what you have to do for a TableView anyway.
      The important part is to also support the UIScrollViewDelegate protocol for keyboards and insets but that’s also the same with UITableViewController, I believe (not sure).
      I don’t remember when exactly it happens but there are cases where with a TableViewController the TableView will be resized to fill the whole container again and hide/clutter your top view. Probablyrelated to rotations or Navigation controllers.

  • Ullrich 14:23 on 9. March 2012 Permalink | Reply
    Tags: git, ,   

    This is something I can never remember so… 

    This is something I can never remember, so why not create a small post about it.

    git tag -d v1.2.3
    git push origin :refs/tags/v1.2.3

    So what’s this… The first line is quite obviously deleting the tag from the local working tree. The second line deletes the tag from origin in the same way as you would delete a branch on origin, by pushing noting to it’s destination.

    To be complete here’s how you would delete a remote branch from origin:

    git push origin :my-branch
     
  • Ullrich 12:12 on 1. March 2012 Permalink | Reply
    Tags: , ,   

    Missing your opendiff? 

    Since I Xcode 4.3 the opendiff terminal command didn’t work any longer.

    Here’s how I fixed it:

    sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer
     
  • Ullrich 13:05 on 15. February 2012 Permalink | Reply
    Tags: , , ,   

    AppStore validation error on app icons (-19007) 

    
    

    Since upgrading to OS X 10.7.3 you see this Xcode build warning?

    Icon specified in the Info.plist not found under the top level app wrapper: Icon-72.png (-19007)
    iPad: Icon.png: icon dimensions (57 x 57) don't meet the size requirements. The icon file must be 72x72 pixels, in .png format (-19014)

    This is going to turn into an validation error as soon as you try to upload a new build to the AppStore™.

    Here’s the fix:

    Install a new version of the Application Loader. The download link is hard to find (hard to google), so here’s one for version 2.5.1 (most current when writing this article).

    The most current version can be found under “Manage your applications” in iTunesConnect.

     
  • toto 18:50 on 1. February 2012 Permalink | Reply
    Tags: , ,   

    Debug broken code highlighting in Xcode 4 

    If you use Xcode 4 a lot this might have happened to you, too: Coloring and code completion fail and do not come back. Which makes working with Xcode almost impossible

    This happens when Xcode’s indexing process fails for some reason. This can be a header file is missing to code highlighting (which can be different from the compiler in some cases) or in some cases a bad #define. The problem is that it fails silently so you cannot fix it.

    After having this problem with a big project I stumbled onto the magic hint on Stack Overflow.  After you quit Xcode enter this into a shell:

    defaults write com.apple.dt.Xcode IDEIndexingClangInvocationLogLevel 3

    After this you should open the project and see messages like this:

    Xcode: IDEIndexingClangInvocation: Failed to save PCH file: /Users/user/Library/Developer/Xcode/DerivedData/Project-drsrrgaenperjadmqslqfxyqcqyt/Index/PrecompiledHeaders/Some-Prefix-cgepzuvkwimbsvcmqrbbpeoyhdpz_ast/Some-Prefix.pch.pth

    Looking through these messages will show you what goes on and might help you finding the problem.

    For me it was just copying header files from a framework on the place the Clang parser was looking for them.

     
  • Ullrich 13:45 on 7. December 2011 Permalink | Reply
    Tags: , , ,   

    Remote Web Inspector Pt. 2 

    It gets even better, because this also works in Mobile Safari on the iOS 5 Simulator!

    Here’s a little script you can run, that enables the remote Web Inspector via gdb (via @atnan).

    Here’s to all the mobile devs!

     
  • Ullrich 13:07 on 7. December 2011 Permalink | Reply
    Tags: , ,   

    Remote Web Inspector 

    We recently stumbled across a blog post mentioning a way to enable a remote interface to a web inspector that is hidden inside the WebKit on iOS 5.

    Here’s how it’s done. In your Application Delegate add the following code:

    + (void)initialize;
    {
        [NSClassFromString(@"WebView") performSelector:@selector(_enableRemoteInspector)];
    }

    With this you can direct your browser to http://localhost:9999 to open the web inspector.

    Have fun!

    
    	
     
    • Ullrich 13:51 on 7. December 2011 Permalink

      Remember that this will influence you’re App Store review experience ;)

c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel