2015 108_hd_building_watch_apps


Control-Click Run to run without build.



2015 212_hd_optimizing_your_app_for_multitasking_on_ipad_in_ios_9


Queues mit niedriger Priorität können temporär beschleunigt werden, wenn eine höher priorisierte Queue auf sie wartet.

dispatch_sync()

dispatch_block_wait()


NSCache is like NSDictionary but evicts items when necessary.


NSPurgeableData sublcass of NSMutableData.

Als unbenutzt markierte Daten können vom System selbst beseitigt werden ohne Memory Warming.

Kann auch in NSCache verwendet werden.


Only use with large objects or group data.


https://developer.apple.com/library/ios/documentation/Performance/Conceptual/ManagingMemory/Articles/CachingandPurgeableMemory.html


Memory Mapped Data is considered clean. 

NSData initWithContentsOfFile with options NSDataReadingMappedIfSafe or NSDataReadingMappedAlways creates Memory Mapped Data File.

Only use big files otherwise backfires.

System (ent)lädt die (un)benutzten Dateibereiche automatisch. 





2015 805_hd_apple_watch_design_tips_and_tricks


Watch apps are page based or hierachical.

Page based: Flat and all peers. Swiping works only for few pages like max 6.

Hierachical: Larger more complex data structures. No more than 2 levels, three at most.


In a hierachical app the page title is just a label and not a back button.


Modal sheets don’t have time display.




2015 226_hd_advanced_nsoperations


Use OperationQueues for business logic like dependency. Even across queues. Not only background but for authentication and modal UI like Alerts.

NSURLSesssionTask wrapped inside NSOperation.

Sample code: Advanced NSOperations, Earthquakes and Operations (from the WWDC.app)


2015 231_hd_cocoa_touch_best_practices


Short didFinishLaunching, dispatch away other stuff.

Use Apples Frameworks to implement general behaviour and save maintenance costs.

Target two most recent versions.

Think in sizes not in orientation.

Use properties instead of view tags.

Use UIViewControllerTransitionCoordinator for dynamic timing.


- [UIView hasAmbiguousLayout] (can be called on UIWindow).

- [UIView _autolayoutTrace]

Both can be used for unit testing.


TableView beginUpdates /  change model, change cell / endUpdates for animation.

Custom layout for CollectionView: Targeted invalidation context for fixed header e. g. Invalidate on bounds change (scrolling).


2015 233_hd_advanced_touch_input_on_ios


Coalesced Touches, Predicted Touches


2015 218_hd_mysteries_of_auto_layout_part_1


Start with Stack View, use constraints as needed.

Don’t add/remove constraints anymore but activate/deactivate.

Alignment Rects contain only the important content.

Sample Code: AstroLayout


2015 219_hd_mysteries_of_auto_layout_part_2


Simplified NSLayoutConstraints factory methods using layout anchors.

Add identifiers to constraints to make logs readable.

Also accessiblity identifiers on views.

And identifiers on layout guides.


Auto Layout debug log reading:


Start from the bottom, see the broken constraint for someView.

Check translatesAutoresizing…

View one axis at a time:

po [someView constraintsAffectingLayoutForAxis: 1]

Vertical:1 Horizontal:0


Ambiguous Layout:

- Too few constraints

- Conflicting priorities


IB tells about layout problems but debug can do too:

po [someView _autolayoutTrace]

Xcode: Debug > View Debugging


po [someView hasAmbiguousLayout]

po [someView exerciseAmbiguityInLayout] shows other possibilites to layout



2015 220_hd_whats_new_in_core_data


hasPersistenChangedValues

objectIDsForRelationShipNamed

refreshAllObjects

shouldDeleteInaccessibleFaults

destroyPersistenStoreAtURL

replacePersistenStoreAtURL


Unique constraints, no need to check for update versus insert.

Sample project: Recipes.


NSBatchDeleteRequest (like NSBatchUpdateRequest) deletes without loading objects into memory.


