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

RAKsmart:美国圣何塞服务器限量秒杀$30/月起;美国/韩国/日本站群服务器每月189美元起

RAKsmart怎么样?RAKsmart是一家由华人运营的国外主机商,提供的产品包括独立服务器租用和VPS等,可选数据中心包括美国加州圣何塞、洛杉矶、中国香港、韩国、日本、荷兰等国家和地区数据中心(部分自营),支持使用PayPal、支付宝等付款方式,网站可选中文网页,提供中文客服支持。本月商家继续提供每日限量秒杀服务器月付30.62美元起,除了常规服务器外,商家美国/韩国/日本站群服务器、1-10...

pacificrack:VPS降价,SSD价格下降

之前几个月由于CHIA挖矿导致全球固态硬盘的价格疯涨,如今硬盘挖矿基本上已死,硬盘的价格基本上恢复到常规价位,所以,pacificrack决定对全系Cloud server进行价格调整,降幅较大,“如果您是老用户,请通过续费管理或升级套餐,获取同步到最新的定价”。官方网站:https://pacificrack.com支持PayPal、支付宝等方式付款VPS特征:基于KVM虚拟,纯SSD raid...

CYUN(29元/月)美国、香港、台湾、日本、韩国CN2,续费原价

关于CYUN商家在之前有介绍过一次,CYUN是香港蓝米数据有限公司旗下的云计算服务品牌,和蓝米云、蓝米主机等同属该公司。商家主要是为个人开发者用户、中小型、大型企业用户提供一站式核心网络云端部署服务,促使用户云端部署化简为零,轻松快捷运用云计算。目前,CYUN主要运营美国、香港、台湾、日本、韩国CN2线路产品,包括云服务器、站群服务器和独立服务器等。这次看到CYUN夏季优惠活动发布了,依然是熟悉的...

苹果手机中文网为你推荐
pcllenchromenewlyroute"2014年全国民营企业招聘会现场A区域企业信息",,,,设置win7支持ipad支持ipad支持ipad支持ipad支付appleiexplore.exe应用程序错误iexplore.exe应用程序错误
韩国vps highfrequency sockscap 鲜果阅读 火车票抢票攻略 xfce 网站实时监控 ibox官网 52测评网 美国十次啦服务器 183是联通还是移动 idc是什么 百度云1t web服务器搭建 什么是web服务器 贵阳电信 防cc攻击 华为k3 阿里云手机官网 腾讯网盘 更多