Xcode upload a plist file on a server (iPhone) -
i have simple (i think) question :
i got iphone. create plist file , save it. want upload file on server.
then, 3 others iphone, download plist file , decrypt informations.
my question : how can upload plist file server !! don't have ftp server or others ... can use instead dropbox exemple ? or other way communicate between iphone (private - not appstore) ?
thanks answers !
yes, can use dropbox api upload plist on dropbox user's folder.
check first this link setup project
you can use these snippets (from page):
nsstring *localpath = [[nsbundle mainbundle] pathforresource:@"info" oftype:@"plist"]; nsstring *filename = @"info.plist"; nsstring *destdir = @"/"; [[self restclient] uploadfile:filename topath:destdir withparentrev:nil frompath:localpath];
then implement callbacks
- (void)restclient:(dbrestclient*)client uploadedfile:(nsstring*)destpath from:(nsstring*)srcpath metadata:(dbmetadata*)metadata { nslog(@"file uploaded path: %@", metadata.path); } - (void)restclient:(dbrestclient*)client uploadfilefailedwitherror:(nserror*)error { nslog(@"file upload failed error - %@", error); }
edit: (if want, can load plist documents folder of app. remember mainbundle read-only can't modify plist resides in main bundle, can read it)..like this:
nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory,nsuserdomainmask, yes); nsstring *plistfilepath = [[paths objectatindex:0]stringbyappendingpathcomponent:@"info.plist"]; nsdictionary *plistfile = [[nsmutabledictionary alloc] initwithcontentsoffile:plistfilepath];
Comments
Post a Comment