persistence苹果手机中文网

苹果手机中文网  时间:2021-05-19  阅读:()
MediaComputingGroupRWTHAachenUniversityJan-PeterKrmeriPhoneApplicationProgrammingLecture09:DataPersistencehttp://hci.
rwth-aachen.
de/iphoneWinterSemester2013/2014iPhoneApplicationProgrammingProf.
JanBorchersWhatdatadowehaveondevices2HowdowepresentdatatotheuseriPhoneApplicationProgrammingProf.
JanBorchers3iPhoneApplicationProgrammingProf.
JanBorchers4iPhoneApplicationProgrammingProf.
JanBorchers5iPhoneApplicationProgrammingProf.
JanBorchers6"Documents""Settings""Shoebox"iPhoneApplicationProgrammingProf.
JanBorchersDataHandlingOverview7DocumentAppData"Settings""Shoebox"LocalNSUserDefaultsUIDocumentDatabaseSyncediCloudKey/ValueGameCenterUIDocumentwithiCloudDatabaseOnlineCommunicationwithawebserverCoreDataiPhoneApplicationProgrammingProf.
JanBorchersPreferencesandSettings8NSUserDefaultsSingletonKey/valuepairsProvidesstandardvalues(factorydefaults)SettingsBundleDescribespreferencesmanagedinsettingsSamekeysasinNSUserDefaultsiPhoneApplicationProgrammingProf.
JanBorchersPreferencesandSettings8NSUserDefaultsSingletonKey/valuepairsProvidesstandardvalues(factorydefaults)SettingsBundleDescribespreferencesmanagedinsettingsSamekeysasinNSUserDefaultsiPhoneApplicationProgrammingProf.
JanBorchersPreferencesandSettings9NSUserDefaultsApplicationiPhoneApplicationProgrammingProf.
JanBorchersDemo10iPhoneApplicationProgrammingProf.
JanBorchersDataHandlingOverview11DocumentAppData"Settings""Shoebox"LocalNSUserDefaultsUIDocumentDatabaseSyncediCloudKey/ValueGameCenterUIDocumentwithiCloudDatabaseOnlineCommunicationwithawebserveriPhoneApplicationProgrammingProf.
JanBorchersWheretoputles-(NSURL*)localDocumentsDirectoryURL{staticNSURL*localDocumentsDirectoryURL=nil;if(localDocumentsDirectoryURL==nil){//usesystemfunctionNSString*documentsDirectoryPath=[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES)objectAtIndex:0];localDocumentsDirectoryURL=[NSURLfileURLWithPath:documentsDirectoryPath];}returnlocalDocumentsDirectoryURL;}12iPhoneApplicationProgrammingProf.
JanBorchersUIDocument13HighlevelAPIforleaccessAlwaysrepresentsauserdocumentCanhandlelepackagesAutosavingUndoHandlesremotechangesfromiCloudUIManagedDocumentforCoreDataiPhoneApplicationProgrammingProf.
JanBorchersCreatinganewdocument//creatinganewdocumentself.
document=[[UIDocumentalloc]initWithFileURL:fileURL];//documentcreatedinmemory[self.
documentsaveToURL:self.
document.
fileURLforSaveOperation:UIDocumentSaveForCreatingcompletionHandler:^(BOOLsuccess){//filecreatedondiskif(success)[selfdisplayFileContents];}];14//UIDocument-(id)initWithFileURL:(NSURL*)url{self=[superinitWithFileURL:url];if(self)self.
textcontents=@"Helloworld!
";returnself;}iPhoneApplicationProgrammingProf.
JanBorchersSavingaUIDocument//ReturnNSDatarepresentationforsaving-(id)contentsForType:(NSString*)typeNameerror:(NSError**)outError{NSData*data=[self.
contentsdataUsingEncoding:NSUTF8StringEncoding];returndata;}15getssavedwhenleisclosedorautosavedwhenchangesarependingNSUndoManagerorcallupdateChangeCount:iPhoneApplicationProgrammingProf.
JanBorchersDataHandlingOverview16DocumentAppData"Settings""Shoebox"LocalNSUserDefaultsUIDocumentDatabaseSyncediCloudKey/ValueGameCenterUIDocumentwithiCloudDatabaseOnlineCommunicationwithawebserveriPhoneApplicationProgrammingProf.
JanBorchersSQLite17iPhoneApplicationProgrammingProf.
JanBorchersDataHandlingOverview18DocumentAppData"Settings""Shoebox"LocalNSUserDefaultsUIDocumentDatabaseSyncediCloudKey/ValueGameCenterUIDocumentwithiCloudDatabaseOnlineCommunicationwithawebserverCoreDataiPhoneApplicationProgrammingProf.
JanBorchersCoreData19iPhoneApplicationProgrammingProf.
JanBorchersCoreData20HighlevelrelationaldatastorageAutomaticpersistenceHighperformanceaccessGetundo/redoforfreeAvailabledatastoresMemoryBinaryleSQLiteiPhoneApplicationProgrammingProf.
JanBorchersCoreDataStack21CoreDataStackhoneApplicationProgrammingProf.
JanBorchersYourControllerUIApplicationDelegateNSManagedObjectContextNSManagedObjectNSPersistentStoreCoordinatorNSPersistentStoreNSManagedObjectModelNSEntityDescriptionYourModelObjectiPhoneApplicationProgrammingProf.
JanBorchersCustomModelClass//Recipe.
h@interfaceRecipe:NSManagedObject{}@property(retain)NSString*title;//Recipe.
m#import"Recipe.
h"@implementationRecipe@dynamictitle;@end24iPhoneApplicationProgrammingProf.
JanBorchersCreating/DeletingManagedCreate(Insert)NSManagedObjectContextEntityname[NSEntityDescriptioninsertNewObjectForEntityForName:[entityname]inManagedObjectContext:context]DeleteNSManagedObjectContextNSManagedObject[contextdeleteObject:managedObject];Savecontexttomakechangepersistent25iPhoneApplicationProgrammingProf.
JanBorchersRetrievingManagedObjectsNSFetchRequestEntity:NSEntityDescriptionSortingcriteria:NSSortDescriptorsSearchcriteria:NSPredicateNSFetchedResultsControllerTailoredtoprovidedataforUITableViewsRequires:NSFetchRequest,NSManagedObjectContextChangetrackingviadelegate26iPhoneApplicationProgrammingProf.
JanBorchersFetchData//SetupthefetchrequestNSFetchRequest*request=[[NSFetchRequestfetchRequestWithEntityName:@"Recipe"];//ConfigurethefetchrequestNSSortDescriptor*sortDescriptor=[NSSortDescriptorsortDescriptorWithKey:@"creationDate"ascending:NO];[requestsetSortDescriptors:@[sortDescriptor]];//ExecutetherequestNSError*error=nil;NSArray*fetchResults;fetchResults=[managedObjectContextexecuteFetchRequest:requesterror:&error];if(error){//Handletheerror.
}27iPhoneApplicationProgrammingProf.
JanBorchersUndoManager//attachundomanagerundoManager=[[NSUndoManageralloc]init];[self.
managedObjectContextsetUndoManager:undoManager];//performundo[self.
managedObjectContextundo];28iPhoneApplicationProgrammingProf.
JanBorchersDemo29iPhoneApplicationProgrammingProf.
JanBorchersPerformance30[requestsetPropertiesToFetch:@[@"name"]];[requestsetPropertiesToGroupBy:@[@"major"]];UsebatchfetchesJustfetchneededvaluesUsepredicatestolterresultsUseSQLiteforcalculationsUseSQLDebuggingiPhoneApplicationProgrammingProf.
JanBorchersPerformance30request.
predicate=[NSPredicatepredicateWithFormat:@"age>%@ANDname==%i",name,age];UsebatchfetchesJustfetchneededvaluesUsepredicatestolterresultsUseSQLiteforcalculationsUseSQLDebuggingTextcomparisonisexpensiveNumericcomparisonischeapiPhoneApplicationProgrammingProf.
JanBorchersPerformance30NSExpressionDescription*ed=[[NSExpressionDescriptionalloc]init];ed.
name=@"minimum";ed.
expression=[NSExpressionexpressionForFunction:@"min:"arguments:@[[NSExpressionexpressionForKeyPath:@"grade"]]];[requestsetPropertiesToFetch:@[ed]];UsebatchfetchesJustfetchneededvaluesUsepredicatestolterresultsUseSQLiteforcalculationsUseSQLDebuggingiPhoneApplicationProgrammingProf.
JanBorchersPerformance30UsebatchfetchesJustfetchneededvaluesUsepredicatestolterresultsUseSQLiteforcalculationsUseSQLDebugging-com.
apple.
CoreData.
SQLDebug1iPhoneApplicationProgrammingProf.
JanBorchersConcurrency31MainQueueContextMainQueueContextPrivateQueueContextPrivateQueueContextPersistentStoreCoordinatoriPhoneApplicationProgrammingProf.
JanBorchersConcurrency31MainQueueContextMainQueueContextPrivateQueueContextPrivateQueueContextPersistentStoreCoordinatoriPhoneApplicationProgrammingProf.
JanBorchersConcurrency31MainQueueContextMainQueueContextPrivateQueueContextPrivateQueueContextPersistentStoreCoordinatorSaveiPhoneApplicationProgrammingProf.
JanBorchersConcurrency31MainQueueContextMainQueueContextPrivateQueueContextPrivateQueueContextPersistentStoreCoordinatorSaveiPhoneApplicationProgrammingProf.
JanBorchersConcurrency31MainQueueContextMainQueueContextPrivateQueueContextPrivateQueueContextPersistentStoreCoordinatoriPhoneApplicationProgrammingProf.
JanBorchersSaveConcurrency31MainQueueContextMainQueueContextPrivateQueueContextPrivateQueueContextPersistentStoreCoordinatorriPhoneApplicationProgrammingProf.
JanBorchersConcurrency32MainQueueContextMainQueueContextPrivateQueueContextPrivateQueueContextPersistentStoreCoordinatoriPhoneApplicationProgrammingProf.
JanBorchersConcurrency32MainQueueContextMainQueueContextPrivateQueueContextPrivateQueueContextPersistentStoreCoordinatorFetchriPhoneApplicationProgrammingProf.
JanBorchersDataHandlingOverview33DocumentAppData"Settings""Shoebox"LocalNSUserDefaultsUIDocumentDatabaseSyncediCloudKey/ValueGameCenterUIDocumentwithiCloudDatabaseOnlineCommunicationwithawebserveriPhoneApplicationProgrammingProf.
JanBorchersiCloud34iPhoneApplicationProgrammingProf.
JanBorchersiCloudBasicsChangesononedeviceareautomaticallypushedtootherdevicesUsercanpickupanydeviceandwillalwayshaveaccesstoherdataSyncisperappandperuserFreesubscriptionis5GBsharedamongallapps35iPhoneApplicationProgrammingProf.
JanBorchersiCloudAPIsSettings:useNSUbiquitousKeyValueStore(similarlytoNSUserDefaults)1MBlimitationSyncswithinminutesLastvaluealwayswinsDocuments:UIDocumentonaURLinaspecialfolderNolimitSyncswithinsecondsCanmergeconictingles36NSUbiquitousKeyValueStorApplicationUIDocumentiPhoneApplicationProgrammingProf.
JanBorchersDataHandlingOverview37DocumentAppData"Settings""Shoebox"LocalNSUserDefaultsUIDocumentDatabaseSyncediCloudKey/ValueGameCenterUIDocumentwithiCloudDatabaseOnlineCommunicationwithawebserveriPhoneApplicationProgrammingProf.
JanBorchersDatabaseDatabaseDatabaseDatabaseDatabaseDatabaseDatabaseRemote(Web)Objects38iPhoneApplicationProgrammingProf.
JanBorchersWebBackendServerXMLHTTPJSONRemote(Web)Objects39iPhoneApplicationProgrammingProf.
JanBorchersRepresentationalStateTransfer(REST)ResourcemanipulationviaHTTPoperationsURLdescribesresourceDataencodedinXMLorJSONGET,PUT,POST,DELETEoperationsareusedtomanipulateresources40http://my.
server.
com/person/127.
xmlServerAddressResourceNameResourceIdFormatiPhoneApplicationProgrammingProf.
JanBorchersiPhoneHTTPRequests//createrequestNSURL*url=[NSURLURLWithString:@"http://server/people.
xml"];request=[[NSMutableURLRequestalloc]initWithURL:url];//settheHTTPoperation[requestsetHTTPMethod:@"POST"];//setthepostdataNSData*postData=[@"id=1&person[name]=Paul"dataUsingEncoding:NSUTF8StringEncoding];[requestsetHTTPBody:postData];//firetherequestconnection=[NSURLConnectionconnectionWithRequest:requestdelegate:self];[connectionstart];41iPhoneApplicationProgrammingProf.
JanBorchersBasicDataNSDataNSXMLParserNSJSONSerializationNSURLConnectionWebBackendServerRemote(Web)Objects42iPhoneApplicationProgrammingProf.
JanBorchersRestKitBasics43RestKitknowsRESTfulWebservicesCaninteractwithCoreDataKeyparadigm:MappingresponsefromthewebtoObjective-CobjectsiPhoneApplicationProgrammingProf.
JanBorchersRestKitStructure44ObjectManagerManagedObjectStoreResponseEntity/ObjectMappingRequestDescriptoriPhoneApplicationProgrammingProf.
JanBorchersDemo45iPhoneApplicationProgrammingProf.
JanBorchersDataHandlingOverview46DocumentAppData"Settings""Shoebox"LocalNSUserDefaultsUIDocumentDatabaseSyncediCloudKey/ValueGameCenterUIDocumentwithiCloudDatabaseOnlineCommunicationwithawebserverCoreDataiPhoneApplicationProgrammingProf.
JanBorchersMoreInformationSQLiteOnlineDocumentationAppleGuidesArchivesandSerializationProgrammingGuideCoreDataProgrammingGuideDocument-BasedApplicationProgrammingGuideURLLoadingSystemProgrammingGuiderestkit.
orggithub.
com/lichtschlag/iCloudPlaygroundgithub.
com/lichtschlag/Chronos47iPhoneApplicationProgrammingProf.
JanBorchersEpilogue:Sharingdatalocally48Howtogetdatafromapptoapp"Openwith.
.
.
"UIDocumentInteractionControllerAppspublishwhatlestheycanopenSenderapppushesdocument,userselectstargetappDataiscopiedbetweenappsandboxesNowaytotracklesiPhoneApplicationProgrammingProf.
JanBorchersUIDocumentInteractionController-(IBAction)openExternally:(id)sender{//savefirst[self.
documentsaveToURL:self.
document.
fileURLforSaveOperation:UIDocumentSaveForOverwritingcompletionHandler:^(BOOLsuccess){//bringupdialogfromdocinteractioncontrollerself.
docController=[UIDocumentInteractionControllerinteractionControllerWithURL:self.
document.
fileURL];BOOLdidOpen=[docControllerpresentOpenInMenuFromRect:CGRectZeroinView:self.
openButtonanimated:YES];if(!
didOpen){[[[UIAlertViewalloc]initWithTitle:@"Cannotopenfileinotherapps"message:@"Unfortunately,thereisnoappinstalledthatcanhandlethiskindoffile.
"delegate:nilcancelButtonTitle:@"Ok"otherButtonTitles:nil]show];}}];}49iPhoneApplicationProgrammingProf.
JanBorchersChecktheiCloudPlaygrounddemocodeformoreinfoUIDocumentControllerinAction50

GigsGigsCloud(年付26美元)国际线路美国VPS主机

已经有一段时间没有听到Gigsgigscloud服务商的信息,这不今天看到商家有新增一款国际版线路的美国VPS主机,年付也是比较便宜的只需要26美元。线路上是接入Cogentco、NTT、AN2YIX以及其他亚洲Peering。这款方案的VPS主机默认的配置是1Gbps带宽,比较神奇的需要等待手工人工开通激活,不是立即开通的。我们看看这款服务器在哪里选择看到套餐。内存CPUSSD流量价格购买地址1...

舍利云30元/月起;美国CERA云服务器,原生ip,低至28元/月起

目前舍利云服务器的主要特色是适合seo和建站,性价比方面非常不错,舍利云的产品以BGP线路速度优质稳定而著称,对于产品的线路和带宽有着极其严格的讲究,这主要表现在其对母鸡的超售有严格的管控,与此同时舍利云也尽心尽力为用户提供完美服务。目前,香港cn2云服务器,5M/10M带宽,价格低至30元/月,可试用1天;;美国cera云服务器,原生ip,低至28元/月起。一、香港CN2云服务器香港CN2精品线...

HostYun 新上美国CN2 GIA VPS 月15元

HostYun 商家以前是玩具主机商,这两年好像发展还挺迅速的,有点在要做点事情的味道。在前面也有多次介绍到HostYun商家新增的多款机房方案,价格相对还是比较便宜的。到目前为止,我们可以看到商家提供的VPS主机包括KVM和XEN架构,数据中心可选日本、韩国、香港和美国的多个地区机房,电信双程CN2 GIA线路,香港和日本机房,均为国内直连线路。近期,HostYun上线低价版美国CN2 GIA ...

苹果手机中文网为你推荐
SAProute如时间选项无法打开请更改日照职业技术学院RIZHAO输入ipad支持ipad重庆网通重庆联通现在有哪些资费???google中国地图强大的谷歌地图,为什么中国不用起来google中国地图求教谷歌中国地图~手机如何使用?360chromechrome是什么文件夹?是360急速浏览器吗?但是怎么没有卸载掉?谷歌sb在谷歌里搜SB为什么结果中第一个是百度
个人虚拟主机 krypt smartvps 阿云浏览器 100x100头像 架设服务器 服务器维护方案 老左正传 双十一秒杀 metalink 双12 彩虹云 上海电信测速网站 丽萨 免费稳定空间 zcloud phpinfo cdn加速 apachetomcat webmin 更多