__kindof for easier casting

Confinement is deprecated, use block base API. See 2011 “What’s New in Core Data on iOS”.


Cache Miss Instruments for Core Data, then:

Use request.relationshipKeyPathsForPrefetching to avoid relationship faults by prefetching objects you’re going to use.


FetchRequests Insturments to find large fetches.

Use fetchBatchSize like 30 for large Fetches to load only what is needed to show.


Large fetches benefit from indexes.


-com.apple.CoreData.SQLDebug 1

Connecting to database file at …

sqlite3 “file”

sqlite> explain query plan … (quiery)


Get off the main thread:

- Privat queue context.

- Create composite data to show to the user, use:

NSAsynchronousFetchRequest off the main thread while working, comes back when ready.



2015 215_hd_whats_new_in_storyboards


Unwind Seques

Storyboard References


Sample Project: SequeCatalog


2015 229_hd_whats_new_in_uikit_dynamics_and_visual_effects


Debugging UIKIt Dynamics

(lldb) UIDynamicAnimator 

debugEnabled (overlay of physics)

debugInterval

debugAnimationSpeed


Fixing broken effects

(lldb) po [myEffectView _whatsWrongWithThisEffect]



2015 718_hd_building_responsive_and_efficient_apps_with_gcd


Automatic Propagation

dspatch_async lowers the QoS from user-interactive to user-initiated when no QoS class is given.

dispatch_async does not lower the QoS when dispatching to a thread with dedicated QoS.



2015 711_hd_networking_with_nsurlsession


App Transport Security settings in info.plist:


Alllow insecurity with certain servers:


- NSAppTransportSecurity

— NSExceptionDomains

—- example.com

—— NSIncludesSubdomains YES

—— NSEXceptoinRequiresForwardSecrecy NO

—— NSExceptionMinimumTLSVersion TLSv1.1

—- media.example.com

—— NSExceptionAllowsInsecureHTTPLoads YES


Force security with certain servers:


— NSAllowsArbitraryLoads YES

— NSExceptionDomains

—- secure.example.com

—— NSExceptionAllowsInsecureHTTPLoads NO


iOS 9, OS X 10.10 http to https is automatic


Log NSURLSession errors:

CFNETWORK_DIAGNOSTICS=1 (Log Level)


HTTP/2

- Needs only one TCP connection to host

- Fully multiplexed

- Requests have priorities

- Binary

- Header compression (HPACK)



HTTP/2 encryption connection only

HTTP/2 server requires ALPN or NPN support for protocol negotiation


NSURLSessionStreamTask improves over NSInputStream/NSOutputStream

Use NSURLSession to get through HTTP proxies and convert to NSURLSessionStreamTask when response is received.



2015 706_hd_security_and_your_apps


TLSv1.2 with forward secrecy mitigates bulk recording of encrypted network data.


Bei der asymmetrischen initialen Einigung auf einen symmetrischen Sitzungsschlüssel, wird dieser nie über die Leitung geschickt (Schlüsselaustausch mit Diffie-Hellmann) und nach der Sitzung auf beiden Seiten zerstört. Fällt der asymmetrische Private Key in falsche Hände, kann damit nicht der Sitzungschlüssel gefunden werden.


System Integrity Protection


One security layer failing shouldn’t defeat all security.


For iOS 9: No need to sign apple-app-site-association JSON. It is secured with a TLS connection.



2015 703_hd_privacy_and_your_app


Use extensions or universal links instead of canOpenURL.


iOS 9: Declare queried URL schemes for canOpenURL in LSApplicationQueriesSchemes.

Older apps on iOS 9 can call 50 schemes. Not restarted with device.


No access to kern.proc, kern.procargs and kern.procargs2.


Content Blocker Extensions applies to SafariViewController but not to UIWebView.


El Capitan: Cookies are local to single proccess and no longer shared.


Set purpose string in app’s info.plist for various protected data classes.



2015 209_hd_creating_complications_with_clockkit



