Objective-C Facade
Use the AnsightObjC NSObject facade from Objective-C hosts and bridge layers for runtime lifecycle, telemetry, host connection, properties, metric streams, and visual-tree providers.
AnsightObjC is an Objective-C facade over the aggregate Ansight Swift product. Swift apps should use AnsightRuntime.shared directly; use this facade for Objective-C application code and bridge layers that require an NSObject API.
Install
With CocoaPods:
pod 'AnsightObjC', '1.3.0-preview.10'
The React Native bridge installs this facade through autolinking. A native Objective-C app can depend on it directly.
Initialize and Record Evidence
#import <AnsightObjC/AnsightObjC-Swift.h>
NSError *error = nil;
[ANSAnsight initializeAndActivateWithDefaultOptionsAndReturnError:&error];
[ANSAnsight recordMetric:42
channel:255
error:&error];
[ANSAnsight recordEventWithLabel:@"checkout"
type:@"Info"
details:@"loaded"
channel:255
error:&error];
The facade exposes:
- initialize, activate, deactivate, clear, and runtime status
- metric channel registration, metric streams, and point-in-time metrics
- timeline events, screen views, and lifecycle state
- enrollment-payload connection and connection results
- live client logs
- grouped session-property updates and clearing
- runtime snapshots
- visual-tree provider registration and source discovery
Connect
Pass the current enrollment QR payload acquired by the app:
[ANSAnsight connectWithPairingJson:pairingJson
clientName:@"Objective-C App"
completion:^(ANSHostConnectionResult *result) {
if (!result.success) {
NSLog(@"Ansight enrollment failed: %@", result.message);
}
}];
Custom Visual-Tree Sources
Objective-C hosts can expose an additional framework or renderer as a named visual-tree source:
NSDictionary *treePayload = BuildCustomVisualTree();
ANSVisualTreeProvider *provider =
[[ANSVisualTreeProvider alloc]
initWithSource:@"custom"
displayName:@"Custom Renderer"
getVisualTree:^NSDictionary *(NSDictionary *arguments) {
return treePayload;
}
inspectNode:^NSDictionary *(NSDictionary *arguments) {
return InspectCustomVisualTreeNode(arguments[@"nodeId"]);
}];
[ANSAnsight registerVisualTreeProvider:provider error:&error];
The source becomes available to ui.get_visual_tree and ui.inspect_node, and appears in registeredVisualTreeSources.
Return the shared compact visual-tree v2 contract: include a top-level types registry, use node typeId references, and supply semantic and presentation fields instead of legacy node-local type, kind, or styleId values.
Security
initializeAndActivateWithDefaultOptionsAndReturnError: uses the aggregate developer defaults and native tool suites. Keep AnsightObjC, enrollment UI, and broad tool access limited to approved development builds, following the same iOS Security rules as the Swift API.
Default initialization also enables native Crash Capture. Use the Swift AnsightOptionsBuilder integration when an Objective-C host needs to customize crash retention/handoff, cellular connection policy, unattended provisioning, or session JPEG visual-tree/keyboard options not surfaced directly by the facade.