xcode - Refer to files under Resources folder of a framework -
i integrating framework project. however, having troubles in referring files under resources
folder.
the code should be:
nsstring *frameworkpath = @"someframework.framework/resources/abc"; nsstring *filepath = [[nsbundle mainbundle] pathforresource:frameworkpath oftype:@"json"]; // nil !!! // load file nsdata object called jsondata nserror *error = nil; nsdata *jsondata = [nsdata datawithcontentsoffile:filepath options:nsdatareadingmappedifsafe error:&error]; // crashed here !!!
since cannot refer abc.json
under someframework.framework/resources
folder, filepath
nil
, leading app crashed @ jsondata
:
*** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '*** -[_nsplaceholderdata initwithcontentsoffile:options:error:]: nil file argument' *** first throw call stack: (0x2435c49f 0x31b52c8b 0x2435c3e5 0x24fc3f3b 0x24fc3ecd 0x345fd 0x323e9 0x32021 0x27307 0x20d99 0x1a19b 0x24036369 0x240363b9 0x240364fd 0x240342b7 0x24030675 0x2403b357 0x1ae9db 0x1ae9c7 0x1b6e29 0x1b12c9 0x1b221f 0x243223b1 0x24320ab1 0x2426e3c1 0x2426e1d3 0x2b66c0a9 0x2787dfa1 0x22d79 0x320d2aaf) libc++abi.dylib: terminating uncaught exception of type nsexception
in finder
, checked someframework.framework
. does have resources
folder, under sadly cannot find out how refer files.
is there actions missed in order refer files under resources
folder of someframework.framework
?
please show me how.
(i developing in xcode 6)
thanks, everyone
thank link ios static framework resources inside, found out how fix problem: going build phase
/copy bundle resources
, add someframework.framework.
as expected, after adding someframework.framework
, app can refer resources under someframework.framework
, works beautifully.
regards,
Comments
Post a Comment