2015 216_hd_layout_and_animation_techniques_for_watchkit


Expanding text with tap by (un)hiding the other text label.

Animating label in/out of a table row: Resize invisible spacer groups left or right..



2016 401_hd_whats_new_in_xcode_app_signing


Multiple development certificates possible.

Automatic signing in general tab.

No fix button but automatic reports.

PROVISIONING_PROFILE_SPECIFIER references profiles by name, no longer by uid. New developer or new device makes new profile necessary. Now, new profile is selected automatically.


2016 102_hd_platforms_state_of_the_union


lzfse 3x fast and 2x less energy zlib compression last year. Open source this year.

Working with Cisco to prioritize networks traffic for trusted devices and certain apps.

NSUserActivity tells the OS what people are doing in our app.

iOS App Content Extension can provide an arbitrary view for the expanded look of a notification.

New look for widgets in today view. Added compact fixed size for information density.

Widgets are available now from the home screen (force touch).

On watchOS full screen, complications and notifications GUI for app. Glances functionality replaced by dock. Simple design like glance should be used for primary interface because of the dock.

Background App Refresh APIs in watchOS 3.

GameplayKit



2016 219_hd_whats_new_in_uicollectionview_in_ios_10


These changes are about Collection- and TableViews.

Changed life cycle for cells to improve loading by prefetching.

iOS 10 does not load a row of cells at once but one after another to spread the CPU load.

Leaving cells are put into the reuse queue a little bit later in case the user scrolls back. This way only willDisplayCell will be called on it in this case.

Cells are loaded from the reuse queue a little earlier than on iOS 9. PrepareForReuse and cellForItemAtIndexPath are called that early too. And willDisplayCell is thus not called right after those two calls but after a little further scrolling when the cell enters the screen (like on iOS 9). This gives more time to build cells before they’re shown and they’re not built at once but after one-another because there’s now more time available. Cells in a row get only the willDisplayCell at once.

Prefetching and cancelling of prefetch in Collection- and TableViews. Both should be done on background queue (NSOperation or GCD).


To use the old lifecyle without prefetching enabled set isPrefetchingEnabled to false.


UIRefreshControl is now a property in UIScrollView, UITableView, UICollectionView.



2016 707_hd_introduction_to_notifications


New user notifications framework.

Same code path for local and remote notifications.

In-app presentation option of notifications.

Notifcation extensions to schedule and hanlde notifications.

Expanded content.

Same API for all platforms.

Local notifications on watchOS (without phone).

Notification have a subtitle field and media attachments.

Access to pending (local) and delivered notifications: remove, update, promote.

New HTTP/2 request header: apns-collapse-id.

Notification service extensions to change (augment, decrypt) visible remote notification content.



2016 708_hd_advanced_notifications


Notification service extension to download a referenced file and put it as attachement into the notification.

Attachements support images, audio and video. Also animated GIFs.


Notification content extension for custom UI in notifications. Custom view without user interaction. But UI can update on custom notification button actions. Action is delivered to a UNNotificationContentExtension to update UI and the notification dismissal can be delayed. After action handling, the notification can be dismissed and optionally forwarded to the app.

Notification extensions are associated with one or more notification categories in info.plist with UNNotificationExtensionCategory. UNNotificationExtensionDefaultContentHidden allows to hide the default notification content.

UNNotificationExtensionInitialContentSizeRatio to mitigate initial resizing.

UNTextInputNotificationAction enables the user to comment a notification. User input can be handled in an UNNotificationContentExtension.

Custom buttons for reply are possible through a custom overriding InputAccessoryView in UNNotificationContentExtension.



2016 724_hd_whats_new_in_the_apple_push_notification_service


Same certificate for application push, VoIP push, complication push, dev and prod environment. 

Coming in 2016: Simplified authentication by token authentication for push notifications by using JSON Web Tokens. No need to regenerate keys. Certificates remain working but are not needed. Provider tokens instead of client certificate.  

