Developing for tvOS using the Remote Layout Helper

I am developing an app for tvOS. One thing you quickly run into when testing on real world devices is the limits of screensize on several TV models. For this apple added a calibration tool in the settings.

I found I needed this info to actually make my UI layout work for customers. So I took a screenshot and created this screenimage as (PNG) to overlay it at any time in the dev-process for orientation of myself as a Remote Layout Helper).

tvOS Layout Template
Download the Overlay Image (use Save as…)

On my main controller I added & called following method which I call in - (void) viewDidAppear:(BOOL)animated:

- (void) activateCalibrationOverlay {
        if( !overlayImageView ) {
            self.overlayImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tvOS_screen_size.png"]];
            overlayImageView.alpha = 0.0;
            overlayImageView.userInteractionEnabled = NO;
            [[self appDelegate].window addSubview:overlayImageView];
            [[self appDelegate].window bringSubviewToFront:overlayImageView];
            if( !overlayPlayPauseGesture ) {
                self.overlayPlayPauseGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleRemoteTapPlayPause:)];
                overlayPlayPauseGesture.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypePlayPause]];
                [self.view addGestureRecognizer:overlayPlayPauseGesture];

This adds an overlay of the Remote Layout Helper screen image on TOP of everything else and a gesture recognizer monitoring the PLAY/PAUSE-button of the TV remote. It calls following method:

