objective c - Copy file to App Document folder automatically -
i want copy set of files project resource folder app document folder automatically @ time of app first launch. can this. need through code.
bool success; nserror *error; nsfilemanager *filemanager = [nsfilemanager defaultmanager]; nsstring *documentsdirectory = [nshomedirectory() stringbyappendingpathcomponent:@"documents"]; nsstring *filepath = [documentsdirectory stringbyappendingpathcomponent:@"data.txt"]; success = [filemanager fileexistsatpath:filepath]; if (!success) { nsstring *path = [[nsbundle mainbundle] pathforresource:@"data" oftype:@"txt"]; success = [filemanager copyitematpath:path topath:filepath error:&error]; } in application did finish launching options
Comments
Post a Comment