APNS requires token generation time within the last hour. Reuse it as long as it is valid. Then ExpiredProviderToken will be the returned reason.



2016 711_hd_nsurlsession_new_features_and_best_practices


Support for HTTP/1.1, SPDY, HTTP/2.

Use one/few sessions to serve many tasks for better performance and memory usage.

HTTP/2

- multiple requests in flight concurrently and responses received out of order all on the same TCP connection

- header compression

- stream priorities to tune what resources are returned from server with which priority

- server push, pushing additional responses to the client that are probably needed in future

Network statistics with NSURLSessionTaskMetrics, delegate method session: task: didFinishCollectingMetrics: of the NSURLSessionTaskDelegate.

TLS: RC4 no longer supported. Test:

nscurl https://insecure.example.com/

nscurl —enable-rc4 https://insecure.example.com/

For WKWebView: NSAllowsArbitraryLoadsInWebContent

NSRequiresCertificateTransparency for greater assurance the cert is legit.



2016 714_hd_networking_for_the_modern_internet


UTF-8 has not the problems of UTF-16/32 oder Punycode (used by DNS):

- Little or big endian?

- The lowest code points are the same as ASCII.

- Thus all 7-bit ASCII is valid UTF-8 with the same meaning.

- Higher code points use mulit-octect sequences and every byte shows what position it is and is encoded above ASCII.

- UTF-8 single octect (ASCII) begins 0, 1/2/3 leading 1s means first of 1/2/3 multi-octect sequence, 10 means continuation octect.

- No mid-string zero bytes (C string terminators).

- Byte-wise, sorts same order as raw Unicode.

- All internet protocols must be able to use UTF-8 (IETF 1998).

- WC3 strongly recommends content authors should only use UTF-8.


Email addresses are becoming internationalized.

Don’t try to vaidate email address input, only restriction is a @ has to be there, accept any user input and send validation email instead.


Wifi Assists solves the parking lot problem when walking out of range of Wifi.

Preflight checking for cell is instable since situation can change every second later.

Set intent instead with:

- CoreMedia API: AVURLAssetAllowsCellularAccessKey

- NSURLSession API: allowsCellularAccess

Subscribe for BetterRouteNotification and try again.


2016 715_hd_neural_networks_and_accelerate


Wrappers on Metal, functions for neural network computations.



2016 720_hd_concurrent_programming_with_gcd_in_swift_3


DispatchAsync on a queue and giving a DispatchGroup can help to wait for a group of work to finish, even if dispatched blocks are put on different DispatchQueues. Use DispatchGroup notify to trigger subsequent work on a chosen DispatchQueue then.

Create DispatchWorkItem from closures/blocks to control dispatch queue execution properties.

WorkItems have a wait method to indicate dependency to GCD; GCD will elevate priority of queued work ahead then.

In Swift only global variables are initialised atomically. Synchronization is not part of Swift 3.

Don’t use C lock types or mutexes in Swift, since Swift assumes they can be moved. Foundation.Lock can be used safely because it is a class.

Use dispatch queues for synchronization purposes. Easier and you cannot forget to unlock. Queues are better integrated with the runtime in Xcode in debugging tools. Access the data synchronously on a dedicated queue.

Queues have also more features: Dispatch preconditions for (not) on queue.

Setup, Activate (e. g. register observer here), Invalidate (for unregistering), Deallocation steps might be useful.

Removing observer in deinit/dealloc won’t work because that method is not invoked if the observer holds a reference to that object. Could be solved with weak reference if this is the only reference. But deadlocks can still happen.




2016 242_hd_whats_new_in_core_data


Generations of data prevent the “cannot fulfill fault” problem. Full read transactionality at context level (like write before). Old behaviour is option named unpinned (default). Or pin to first load or to specific generation. Nested context are unpinned and see the same as parent. 

Generation updated by setting a new generation token (explicit update), on save, by context mergeChanges() and by context reset(). Registered objects are not refreshed on generation update, has to context fetch() or refreshAllObjects().

