Getting “User interaction is not allowed” error in your build task? If yes, solution is very simple. Just login your build user (usually “jenkins”) via the GUI (which means VNC) and open Keychain Access. Select your signing private key, right-click, choose Get Info, change to the Access Control tab and select the “Allow all applications to access this item”.
Now error should be gone.

Sooner or later you will face with changing back button title in navigation bar. This may seem simple. But after few hours trying to change this damn text, you will change your mind. I have no idea why this is designed this way, but answer for question “How can I change back button text in current view controller?” is – you cannot. So how to do it without overriding whole navigation bar? All you have to do is change title of backBarButtonItem in PREVIOUS view controller. But there is another catch – you can’t just do :

self.navigationItem.backBarButtonItem.title = @"" 

becouse this won’t work. Instead of this, you need to:

UIBarButtonItem* backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationItem.backBarButtonItem = backBarButtonItem;

And keep in mind – this has to be done in PREVIOUS controller, not the one you need to change your back button text. The alternative is to give up on native back button and create your own with:

UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"My back button" style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationItem.hidesBackButton = YES;
self.navigationItem.leftBarButtonItem = backButton;

This can seem trivial, but I saw lot of people complaining about not working tint color when using UIImage. Here is the proper way:

UIImageView *imageView = [[UIImageView alloc] init];
UIImage *image = [UIImage imageNamed:@"my_image"];
imageView.image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[imageView setTintColor:[UIColor redColor]];

The point is – “imageWithRenderingMode” method just returns new image with rendering mode set, it does not changes anything in image object itself.

If you are new to iOS programming this may take you a while to found out. But I’m here to help so will give you ready to use solution. So you have two (or more) view controllers (UIViewController) and one of them should show list of items, second one details of selected item? Well, solution depends on the way you are doing transitions betweeen controllers.

Continue reading

Lot of people have same problem – they received developer kit, connected via USB-C to Mac and iTunes shows nothing. I saw lot of solutions, but only one of them is working. So what to do to make your brand new Apple TV visible in iTunes? Answer is… nothing. You can’t. It won’t yet recognize it. If you need to get UDID, just use XCode Devices (from XCode 7.1, not 7.0!) and you can get it easily. So far iTunes doesn’t seems to support new Apple TV yet.

When you need to quickly display NSArray what you do? Yes, NSLog(@”%@”, myarray), me too. But when you will do this on array fetched from CoreData what will you get? Well, something like:

So what is that? What is surprise – this is not an error, it is normal when you are fetching something, becouse of lazy loading – objects are not fully loaded until you need them. So what can we do? Just a little more work:

This way you will get your array properly displayed, the other way is to [request setReturnsObjectsAsFaults:NO] on your NSFetchRequest but if you will forget to remove it after testing your arrays will always be fully populated which can lead to memory warnings.

Seen that error today, it happened after I upgraded XCode to 7.0 – in lower version everything was ok (well, it was not but just I did not saw it). So what does it means? Somewhere in your code you are changing something that affects UI – this can be button or label text or just table data, doesn’t matters. What is important – you should not do it in background. Solution is simple just use:

Changing any UI stuff in background can work or cannot. You never know, it is always a good practice to put this on main thread.