iOS开发之-AddressBook Guide

第3.7 章 机器人第三方库实战总结(七):Google开源数据协议Protocol Buffers 概述及代码入门 Protocol Buffers(简称Protobuf)是Google开发的一种语言无关、平台无关、可扩展的序列化数据格式。它通过定义数据结构(.proto文件),生成高效的序列化代码,广泛用于通信协议、数据存储等场景。在机器人自动驾驶系统工程中,Protocol Buffers(简称 Protobuf)作为核心数据传输与存储方案,发挥着至关重要的作用。核心优势高性能:序列化/反序列化速度远快于XML/JSON二进制格式:数据体积小,传输效率高强类型:编译时类型检查,减少运行时错误向后兼容。 阅读详情

官方文档 Address Book Programming Guide

Introduction 

1. The technology has several parts:

  • The Address Book framework provides access to the contact information.
  • The Address Book UI framework provides the user interface to display the information.
  • The Address Book database stores the information.
  • The Contacts application provides a way for users to access their contact information.

Records and Properties

1. Address Books

(1) To use an address book, declare an instance of  ABAddressBookRef and set it to the value returned from the function ABAddressBook. You can create multiple address book objects, but they are all backed by the same shared database.

ABAddressBookRef addressBook;
bool wantToSaveChanges = YES;
bool didSave;
CFErrorRef error = NULL;
 
addressBook = ABAddressBookCreate();
 
/* ... Work with the address book. ... */
 
if (ABAddressBookHasUnsavedChanges(addressBook)) {
    if (wantToSaveChanges) {
        didSave = ABAddressBookSave(addressBook, &error);
        if (!didSave) {/* Handle error here. */}
    } else {
        ABAddressBookRevert(addressBook);
    }
}
 
CFRelease(addressBook);

(2) Your application can request to receive a notification when Address Book database changes. 

Use the function ABAddressBookRegisterExternalChangeCallback to register a function of the prototypeABExternalChangeCallback.You can also unregister the function using ABAddressBookUnregisterExternalChangeCallback.

 

2. Records


(1) In the Address Book database, information is stored in records, represented byABRecordRef objects. Each record represents a person or group. The functionABRecordGetRecordType returns kABPersonType if the record is a person, and kABGroupType if it is a group. 

ABRecordRef person = ABPersonCreate();
ABRecordCopyValue
ABRecordSetValue
ABRecordRemoveValue

(2) Person records are made up of both single-value and multi-value properties.

(3) Single Value Property

ABRecordRef aRecord = ABPersonCreate();
CFErrorRef anError = NULL;
bool didSet;
 
didSet = ABRecordSetValue(aRecord, kABPersonFirstNameProperty, CFSTR("Katie"), &anError);
if (!didSet) {/* Handle error here. */}
 
didSet = ABRecordSetValue(aRecord, kABPersonLastNameProperty, CFSTR("Bell"), &anError);
if (!didSet) {/* Handle error here. */}
 
CFStringRef firstName, lastName;
firstName = ABRecordCopyValue(aRecord, kABPersonFirstNameProperty);
lastName  = ABRecordCopyValue(aRecord, kABPersonLastNameProperty);
 
/* ... Do something with firstName and lastName. ... */
 
CFRelease(aRecord);
CFRelease(firstName);
CFRelease(lastName);

(4) Multi Value Property

ABMutableMultiValueRef multi =
        ABMultiValueCreateMutable(kABMultiStringPropertyType);
CFErrorRef anError = NULL;
ABMultiValueIdentifier multivalueIdentifier;
bool didAdd, didSet;
 
// Here, multivalueIdentifier is just for illustration purposes; it isn't
// used later in the listing.  Real-world code can use this identifier to
// reference the newly-added value.
didAdd = ABMultiValueAddValueAndLabel(multi, @"(555) 555-1234",
                      kABPersonPhoneMobileLabel, &multivalueIdentifier);
if (!didAdd) {/* Handle error here. */}
 
didAdd = ABMultiValueAddValueAndLabel(multi, @"(555) 555-2345",
                      kABPersonPhoneMainLabel, &multivalueIdentifier);
if (!didAdd) {/* Handle error here. */}
 