NSQueryGenerationToken.current() to track generation. Context hast queryGenerationToken() and setQueryGenerationTokenFrom().

Context performBlockAndWait has now an autorelease pool.

Coordinator can handle multiple concurrent readers and single writer from contexts, previously serialized. No locks anymore on Coordinator level, only in SQLite. Critical section scope thus decreased.

Can now attach contexts to the same PersistentStoreCoordinator without performance problems and do standard merging, this shares rows cache reducing memory footprint (in contrast to fully separated stacks).

NSPersistentStoreDescription. Can add store asynchronously. NSPersistentContainer can further reduce setup code.

Core Data has replace/destroyPersistentStore() to avoid database corruption.



2016 417_hd_debugging_tips_and_tricks


Xcode run options have a switch to use Terminal for LLDB console.

Swift REPL is LLDB. :command will issue the command directly to LLDB.

In Swift REPL:

:type lookup xy (infos about xy)

:b 2 (break point line 2)

: (switch to lldb from repl)

repl (switch to repl from lldb)


Xcode 8 and LLDB are distinct processes, debugger version switched as needed.

LLDB initialization with ~/.lldbiinit and ~/.lldbinit-Xcode

p runs code once, po runs code twice: evaluates the expression and also evaluates code to print the customization.

Both can cause side effects because they run in the debugged process.

frame variable <local-name> show variable without running any code.

poarray/parray `count` dataset (shows full array)

po is an alias for expr -0

Swift needs: expr -0 —language objc — 0x1234… to explore memory addresses.

register read

up and down to switch frames in lldb (down is later, 0 is latest)

disassemble —frame


Stop on all methods implemented by a class:

(lldb) break set -r "\[ClassName \.*\]"


Stop on all functions in a given module:

(lldb) break set -r “.*” —shlib MyModule



2016 412_hd_thread_sanitizer_and_static_analysis


Address Sanitizer has now full support for Swift.

Instructions from source code can be reordered by the compiler or the CPU. The order of insttructions is not guaranteed. Trying to roll your own synchronization methods is not a good idea. Instead dispatch to the same serial queue with GCD.

In Swift, global variables and class constants have dispatch_once semantics (use that inherently).

Use the highest level API that is suitable to your needs, e. g. GCD over pthread API, NSLock.



2016 403_hd_swift_api_design_guidelines


Based on the coding guidelines for Cocoa. 

Make uses of your APIs read grammatically.

A lot of compiler mapping Objective-C and C to and from Swift.



2016 410_hd_visual_debugging_with_xcode


Runtime issues are detected in visual debugger for UI, threads and memory.

View debugging takes snapshots faster, layout and transform more accurat, blur rendering shown.

Jumping to source code from view class. 

Filtering by label, text in button title, class names, super class names and by memory address.

More auto layout properties in inspectors, non required constraints with dash lines, ambiguous layout issues at runtime shown.

Cmd-e for using selection for search.


2016 206_hd_whats_new_in_tvos


Selection shown by parallax effect. Create with Asset Catalog (Xcode), Parallax Previewer (Mac),  Parallax Exporter Plugin for Photoshop available at developer.apple.com.

Apps in first row participate in top shelf, it shows contents of the app and provides deep links.

Apps can be created with languages and frameworks from iOS, watchOS and macOS. Additionally TVMLKit which is template-based for rapid development. Easy building for content-centric apps by providing layout and focus management. Javascript for application logic. The Movies.app and the AppStore.app are built with it. 

Testflight is available for tvOS.

Full native development with UIKit useful for existing iOS app. See:

- Mastering UIKit on tvOS

- Focus Interaction on tvOS

TVMLKit with Javascript and XML for rapid dev of content apps. Can mix in UIKit because TVMLKit is built on it. See:

- Developing tvOS Apps Using TVMLKit: Part 1

- Developing tvOS Apps Using TVMLKit: Part 2

