跳至主要内容

博文

目前显示的是 一月, 2021的博文

App Clips

 参考链接 https://www.jianshu.com/p/21af85107a34 https://developer.apple.com/documentation/app_clips?language=objc https://developer.apple.com/documentation/app_clips/configuring_your_app_clip_s_launch_experience?language=objc https://developer.apple.com/documentation/app_clips/making_data_available_to_the_app_clip_s_corresponding_app?language=objc 3.App Clips流程使用 3.1启动流程 从用户以各种方式与轻 App Clips交互开始,直到用户切换到完整 App。 如果存在主App那么App Clips不会被调起、如果不存在、那么唤起App Clips、同时可以引导下载主App。 image.png 3.2 调用场景 通过NFC扫描来唤起 通过点击Sari提供的基于地理位置的推荐 在地图App上点击指定的链接 点击网页上的智能推荐横幅 通过Messages App分享的链接 二维码扫描进入 3.3 App Clips技术限制 App Clip 仅限应用于特定场景,即尽可能快地完成一个任务,即用即走。你可以把它看作主 app 的核心功能应用,对于复杂的任务应该在其对应的主 app 完成,因此某些功能被禁止在 App Clip 中使用。 安装包大小 10M 以内 当弹出 App Clip Card 时会立即下载 App Clip,安装包大小的限制保证了用户体验——当用户打开 App Clip 时大概率已经下载好。 不能使用指定 Framework Assets Library, CallKit, CareKit, CloudKit, Contacts, Contacts UI, Core Motion, File Provider, File Provider UI, HealthKit, HomeKit, Media, Player, Message...

PRIVATE INSTANCE VARIABLE ACCESS IN OBJECTIVE-C

 原文链接 I was inspired the other day while talking with a friend about how to access private instance variables in a subclass. There are several methods to do this - some useful in production and some error prone. @interface Foo : NSObject @end @implementation Foo { @private NSString * _name ; } @end Pointer arithmetic Since an Objective-C object is a pointer to allocated memory in the heap, it is possible to calculate offset of the ivar and use basic pointer arithmetic to access it. In this basic example _name is the first field in the class Foo, it will be offset of 4 from the base pointer of the instance. NSString *name = (__bridge id)*(void **)((__bridge void *)aFoo + 4) In production code this approach isn’t so nice but an interesting thought experiment. Runtime The runtime provides the following functions to access instance variables on an object. Ivar class_getInstanceVariable(Class cls, const char *name) id object_getIvar(id obj, Ivar ivar) Which can b...