ios - Shared the file within two target using GROUP APP -
- (void) readthefile{ nserror *error; nsfilemanager *filemanager = [nsfilemanager defaultmanager]; nsstring *path = [self getthefilepath]; if (![filemanager fileexistsatpath: path]) { nsstring *bundle = [[nsbundle mainbundle] pathforresource:@"setting" oftype:@"plist"]; [filemanager copyitematpath:bundle topath: path error:&error]; } } - (nsstring *)getthefilepath{ nsurl *url = [[nsfilemanager defaultmanager] containerurlforsecurityapplicationgroupidentifier:@"com.group.test"]; nsstring *path = [url.absolutestring stringbyappendingpathcomponent:@"setting.plist"]; path = [path stringbyreplacingoccurrencesofstring:@"file:" withstring:@""]; homecoming path; }
hi all, got confuse problem. have 2 target in 1 project, 1 extension target. want share plist file in both target. created grouping app in capabilities both target successfully. thought created plist file in 1 target , other extension app need check same location (above code) , check file exist or not. if not exist create new plist file. tested on simulator fine. when run on device, unusual things come out. when read file, getthefilepath give right path when checked file exist or not. show no. created file first target. programme go on , re-create file bundle , paste path. got error files exist.
error domain=nscocoaerrordomain code=516 "the operation couldn’t completed. (cocoa error 516.)" "the operation couldn’t completed. file exists" sometimes restart device automatically. why?
please help me, i'm using xcode 6 beta , tested on ios8 iphone5s
i have been looking app groups lot ios 8 on horizon , have come across problem few times now. turns out bug within the current beta of xcode. sure figured out hasn't updated , still having same problem should resolve it.
ios iphone xcode nsfilemanager ios8
No comments:
Post a Comment