Apple TV Remote app (for iOS) works like Siri Remote and includes game controller layout.

Remote Notifications support content available and badge. 

UIKIt API for notifications prohibited on tvOS, use new UserNotification.framework. See:

- Introduction to Notifications

- Advanced Notifications

UITraitCollection has system appearance for light / dark. Opt-in for dark. Info.plist: UIUserInterfaceStyle Light/Dark/Automatic. In inspector can set color dependent on style, Storyboard preview and simulator support light/dark style.



2016 802_hd_designing_for_tvos



Stay 60 px from top and bottom and 90 px from the sides because of cropping on older TVs.

All assets have 1x resolution.

Resolution is fixed to 1920x1080.

Keep it simple: Only few choices, options, simple navigation. (psychological distance)

Big, bold fonts; big icons and spacing. (average distance is 10ft, 3m)

Put settings in system settings, people use settings only once.

Test layout and concepts with Airplay across the room on actual TV.

Zova, Reuters, Chameleon Run, Late Shift good example apps.



2016 212_hd_developing_tvos_apps_using_tvmlkit_part_1


The movies, tv shows, music, store, podcasts, search and more apps are built with TVMLKit.

Apps look, feel and perform like Apple apps by using TVMLKit.

For apps that let browse, interact with and consume caltalogues of content in a simple, consistent but unique way.

Template based natitve UI, performance tuned and optimized.

Can add own views and viewcontrollers to existing templates or created new templates.

It is not a web browser but optimzed nartive UI.

Typical TVMLKit apps have UIKit based app on tvOS device and JavaScript and media content on server.

Minute 19: Music app settings.


TVMLWWDCDemo is the app in use.

TVMLKit Catalogue for browsing samples.

Sample app in session is a video browser and player.

In TVMLKit JavaScript is responsible for user events (so, no gesture delay like with JavaScript on Web?)

Minute: 31: Music App: By adding appropriate item to top level menu bar presentation of now playing info (title, picture) is enabled.

TVMLKit supports also Slideshow and Multi-row Shelf and animatable search results (DOM) updates, embedded video, custom collection cells, image placeholders.



2016 229_hd_developing_tvos_apps_using_tvmlkit_part_2


Sample app is CustomElements.


Reusing existing code:

- Reuse existing view controller by registering a new TVViewElement for it.

- Host a TVMLKit navigation contoller as sub application.

- Host in separate UIWindow.


Extending JavaScript (inject code into JavaScript context of TVMLKit Application) :

- JavaScript llibraries loading at runtime (e. g. to speed up start up time by splitting large initial application.js file). TVMLKit allows loading addtional JavaScript files at any point in app life cycle. Executes in the global context.

- Calling with native code into JavaScript

- Briding native classes into JavaScrpt


JavaScript runs on its own thread separated from the main thread.

Use TVApplicationController and JSContext (use this only inside the passed block) to invoke JavaScript. See WWDC 2013 “Integrating JavaScript into Native Apps” for more.

JavaScriptCore is bridging simple types, own classes need JSExport protocol to enable bridging. Set this own bridging helper then on JSContext as object for some keyed subscript string to make that native class accessible to JavaScript.


Enhance TVMLKit Application:

- Extend templates using custom markup for own views, collection view cells.

- Host TVMLKIt inside native App.

- Use native view controllers inside TVMLKit.

- Extend Scripting Environment to bridge native classes, pipe application events or load additional JS libraries.


2016 236_hd_whats_new_in_auto_layout


Views without constraints get implicitly constraints during compile time.

In Auto Layout documents views without constraints can have autoresizing masks. These will be translated into constraints at runtime (not build time) to allow programmatic changes (by implicitly setting translatesAutorsizingMaskIntoConstraints = true).

On views with constraints autoresizing masks are ignored and translatesAutoresizingMaskIntoConstraints is false.


Placeholder constraints are useful to design something that is not known untll runtime.

Intrinsic Size placeholders are useful for custom controls.

