Objective C runtime library in iOS

In Cocoa, creating classes to encapsulate everything Cocoa relies heavily on calls into the objective c runtime library at “/usr/lib/libobjc.A.dylib”. When trying to use that lib in iOS, it hard crashes. Does anyone know how I can access the objective c runtime library in iOS?

As a side note - is there a way to view crash logs from the iOS simulator or iOS in general?

in the simulator look at the Debug > Open System Log item

Seems other have encountered that before : http://stackoverflow.com/questions/8112035/libobjc-a-dylib-compile-error-on-ios-4-3

Seems the search in the iOS dev library is broken, so I could not locate libobjc there.

Yeah I saw that exact conversation when I was doing some googling of the problem. Unfortunately it doesn’t have any info relevant to this as far as I could tell.

What’s your declare look like?

The best way would be to find out with the iOS dev library reference. I can’t believe this is broken.


soft declare function objc_allocateClassPair lib "/usr/lib/libobjc.A.dylib" (superclass as Ptr, name as CString, extraBytes as Integer) as Ptr soft declare sub objc_registerClassPair lib "/usr/lib/libobjc.A.dylib" (cls as Ptr) soft declare function class_addMethod lib "/usr/lib/libobjc.A.dylib" (cls as Ptr, name as Ptr, imp as Ptr, types as CString) as Boolean

I found a few things googling

libobjc  site:developer.apple.com/library/ios

It looks like soft declares are broken on the simulator (and perhaps the device). Please file a bug report.

I’d also recommend switching to use non-soft declares in cases where you know the function will be available at runtime.

Excellent. Thanks. I will file a bug report soon unless someone beats me to it.