Compiler error: “initializer element is not a compile-time constant”

When you define a variable outside the scope of a function, that variable’s value is actually written into your executable file. This means you can only use a constant value. Since you don’t know everything about the runtime environment at compile time (which classes are available, what is their structure, etc.), you cannot create objective … Read more

printf(“%%%s”,”hello”)

The compiler simply interprets this as calling printf with two strings as arguments (but see Zack’s comment). This happens at compile time (i.e. the compiler does this): The strings (“%%%s” and “hello”) are copied directly into the executable, the compiler leaves them as-is. This happens at runtime (i.e. the C standard library does this when the app is running): … Read more

How to use iMonkey in an iOS app

iMonkey looks like an interesting way of embedding a JS runtime in an iOS app, but I can’t find any examples on how to actually run some JS code. I can build/link the lib, include the jsapi.h header (from the src directory), but it trips over various linker errors (‘undefined symbol for architecture…’) when I try … Read more

Difference between nil, NIL and, null in Objective-C

nil is the literal null value for Objective-C objects, corresponding to the abstract type id or any Objective-C type declared via @interface. For instance: Nil is the literal null value for Objective-C classes, corresponding to the type Class. Since most code doesn’t need variables to reference classes, its use is not common. One example is: NULL is the literal null value for … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)