ABRecordRef aRecord = ABPersonCreate();
didSet = ABRecordSetValue(aRecord, kABPersonPhoneProperty, multi, &anError);
if (!didSet) {/* Handle error here. */}
CFRelease(multi);
 
/* ... */
 
CFStringRef phoneNumber, phoneNumberLabel;
multi = ABRecordCopyValue(aRecord, kABPersonPhoneProperty);
 
for (CFIndex i = 0; i < ABMultiValueGetCount(multi); i++) {
    phoneNumberLabel = ABMultiValueCopyLabelAtIndex(multi, i);
    phoneNumber      = ABMultiValueCopyValueAtIndex(multi, i);
 
    /* ... Do something with phoneNumberLabel and phoneNumber. ... */
 
    CFRelease(phoneNumberLabel);
    CFRelease(phoneNumber);
}
 
CFRelease(aRecord);
CFRelease(multi);

Multi value properties consist of a list of values. Each value has a text label and an identifier associated with it. There can be more than one value with the same label, but the identifier is always unique. 

The individual values of a multivalue property are referred to by identifier or by index, depending on the context. Use the functionsABMultiValueGetIndexForIdentifier and ABMultiValueGetIdentifierAtIndex to convert between indices and multivalue identifiers.

The index will change if values are added or removed. The identifier is guaranteed not to change except across devices.

Multivalue objects are immutable; to change one you need to make a mutable copy using the functionABMultiValueCreateMutableCopy. You can also create a new mutable multivalue object using the functionABMultiValueCreateMutable.

The following functions let you modify mutable multivalue properties:


User Interface


(1)  The Address Book UI framework provides three view controllers and one navigation controller for common tasks related to working with the Address Book database and contact information. 

  • ABPeoplePickerNavigationController prompts the user to select a person record from their address book.
  • ABPersonViewController displays a person record to the user and optionally allows editing.
  • ABNewPersonViewController prompts the user create a new person record.
  • ABUnknownPersonViewController prompts the user to complete a partial person record, optionally allows them to add it to the address book.
(2) ABPeoplePickerNavigationController