You can turn off ambiguitiy per view when runtime constraints are added for sure.


NSGridView for Cocoa (not for iOS yet). Automatic and explicit sizing. Optional padding and spacing. Hidden rows and columns.

Merged cells.


Layout Feedback Loop Debugger.



2016 415_hd_going_serverside_with_swift_open_source


With Swift on server, share code, seamless development without language switching. Using well 

known APIs on server too.


Swift is no just Darwin-only language but for many platforms like Raspberry Pi, Windows and Android.


On Darwin, there’s an addendum called the overlay that aids system frameworks to interface better in Swift.

On Linux foundation and disptach to with Swift is provided by Apple.

You can build on Linux and Mac. Develop on Mac and deploy on Linux server. Continous Integration.


IBM Swift Sandbox runs in browser: Wirte, save code, see execute on server.

IBM Kitura, modular package based web framework for server side applications.


IBM Cloud tools for Swift, a Mac app to easily build end-to-end applications in Swift.

Develop client- and server-side projects in Xcode and use this tool to link and deploy them.



2016 706_hd_whats_new_in_security


NSURLSession and NSURLConnection APIs und TLS v1.2, strong crypte: AES-128 and SHA-2, forward secrecy: ECDHE (Elliptic curve Diffie–Hellman).


App Transport Security enforced by end of 2016, have to give reasons for exceptions.


NSAllowsArbitraryLoadsInWebContent allows HTTP in WKWebView.


RC4, SSLv3, SHA-1, 3DES disabled by default.


You can set NSRequiresCertificateTransparency inside NSAppTransportSecurity key in Info.plist to use public logs for better verifying certificates. Proofs required from at least two logs. See certificate-transparency.org


OCSP (Online Certificat Status Protocol) Stapling supported on all Apple platforms. Client has network delays and leaks privacy when asking the Certificate Authority server for status of every web server it talks to. So with OCSP the web servers deliver the validation they retrieved from a CA server to the client.

OSCP is backwards compatible. It is for certificate revocation.

Server with OSCP enabled can provide certificate transparency proofs in the same step.


SecKey AI for asymmetric keys, replaces CDSA calls and asymmetric SecTransforms.

CryptoTokenKit supports cryptographic devices.


Developer ID macOS apps can use iCloud features.


Gatekeeper enhanced to handle the repackaging problem that happens with apps that reach out to 

external code or code equivalent resources (libraries, plug-ins, scripts, local HTML with JavaScript that 

can access all of your system) that might not be signed.


The developer’s external resources can be exchanged by malicous content when repackaging the app with them. And the signed app will use the malicous external code. If this code is a dynamic library in a plug-ins directory, for example, the app can be easily compromised by repacking.


Repackaging problem affects app distributed by

- ZIP

- Disk Images

- ISO Images

- Other archive formats

- 3rd party installers

- Pulling resources from here and there to assemble the app


Not affected:

- App Store apps

- Signed Apple Installer package


Put resources inside the app bundle. Sign whole thing. Avoids repacking problem completely.


Solution for distributing App Bundle with resources inside the app bundle:

- Deliver via App Store

- Signed app in e. g. a Zip archive.

- Check the signatures are valid.

- Signed Apple Installer package


Solution for distributing container with apps and resoures:

- Use signed disk image

- Sign your disk image in macOS 10.11.5 or later (backwards compatible with older OS releases, signatures are embedded)

- Sign any content in the container, sign the container.


For licensing information use an extended attribute on bundle root, see tech not TN2206. Or sign a personlized Disk Image.

Do not modify app after signing and do not use an ISO image.


Gatekeeper Path Randomization to combat repacking problem:

- No change for App Store apps or previously run apps.

- Applies to newly downloaded apps and apps on unsigned Disk Images


When app is running it will be relocated into a randomized place in the file system and will not be able to access its external resources.


Does not apply to exlicitly moved single app bundle. Like moving the app itself to the Applications folder.

