How to get file path in iPhone app

后端 未结 5 2238
独厮守ぢ
独厮守ぢ 2020-12-12 22:22

I have a problem accessing my files in my app.

I am currently using

//Directly from TileMap example from WWDC2010
NSString *tileDirectory = [[[NSBun         


        
5条回答
  •  北海茫月
    2020-12-12 22:58

    If your tiles are not in your bundle, either copied from the bundle or downloaded from the internet you can get the directory like this

    NSString *documentdir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
    NSString *tileDirectory = [documentdir stringByAppendingPathComponent:@"xxxx/Tiles"];
    NSLog(@"Tile Directory: %@", tileDirectory);
    

提交回复
热议问题