Tag Archives: coding

Blocks, closures on stack and heap

Blocks on the Stack While reading through Apple’s open source code (headers) I came across queue.h and stumbled over the following warning: /*! * […] * * dispatch_block_t block; * * if (x) { * block = ^{ printf("true\n"); }; … Continue reading

Posted in computer | Tagged , , , , , , , , | Leave a comment

Property: strong and copy

Property: strong and copy // // main.m // strong_retain_copy // // Created by Christopher Loessl on 25/02/14. // Copyright (c) 2014 Christopher Loessl. All rights reserved. // #import <Foundation/Foundation.h> @interface Person : NSObject @property (strong, nonatomic) NSString *name; @property (copy, … Continue reading

Posted in computer | Tagged , , , , , | Leave a comment

Multiple Xcode targets and tests

Multiple Xcode targets Go to targets -> Select target -> Duplicate (I duplicated a target which name was “tests”) Rename the target to whatever you want (I use “Tooth” here) Go to “Manage Schemes” and delete the scheme with the … Continue reading

Posted in computer | Tagged , , , , , , , | Leave a comment

iOS localization with iLocalize

I did it once and now I needed to do it again – and of course I forgot how to do it, so this time I’ll write it down how localisation of an iOS project works. I don’t use nib … Continue reading

Posted in computer | Tagged , , , , , , | Leave a comment

git diff and objective c

When you are writing Objective-C code and using git you probably realised that the `git diff` is not mentioning the function name in which the change occurred. This can easily be changed by just running following cmd inside your git … Continue reading

Posted in computer | Tagged , , , , | Leave a comment

Send broadcast messages to android

Faking a received SMS: adb shell am broadcast -a android.provider.Telephony.SMS_RECEIVED

Posted in computer | Tagged , , , | Leave a comment

common.h

So I got sick with NSLog and wrote myself a simple wrapper which you can find here. The Syntax is the same but the printout is why nicer to read, it looks like this: 2013-09-02 17:00:49.543 AppName[4841:a0b] (FilterAppDelegate.m:15 -[FilterAppDelegate application:didFinishLaunchingWithOptions:]) … Continue reading

Posted in computer | Tagged , , | Leave a comment

Automatically increment build number (CFBundleVersion)

David wrote this nice little helper that automatically increments the build version every time. #!/bin/bash buildNumber=$(/usr/libexec/PlistBuddy -c “Print CFBundleVersion” “$INFOPLIST_FILE”) buildNumber=$(echo $buildNumber | sed ‘s/0*//’) buildNumber=$(($buildNumber + 1)) buildNumber=$(printf “%04d” $buildNumber) /usr/libexec/PlistBuddy -c “Set :CFBundleVersion $buildNumber” “$INFOPLIST_FILE” In Xcode just … Continue reading

Posted in computer | Tagged , , , , , , , | Leave a comment

ActivityManager | isUserAMonkey()

public static boolean isUserAMonkey Added in API level 8 Returns “true” if the user interface is currently being messed with by a monkey. Update: There are more: public void fyiWillBeAdvancedByHostKThx () Added in API level 11 Called by an AppWidgetHost … Continue reading

Posted in computer | Tagged , , , | Leave a comment

git

I just figured out, that I want to make sure, that I never committed a key to my repository before publishing it, so what’s the easiest way to grep throw all commits in a git repository: $ git grep USERNAME … Continue reading

Posted in computer | Tagged , , | Leave a comment