ABPeoplePickerNavigationController *picker =
        [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;
[self presentModalViewController:picker animated:YES];
[picker release];

Optionally, set displayedProperties to the array of properties you want displayed. The relevant constants are defined as integers; wrap them in anNSNumber object using the numberWithInt: method to get an object that can be put in an array.


ABPeoplePickerNavigationControllerDelegate


(3) ABPersonViewController


ABPersonViewController *view = [[ABPersonViewController alloc] init];
 
view.personViewDelegate = self;
view.displayedPerson = person; // Assume person is already defined.
 
[self.navigationController pushViewController:view animated:YES];
[view release];


If the user taps on a property in the view, the person view controller calls thepersonViewController:shouldPerformDefaultActionForPerson:property:identifier: method of the delegate to determine if the default action for that property should be taken. To perform the default action for the selected property, such as dialing a phone number or composing a new email, returnYES; otherwise returnNO.


(4) ABNewPersonViewController

ABNewPersonViewController *view = [[ABNewPersonViewController alloc] init];
view.newPersonViewDelegate = self;
 
UINavigationController *newNavigationController = [[UINavigationController alloc]
                                                  initWithRootViewController:view];
[self presentModalViewController:newNavigationController
                        animated:YES];
 
[view release];
[newNavigationController release];

When the user taps the Save or Cancel button, the new-person view controller calls the methodnewPersonViewController:didCompleteWithNewPerson: of the delegate, with the resulting person record. If the user saved, the new record is first added to the address book. If the user cancelled, the value ofperson isNULL. The delegate must dismiss the new-person view controller using the navigation controller’sdismissModalViewControllerAnimated: method. 


(5) ABUnknownPersonViewController

ABUnknownPersonViewController *view = [[ABUnknownPersonViewController alloc] init];
 
view.unknownPersonViewDelegate = self;
view.displayedPerson = person; // Assume person is already defined.
view.allowsAddingToAddressBook = YES;
 
[self.navigationController pushViewController:view animated:YES];
[view release];


When the user finishes creating a new contact or adding the properties to an existing contact, the unknown-person view controller calls the methodunknownPersonViewController:didResolveToPerson: of the delegate with the resulting person record. If the user canceled, the value ofperson isNULL.


Programmatically Accessing the Database


1. Record

To get the record identifier of a record, use the functionABRecordGetRecordID. To find a person record by identifier, use the functionABAddressBookGetPersonWithRecordID. To find a group by identifier, use the functionABAddressBookGetGroupWithRecordID. To find a person record by name, use the functionABAddressBookCopyPeopleWithName.


2. Working with person records


You can add and remove records from the Address Book database using the functionsABAddressBookAddRecord and ABAddressBookRemoveRecord.

ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef people = ABAddressBookCopyArrayOfAllPeople(addressBook);
CFMutableArrayRef peopleMutable = CFArrayCreateMutableCopy(
                                          kCFAllocatorDefault,
                                          CFArrayGetCount(people),
                                          people
                                  );
 
 
CFArraySortValues(
        peopleMutable,
        CFRangeMake(0, CFArrayGetCount(peopleMutable)),
        (CFComparatorFunction) ABPersonComparePeopleByName,
        (void*) ABPersonGetSortOrdering()
);
 
CFRelease(addressBook);
CFRelease(people);
CFRelease(peopleMutable);




        
[网络安全自学篇] 六十八.WannaCry勒索病毒复现及分析(二)MS17-010利用及病毒解析 这是作者的网络安全自学教程系列,主要是关于安全工具和实践操作的在线笔记,特分享出来与博友们学习,希望您们喜欢,一起进步。前文分享了通过Python利用永恒之蓝漏洞加载WannaCry勒索病毒,并实现对Win7文件加密的过程,但过程较为复杂,为什么不直接利用永恒之蓝呢?所以,这篇文章将直接分享MSF利用MS17-010漏洞进行反弹Shell,再上传勒索病毒进行实验复现,并详细讲解WannaCry勒索病毒的原理。基础性文章,希望对您有所帮助。 阅读详情

相关推荐

win11系统ping另一台电脑上VMware虚拟机的IP

我是用了两台电脑,所以刚才遇到一个问题就是两台电脑的IP 在同一局域网内ping不通。于是就找了很多资料,经过坚强的绝望后终于解决了。 下开始解决问题: VMWare提供了三种工作模式:bridged(桥接模式)、NAT(网络地址转换模式)和host-only(主机模式)。 1. bridged(桥接模式)   在这种模式下,VMWare虚拟出来的操作系统就像是局域网中的一台独立主机,它可以访问网内任何一台机器。在桥接模式下,你需要手工为虚拟系统配置IP地址、子网掩码,而且还要和宿主机器处于同一网段,这样虚

qq_42817360的博客 3236

ABAddressBook & AddressBook UI 文件介绍(IOS开发)

原文链接地址:http://what-when-how.com/ios-4/accessing-the-address-book-ios-4/ 下图为 文章的核心部分。介绍了两个 ios addressbook 和addressbook UI 系统frame,有一些不了解的,看看后再编程,会有很大帮助 In this section, we’ll provide a basic ref

上海-相奇 博客技术资源分享 1906

STM32F103C8T6+A4988驱动42步进电机全流程(附接线图+代码解析)

本文详细介绍了使用STM32F103C8T6单片机与A4988驱动模块控制42步进电机的完整流程。内容涵盖硬件接线图解析、电流设置、GPIO驱动代码编写以及细分控制等核心实践,旨在帮助嵌入式开发者和DIY爱好者快速实现精准运动控制,适用于3D打印机、CNC等需要精密定位的项目。

Python的专栏 792

ABAddressBook & AddressBook UI 文件介绍(IOS开发)

原文链接地址:http://what-when-how.com/ios-4/accessing-the-address-book-ios-4/ 下图为 文章的核心部分。介绍了两个 ios addressbook 和addressbook UI 系统frame,有一些不了解的,看看后再编程,会有很大帮助 In this section, we’ll provide a basic ref

justinjing的专栏 2844

钣金设计高薪进阶:从材料工艺到DFMA降本增效全解析

钣金设计是机械制造领域的核心技术之一,它涉及将金属板材通过切割、折弯、焊接等工艺成型为所需零件。其核心原理在于深刻理解材料特性、制造工艺约束与结构力学,以确保设计在功能、成本与可制造性之间取得最佳平衡。这项技术的价值在于,优秀的钣金设计能直接驱动产品降本增效,通过优化材料利用率、简化装配工序和避免设计缺陷,为企业节省大量模具与生产成本。其应用场景广泛,从机箱机柜、汽车部件到电子设备外壳无处不在。本文将聚焦于实现这一价值的关键路径,深入探讨面向制造与装配的设计(DFMA)原则在钣金领域的实战应用,并剖析如何通

weixin_34301132的博客 391

Matlab安装Embedded Coder Support Package for Texas Instruments C2000 Processors教程

Matlab安装Embedded Coder Support Package for Texas Instruments C2000 Processors

m0_69133594的博客 2822

iOS:系统结构(2)

--原文地址:http://blog.youkuaiyun.com/nsurl/article/details/12706191 + http://blog.youkuaiyun.com/nsurl/article/details/12706271  ======================================== ==============Cocoa Services层==============

houseq 的专栏 1725

可编程逻辑控制器(PLC)系列:Mitsubishi MELSEC-Q_(8).MELSEC-Q系列PLC故障诊断与维护

MELSEC-Q系列PLC的故障诊断与维护是一个系统性的过程,需要工程师具备扎实的理论基础和丰富的实践经验。通过了解故障类型、使用诊断工具、遵循诊断步骤,可以有效地定位和解决故障问题。同时,定期的检查与保养、备份与恢复、优化程序和配置,以及提供良好的运行环境,可以减少故障的发生,提高系统的可靠性。希望本文能够帮助工程师在故障诊断与维护过程中更加得心应手,确保MELSEC-Q系列PLC的稳定运行。

2401_87715305的博客 1247

导出 本地电话簿(通讯簿) ios address book

Cocoa Touch Tutorial: Extract Address Book Address Values on iPhone OS This is the first of what I hope to be several Cocoa Touch tutorials on this site.  I was doing some furious Googling last n

上海-相奇 博客技术资源分享 1164

USB 网卡——RNDIS 控制消息流程

在其控制端点上获取控制消息时,设备必须在通信类接口的中断 IN 端点上返回通知,每当设备可以返回控制消息时,主机就会轮询该通知。需要注意的是,如果设备由于某种原因收到GET_ENCAPSULATED_RESPONSE,并且无法使用控制端点上的有效数据做出响应,则应返回设置为 0x00 的单字节数据包,而不是 stall 控制端点。下表中定义了此传输。收到 RESPONSE_AVAILABLE 通知后,主机使用下表中定义的GET_ENCAPSULATED_RESPONSE 传输从控制端点读取控制消息。

tyustli 371

AFL源码分析之afl-as.c详细注释

前言 afl-as注释好了,明白了是如何进行插桩的,以及插在哪里 本文主要参考Sakura大佬文章:https://eternalsakura13.com/2020/08/23/afl/ 编写不易,如果能够帮助到你,希望能够点赞收藏加关注哦Thanks♪(・ω・)ノ /* Copyright 2013 Google LLC All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); y

hollk’s blog 2172

PromiseKit 快速上手指南:用 Promise 简化 Swift 与 Objective-C 异步编程

PromiseKit 是一个面向 Swift 与 Objective-C 的完整 Promise 实现,其核心目标是用一条条可读的链式调用取代层层嵌套的回调,把异步编程从"回调地狱"中解放出来。本文以仓库根目录的 [README.md](https://link.gitcode.com/i/cd5799dd636303e21e0ea58ac7cc0f09) 为主线,结合 [Sources](htt

gitblog_00812的博客 353

isaaclab无法识别NVIDIA显卡,如何解决?

🏆本文收录于 《全栈Bug调优(实战版)》 专栏,该专栏专注于分享我在真实项目开发中遇到的各类疑难Bug及其深层成因,并系统提供高效、可复现的解决思路和实操方案。无论你是刚入行的新手开发者,还是拥有多年项目经验的资深工程师,本专栏都将为你提供一条系统化、高质量的问题排查与优化路径,助力你加速成长,攻克技术壁垒,迈向技术价值最大化与职业发展的更高峰🚀!    📌 特别说明: 文中部分技术问题来源于真实生产环境及网络公开案例,均经过精挑细选与系统化整理,并结合多位一线资深架构师和工程师多年实战经验沉淀,提

**My Coding Family** 1144

iOS 多语言本地化教程,VS Code KXApp 编辑 String Catalog .xcstrings

做 iOS 多语言本地化总要在 VS Code 和 Xcode 之间来回切?这篇讲用 KXApp(快蝎)在 VS Code 里直接编辑 String Catalog(.xcstrings):双击打开和 Xcode 一样的表格,`.xcstrings` 与老的 `.strings`、`.stringsdict` 同表编辑,加语言同步登记到工程、从源码扫描同步新 key,复数、设备变体和变量占位都在表里处理,改源语言文本后已有翻译自动标需复核。文件仍是标准格式,回 Xcode 打开一致。

2501_91592143的博客 149

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

4G 功能机操作系统选型指南:KaiOS、Mocor、MAUI、PMAOS 的能力边界与验证方法

4G 功能机如何选择操作系统?本文梳理 KaiOS、Mocor、MAUI、PMAOS 四条路线的技术定位与能力边界,从市场认证、应用清单、芯片与 BSP、内存与整机成本、交付维护五个维度建立选型流程,并提供场景决策矩阵和签约前八项验证清单,帮助研发与产品团队区分平台宣称、演示能力与目标机型的实际交付能力。

PMAOS的博客 177

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

芯参谋(83):AliOS Things_驱动开发指南

本指南针对AliOSThings驱动开发中的核心痛点,系统梳理了从硬件配置到组件交付的全流程。聚焦“初始化顺序”“分级加载”“CSI隔离”“VFS挂载”等关键问题,提供可照搬的八步开发流程、骨架代码与核查清单。通过明确驱动类型选择、组件化管理、板级静态配置(无DTS)及内核态/用户态运行模式,解决“驱动不注册”“open失败”“偶发死机”等典型难题。配套模板与实战案例,确保驱动可复现、可维护、可裁剪,适用于V3.x弹性微内核平台,助力开发者高效完成稳定可靠的外设驱动开发。

qq520131714的专栏 470

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

iOS 小组件开发,Windows 上用 KXBuild 加 WidgetKit 扩展 给 App 加 iOS 桌面小组件

iOS 小组件开发用 WidgetKit。这篇在 Windows 上用 KXBuild 的 add-target --type widget 给 SwiftUI 工程加一个桌面小组件扩展:写时间线和主屏小号/中号、锁屏圆形多种尺寸界面,用 App Group 和 App 共享数据,App 里调 WidgetCenter 主动刷新,按 F5 装到 iOS 17+ 的 iPhone 调试,再随 ipa 一起上架。以喝水打卡为例,附 App ID、描述文件准备和小组件不刷新、签名报错的排查。

2501_91600747的博客 177

安卓IOS打包证书

.p12 、 .mobileprovision 、 keystore 相关证书申请

weixin_58431406的博客 270

React Native项目开发(iOS侧为例)

本文基于React Native 0.71+,通过npx react-native init初始化项目后,详细讲解如何使用TypeScript搭建两个页面:入口页(Entrance.tsx)和我的页面(Profile.tsx)。重点介绍了配置tsconfig.json、初始化TypeScript环境、集成React Navigation实现页面跳转,并通过创建共享类型文件(navigation.ts)实现路由类型安全。文章还涵盖依赖安装、iOS构建问题排查、目录结构规范及常见错误解决方案。

D_xw_的博客 230

iOS 推送通知怎么实现,从 APNs p8 密钥到 iOS 真机收到第一条推送

iOS 推送通知要跑通,核心是 App ID 开通 Push Notifications 并重新生成描述文件、签名带上 aps-environment、再用 APNs 的 .p8 密钥签 JWT 把推送发到设备令牌。这篇用 KXBuild 按五步做:开能力、加 entitlements、代码里请求权限拿设备令牌、建 .p8 认证密钥、用一段 Node 脚本或 curl 走 HTTP/2 发测试推送,让 iPhone 弹出第一条通知。附拿不到令牌、APNs 报错码、TestFlight 收不到的排查。

2501_91591841的博客 210

[iOS]Runtime2

为了让你在父类中依然能访问当前对象(也就是子类的实例),编译器在底层会生成一个结构体,叫 : 当调用 时,底层调用的函数是 : 拿着(也就是当前的子类对象)作为消息接收者,但是把方法查找的起点定位在了 (父类)这里需要注意的就是仍然是调用者自己,即先讲一下上篇没讲过的,我们如果缓存未命中,那我们就会进入慢速查找,现在我们来详细的讲解在进入慢速查找的瞬间会再看一遍方法列表,然后立刻调用加锁,因为多线程下别人正在动态添加方法或者扩容,不加锁会崩溃类就绪OC的机制就是在编译期只生成了 结构,当类首次被发送消息时(

wzm20070304的博客 208

React Native iOS 项目搭建

本文系统梳理了React Native iOS开发的环境检测与项目搭建全流程。强调环境问题占报错70%根因,需优先验证Node/npm、Watchman、Xcode工具链、模拟器运行时等关键项。通过官方CLI初始化项目,配合CocoaPods管理原生依赖,实现从环境验收到首跑成功的闭环。基于React Navigation构建双Tab嵌套导航,结合AsyncStorage实现本地持久化,完成用户列表、详情页、我的页等核心功能。最后提供调试技巧与高频报错解决方案,助力开发者高效落地RN项目。

D_xw_的博客 441

iOS App 图标、启动屏和多语言搭配 方法,上架前使用KXBuild一次做好 App 图标

上架前,iOS 的 App 图标、启动屏和多语言这三样配不齐,上传时就可能被拦或显示不对。这篇用 KXBuild 一次配好:图标只要一张 1024×1024、不带透明通道的 PNG,在资源目录编辑器里右键就生成全部尺寸,还支持 iOS 18 深色/着色和 Xcode 26 的 .icon;启动屏在 Info.plist 的 UILaunchScreen 填背景色和 Logo;界面文字、App 名称用 .xcstrings 翻译,商店信息再到 App Store Connect 按语言填。附上架前检查清单。

2501_91600889的博客 266

Appuploader 创建 iOS 描述文件详解,Development / Ad Hoc / App Store

搞不清 iOS 描述文件(Provisioning Profile)该选 Development、Ad Hoc 还是 App Store?本文讲清四种类型各装到哪、哪些要绑设备、能不能上架,重点辨析最容易混的 Development 与 Ad Hoc,说明设备或证书变动后为什么要重建、重建后要重新导入签名,并给出不用 Mac 在 Windows/Linux 上用 Appuploader 新建与重建描述文件的实操步骤,附装机"描述文件不匹配"等常见问题排查。

2501_91373349的博客 206

Windows 开发 iOS,Sign in with Apple 苹果登录,KXBuild 真机调试全流程

Sign in with Apple 接入分四步:App ID 开能力并重新生成描述文件,entitlements 加 com.apple.developer.applesignin,用 SignInWithAppleButton 拿 identityToken 交服务端验签,删账号时调 revoke。本文讲清审核指南 4.8 为什么要你提供它、姓名邮箱只给一次、用 user 当主键,并在 Windows 上用 KXBuild 真机测登录,附 1000 报错排查。

2501_91373349的博客 196

iOS 深度链接配置教程,URL Scheme 与 Universal Links,KXBuild 真机验证

深度链接两种:URL Scheme(myapp://)只改 Info.plist 的 CFBundleURLTypes;Universal Links(https://)要开 Associated Domains、在 entitlements 写 applinks 域名、网站放 /.well-known/apple-app-site-association。讲清两者怎么选、onOpenURL 处理代码,在 Windows 上用 KXBuild 装 Debug 包真机验证,附 CDN 缓存和十个不跳转排查。

2501_91600747的博客 255
下一篇: iOS开发之-Cocoa Fundamentals Guide 1 -- What is Cocoa?
nerohoop
博客等级 码龄16年 42粉丝 38原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值