byrons, Author at Byron Salau - Page 2 of 2

How to fix “this class is not key value coding-compliant for the key”

Posted by | objective-c | No Comments

If you ever come across this error:


*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key ...'

It is likely you have either renamed an IBOutlet property or removed a nib (.xib) file associated with your class.

If you removed the nib and decided to go nibless you can fix this error by simply selecting “Reset Content and Settings” from the ios simulator menu or “delete” the app from your device. You may also have to perform a “Clean” in xcode (Product > Clean).

Otherwise, If you still have your nib and renamed an IBOutlet property then simply open the nib file and reconnect your IBOutlet with its corresponding UI control. You may also need to disconnect the old one. It should appear grayed out.

Repair -weak_library /usr/lib/libSystem.B.dylib for Urban Airship

Posted by | objective-c | No Comments

This week I was implementing Urban Airship into my application when i came across this weird behaviour. I followed the documentation and implemented all the steps only to find the application would crash with “EXEC_BAD_ACCESS” before if even finished loading. A little confused I tried to NSZombie the root of the cause however instruments wouldn’t attach to the target and I had to force quite instruments just to regain control of my computer.

Going back on my steps I narrowed the issue down to setting the following flag in the targets “Other Linker Flags”

-weak_library /usr/lib/libSystem.B.dylib

You will most likely have that reference because your are either using Urban Airship or Flurry analytics in your projects.

Apparently this library is not available on the ios simulator above SDK version 4.2. So, If you are experiencing problems with this I suggest you try using the following flag instead

-weak-lSystem

Tips for making jQuery selectors faster

Posted by | javascript | No Comments

Unfortunately jQuery selectors aren’t stupid proof. Its all too easy to chuck a long string of junk into your selector and not have a single problem. You might have the attitude of, “meh it works” and not give it any more thought of if there is a better way.

The upside of actually paying attention to your jQuery selectors is: the faster they execute the faster your page is going to render and operate. This is especially true for browsers with slower javascript engines like Internet Explorer and phones/devices with lower memory.

Read More

How to recursively copy files using MSBuild Copy Task

Posted by | c# | No Comments

Today I was faced with the problem of copying a set of files into a new location using a MSBuild task. Previously we got the job done using an xcopy command post build, while this was okay it’s not ideal for front end developers.

The problem is front end developers are constantly tweaking files usually followed by refreshing the website over and over. In my case today we where building from a kernal, so the task of building the dll’s and waiting for iis to recompile is all very time consuming.

This was my solution to copy css and javascript files recursively into a new location using the MSBuild Copy Task.


<ItemGroup>
	<CompiledCss Include=\"..\\css\\**\\*.css\"/>
	<CompiledJavascript Include=\"..\\javascript\\**\\*.js\"/>
</ItemGroup>

<Target Name=\"CopyFiles\">
	<Copy
		SourceFiles=\"@(CompiledCss)\"
		DestinationFolder=\"..\\..\\website\\css\\%(RecursiveDir)\"
	/>
	
	<Copy
		SourceFiles=\"@(CompiledJavascript)\"
		DestinationFolder=\"..\\..\\website\\javascript\\%(RecursiveDir)\"
	/>
</Target>

The double stars (**) is used to set the task as a recursive copy, it will also maintain any folder structure you have.

Using this method enables you to quickly build the CSS and Javascript files without changing any dll’s. This means the website refresh is instant and you will be much more productive.