aidansteele / MagicKit

MagicKit is an Objective-C file identification framework based on libmagic.
Other
193 stars 50 forks source link

How to import MagicKit in an iOS project? #5

Open mdestagnol opened 11 years ago

mdestagnol commented 11 years ago

I tried for hours now but can't figure out. Do you think you could add an Installation section in the README? Many thx

jessecurry commented 11 years ago

Might be a little late for to original question, but there are a couple ways.

One would be to build the static library, then import the static library, the MagicKit headers, and the magic.mgc file.

Another would be to add the MagicKit project to your iOS project, make sure that the MagicKit-iOS is a target dependency, link against libMagicKit-iOS, and import a copy of magic.mgc into your project.

ronakvora commented 9 years ago

mdestagnol, you need to add -D_FORTIFY_SOURCE=0 to Other C Flags in Build Settings. This will let you compile!

@jessecurry where do we import the magic.mgc file? Everything works but when I call a MagicKit function, it says it can't find the magic database. I tried putting it under Resources but no luck.

ronakvora commented 9 years ago

Nevermind, I got it. For future readers:

http://stackoverflow.com/questions/6263289/accesing-a-file-using-nsbundle-mainbundle-pathforresource-oftypeindirectory

Add it to the Copy Bundle Resources in Build Phases :)