I run my app on Simulator in XCode and it works fine but when I try to ru开发者_Go百科n it on the device it doesn't work. I figured out that it doesn't open some files. (I don't know if it gets wrong path or maybe the files aren't copied)
Before I open my files I get their path like that:
const char* Pobierz_sciezke(const char *tytul_c)
{
NSString *tytul = [NSString stringWithUTF8String: tytul_c];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *myPathDocs = [documentsDirectory stringByAppendingPathComponent:tytul];
if (![[NSFileManager defaultManager] fileExistsAtPath:myPathDocs])
{
NSString *myPathInfo = [[NSBundle mainBundle] pathForResource:@"tex_dane" ofType:@"txt"];
NSFileManager *fileManager = [NSFileManager defaultManager];
}
NSLog(@"%@",myPathDocs);
const char *sciezka;
sciezka = [myPathDocs UTF8String];
return sciezka;
}
Is this code ok?
Maybe I should add my resources in a different way? Change project settings?
精彩评论