Mechanism is not turned off it the app is moved with something else.

Path Randomisation does not happen for signed Disk Images or signed Apple Installer package or App Store apps.


Sign what you deliver and check that things are valid.



2016 504_hd_whats_new_in_http_live_streaming


MPEG-4 Fragment support (with cross-ecosystem interoperability)

In-playlist metadata (live updates)

Offline playback for video downloads.



2016 402_hd_whats_new_in_swift


Swift 3 goals:

- Develop an open community

- Portability to new platforms

- Get the fundamentals right

- Optimize for awesomeness


Not verbosity or terseness but clarity is important.


When Swift imports Objective-C APIs it can make use of macros that the API developer has tagged the API with and import it in a more Swift like style.


Dedicated label for first function parameter. Since Swift separates method and parameters the Cocoa naming pattern does not fit with Swift. [Note: Objective-C does not have this problem since it has no parameter labels, the keywords in a method name are not parameter names but all part of the method’s identifier.]


Changes in Swift 3 syntax that make it easier to read than Swift 2 like moving the where clause to the end of function declaration.


Assigning to _ underbar to “use” a function’s return value, calling it just for a side effect.


Some features were removed from Swift 3 to make it more simply and less complex. [Note: Exactly that did i dislike in Swift 1 when writing http://www.macmark.de/dev/osx_dev_swift_check.php]



2016 416_hd_understanding_swift_performance



Depending on type variables are allocated on the Stack which can be cheaper than Heap.

Stack memory handling is simple changing the stack pointer. Heap needs more logic for finding suitable memory spots and needs reference counting and thread synchronisation.

Dedicated UUID type, enums and structs can help putting stuff on the stack.

Dynamic dispatch is not costly but in large numbers hard to optimize e. g. to inline for the compiler.

Protocol oriented programming brings polymorphism to structs to be the “better” class by sparing the V-Table dispatch. Instead it uses a Protocol Witness Table (PWT) to do dynamic dispatch without a V-Table, inheritance and reference semantics. One PWT per type that implements the protocol. 

To store different struct value types uniformely in an array Swift uses an Existential Container (EC) for boxing values of protocol types. Small values are inlined in Inline Value Buffer (VB) of EC, large values are stored on the heap and it stores a pointer to it in the VB.

Value Witness Table (VWT) manages lifetime of those values. One VWT per type.

Pointers to VWT and PWT are stored in the EC.

All this extra work is still better than classes and dynamic dispatch? They say yes because classes have the additional overhead of reference counting. The classes V-Table is probably as costly as the tables for these structs. But not reference counting and static invocation optimisation gives here better performance, they say.

Good advantage only for small value that can be stored inline without heap allocation and structs without reference counting. Dispatch through PWT costly like V-Table dispatch but gives dynamic polymorph behaviour.

Large values would need heap allocation thus they use copy on write with reference couting to match class performance.

Static (compile time) polymorphism. Creates type-specific version of generic methods.


2016 240_hd_increase_usage_of_your_app_with_proactive_suggestions


NSUserActivity to help iOS understand what the user looks at. The “eyes” of the OS.

schema.org, the same for the web.


Use MPPlayableContentDelegate with playableContentManager to have a rich GUI on lock screen instead the tiny icon in lower edge when iOS suggests the app. Needs iOS 9.3.


2016 223_hd_making_the_most_of_search_apis


Enhance native Spotlight content with CoreSpotlight.

iOS 10: “Search in App” feature in Spotlight. Takes the user into the app with the search query.

NSUserActivity can be searchable by setting eligibleForSearch and contentAttributeSet.displayName.


Indexing Universal Links:

- Allow Applebot in robots.txt, include domain in iTunes Connect

- Support Universal Links and Smart App Banners

- Markup website with schema.org or Open Graph to provide a rich display for attributes in your content

- Update app to properly open deep links

- Test URLs with App Search API Validation Tool

Reaches new users, results shown in Spotlight and Safari even without app.