如何从应用程序包外部加载文件?

时间:2010-12-25 08:36:06

标签: macos load cocos2d-iphone

(我正在使用cocos2d,但我认为这并不重要)

让我们说道路是:/Users//1.tmx // myname被我的名字取代

我正在尝试加载tmx文件:

tileMap = [CCTMXTiledMap tiledMapWithTMXFile:@"/Users/<myname>/1.tmx"];

但是我收到了一个错误:

deallocing <CCTMXMapInfo: 0x100290480>
deallocing <CCTMXTilesetInfo: 0x10028fb50>

我做了一个:

(gdb) bt
#0  0x00007fff82b322da in mach_msg_trap ()
#1  0x00007fff82b3294d in mach_msg ()
#2  0x00007fff89047932 in __CFRunLoopRun ()
#3  0x00007fff89046dbf in CFRunLoopRunSpecific ()
#4  0x00007fff812df91a in RunCurrentEventLoopInMode ()
#5  0x00007fff812df71f in ReceiveNextEventCommon ()
#6  0x00007fff812df5d8 in BlockUntilNextEventMatchingListInMode ()
#7  0x00007fff87e8fe64 in _DPSNextEvent ()
#8  0x00007fff87e8f7a9 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#9  0x00007fff87e5548b in -[NSApplication run] ()
#10 0x00007fff87e4e1a8 in NSApplicationMain ()
#11 0x0000000100002360 in main (argc=1, argv=0x7fff5fbff6f8) at /myproject/Classes/main.m:16
(gdb)

1 个答案:

答案 0 :(得分:0)

在iOS中,您无法访问应用外的任何文件。因此,尝试访问文件/Users//1.tmx会给你错误。