-(void)handleRemoteTapPlayPause:(UIGestureRecognizer*)tapRecognizer {
    if( overlayImageView.alpha == 0.0f ) {
        [UIView animateWithDuration:0.3 animations:^{
            overlayImageView.alpha = 0.3;
    if( overlayImageView.alpha == 0.3f ) {
        [UIView animateWithDuration:0.3 animations:^{
            overlayImageView.alpha = 0.5;
    if( overlayImageView.alpha == 0.5f ) {
        [UIView animateWithDuration:0.3 animations:^{
            overlayImageView.alpha = 0.8;
    if( overlayImageView.alpha == 0.8f ) {
        [UIView animateWithDuration:0.3 animations:^{
            overlayImageView.alpha = 1.0;
    if( overlayImageView.alpha == 1.0f ) {
        [UIView animateWithDuration:0.3 animations:^{
            overlayImageView.alpha = 0.0;

This helped me a lot doing the right things during development. I hope it helps you too. Feel free to share!

How to use it

You simply press PLAY/PAUSE again and again and the overlay will fade in at different alpha-blending-levels between 0.0 and 1.0. This allows to easily check boundaries of UI elements displayed against the screenlimits.

See following screen example:

The overlay in action on an app displayed.
The overlay in action on an app displayed.

Recognize, that you need a retained variable for the UIImageView called overlayImageView and another for the tap gesture recognizer called overlayPlayPauseGesture to be overlaid. And recognize that I use a boolean Precompiler-Flag named DEBUG_CALIBRATION_OVERLAY to switch this feature OFF in deployment.

Why do I blog this? I found it cumbersome to check against real world TV screens if my app works. So I just made sure that most of my UI is usable from within the MINIMUM SCREENSIZE frame the overlay gfx displays to me. Checking this anytime using the remote is a huge plus also on the real device. (Do not forget to disable the code on deployment!)

Making your Mac a UNIX

Since OS X El Capitain there is no root anymore by default. At least not the root you know (which allows to access all areas). So therefore we have a crippled UNIX box now. Apple wants to increase security of the system by activation of System Integrity Protection (SIP) aka rootless-mode by default on any machine.

Good news is, you can deactivate that crap to work like you would like to work, as root. I want to own my machine 100 percent not just some paths of my volume. So here is an article „How to Disable System Integrity Protection (rootless) in OS X El Capitan“.

Here is a full copy of the article (Depublication-protection)

Apple has enabled a new default security oriented featured called System Integrity Protection, often called rootless, in OS X 10.11 onward. The rootless feature is aimed at preventing Mac OS X compromise by malicious code, whether intentionally or accidentally, and essentially what SIP does is lock down specific system level locations in the file system while simultaneously preventing certain processes from attaching to system-level processes.

While the System Integrity Protection security feature is effective and the vast majority of Mac users should leave rootless enabled, some advanced Mac users may find rootless to be overly protective. Thus, if you’re in the group of advanced Mac users who do not want SIP rootless enabled on their OS X installation, we’ll show you how to turn this security feature off.

For those wondering, System Integrity Protection locks down the following system level directories in OS X:

/usr (with the exception of /usr/local subdirectory)

Accordingly, rootless may cause some apps, utilities, and scripts to not function at all, even with sudo privelege, root user enabled, or admin access.

Turning Off Rootless System Integrity Protection in OS X El Capitan 10.11 +

Again, the vast majority of Mac users should not disable rootless. Disabling rootless is aimed exclusively at advanced Mac users. Do so at your own risk, this is not specifically recommended.

  1. Reboot the Mac and hold down Command + R keys simultaneously after you hear the startup chime, this will boot OS X into Recovery Mode
  2. When the “OS X Utilities” screen appears, pull down the ‘Utilities’ menu at the top of the screen instead, and choose “Terminal”
  3. Type the following command into the terminal then hit return:
  4. csrutil disable; reboot

  5. You’ll see a message saying that System Integrity Protection has been disabled and the Mac needs to restart for changes to take effect, and the Mac will then reboot itself automatically, just let it boot up as normal

You can also issue the command by itself without the automatic reboot like so:

csrutil disable

By the way, if you’re interested in disabling rootless, you may also want to disable Gatekeeper while you’re in the command line too.

If you plan on doing something else in the Terminal or OS X Utilities screen you may want to leave off the auto-reboot command at the end, and yes, in case you were wondering, this is the same recovery mode used to reinstall OS X with Internet Recovery.

Once the Mac boots up again, System Integrity Protection will be disabled entirely in OS X.

Checking the Status of Rootless / System Integrity Protection in OS X

If you want to know the status of rootless before rebooting or without rebooting the Mac into recovery mode, just issue the following command into the Terminal:

csrutil status

You’ll either see one of two messages, enabled indi:

$ csrutil status
System Integrity Protection status: enabled.


$ csrutil status
System Integrity Protection status: disabled

If at any time you wish to change the status of rootless, another reboot into Recovery Mode is required.

How to Re-Enable Rootless System Integrity Protection in OS X

Simply reboot the Mac again into Recovery Mode as directed above, but at the command line use the following syntax instead:

csrutil enable

Just as before, a reboot of the Mac is required for changes to take effect.

As previously stated, the vast majority of Mac users should leave rootless enabled and embrace System Integrity Protection, as most OS X users have no business in the system level directories anyway. Adjusting this feature is really aimed at advanced Mac users, whether IT, sysadmins, network administrators, developers, tinkerers, security operations, and other related highly technical fields.

Why do I blog this? I just hate it if default-configs take things away from me especially if it is a machine I paid money for and things become crippled for everyday use of a power user without even asking the user if he acknowledges the changes the new OS will drop upon his machine. Macs are now officially no UNIX anymore, they are crippled & locked down consumer OS’es in rootless-mode.

Radioaktivität messen mit PocketGeiger App & Detector

Ich hab mal wieder meine PocketGeiger App ausgepackt und den (mittlerweile alten) Type 1 – Detector und mal auf dem Balkon für 20 Minuten gemessen. Ergebnis: 0.02 µSv/h

Mehr Infos dazu gibt es auf der Webseite des Projektes eine Initiative die nach Fukushima ins Leben gerufen wurde.

Bilder der Messung
Quelle: Eigene Aufnahmen auf dem Balkon

Dabei hab ich dann Lust bekommen mir eine Smart Watch zu bestellen.

Und ich bin auf eine aktualisierte Webseite des Bundesamtes für Strahlenschutz gestossen. Die haben neuerdings eine gute Webseite und eine bessere Karte des Gamma Ortsdosisleistungs Messnetzes.

In den USA gibts es vergleichbares offenbar sowohl als Freiwilligennetz als auch als staatliches Netz in Form des Nuclear Emergency Tracking Center und noch eines von der Umweltbehörde.

In Japan gibt es als Ergebnis der Bürgerinitiativen nach Fukushima die Japan Radiation Map.

This map shows ca 4,500 up-to-date radiation measurements, collected from various official sources. On roll-over information is provided for that particular location – radiation levels are visualized by the colored square’s size. Locations marked with the + sign reveal more locations on zoom-in. Logging since march 2011, the accumulated data contains now 100,000,000+ records, available for research.

Messnetzkarte des ODL Netzes
Quelle: ODL Messnetz Webseite des BfS

Ich hab dann mal eine Registrierung für deren API angefordert.

Die App

Diese App gibts übrigens hier:

App im AppStore

Why do I blog this? Angesichts der Tatsache, dass ich weder Apples Apple Watch sonderlich „smart“ finde, noch ihre Bestrebungen den Standard-Audioanschluss des iPhone zu eliminieren (der für PocketGeiger die ultimative & einzige Schnittstelle ist), wollte ich das mal festhalten wie gut das funktioniert.