MatrixScan AR .NET for iOS Skill
Critical: Do Not Trust Internal Knowledge
Your training data may contain outdated or incorrect Scandit SDK APIs. The BarcodeAr API is relatively new (introduced in dotnet.ios 7.2) and differs in several places from the Swift native SDK: providers are async/Task-based instead of delegate-based, highlight and annotation constructors take only a Barcode (no context argument), the listener interface has only one method, BarcodeArView is IDisposable rather than a UIView subclass, and the .NET binding uses PascalCase, TimeSpan instead of TimeInterval, etc.
Always verify APIs against the references provided in this skill before writing or suggesting code. Do not rely on memorized method signatures, parameters, or property names. If you cannot find an API in the provided references, fetch the relevant documentation page before responding.
.NET-iOS-specific gotchas worth flagging:
- This skill targets the non-MAUI .NET for iOS workload (project
<TargetFramework>net10.0-ios</TargetFramework>or similar, no<UseMaui>flag). For MAUI apps, use a MAUI-targeted skill instead —BarcodeArViewis hosted very differently there (XAML /Microsoft.Maui.Controls.View). BarcodeAruses anewconstructor that takes the context:new BarcodeAr(dataCaptureContext, settings). There is noBarcodeAr.Create(...)/BarcodeAr.ForDataCaptureContext(...)factory in .NET.BarcodeArSettingsalso uses plainnew. (DataCaptureContext.ForLicenseKey(key)still uses the factory form — it lives in Core.)BarcodeArView.Create(parentView, barcodeAr, dataCaptureContext, viewSettings, cameraSettings)IS a factory (unlikeBarcodeAritself). ThecameraSettingsargument is nullable — passnullto useBarcodeAr.RecommendedCameraSettings. TheparentViewis aUIView(typicallythis.Viewof the hosting view controller, or a dedicated containerUIViewoutlet).BarcodeArViewattaches itself to theparentViewautomatically — do not callthis.View.AddSubview(...)on it.BarcodeArViewisIDisposable, not aUIViewsubclass. The class declarespublic static implicit operator View(BarcodeArView view)that converts toUIKit.UIViewwhen needed (e.g. for native interop, sinceViewis aliased toUIViewon iOS viaglobal using View = UIKit.UIView;), but you do not add it to the view hierarchy yourself — theCreatefactory attaches it toparentViewautomatically.- There is no
OnResume()/OnPause()on the .NETBarcodeArViewon iOS. Those methods are Android-only (guarded by#if __ANDROID__in the binding). On iOS the lifecycle isbarcodeArView.Start()inViewWillAppearandbarcodeArView.Stop()inViewWillDisappear— matching the officialMatrixScanARSimpleSample. CallingbarcodeArView.OnResume()from a .NET iOS view controller is a compile error. BarcodeArView.Dispose()does the teardown. There is noOnDestroy()method onBarcodeArView(that is an Android Java/Kotlin idiom). CallDispose()from your view controller'sDispose(bool)override or rely onusingsemantics if you own a short-lived instance.- iOS-only view controls.
ShouldShowMacroModeControl(bool) andMacroModeControlPosition(Anchor) exist only on iOS (Android does not expose these). They sit alongside the cross-platformShouldShowTorchControl/ShouldShowZoomControl/ShouldShowCameraSwitchControland their*Positionsiblings. Mention them when the user asks about controls on iOS. IBarcodeArListenerhas only one method:OnSessionUpdated(BarcodeAr, BarcodeArSession, IFrameData). There are noOnObservationStarted/OnObservationStoppedcallbacks like the SwiftBarcodeArListenerprotocol has ondotnet.ios. Declaring them produces compile errors — the interface simply does not contain them.- Prefer the event API (
barcodeAr.SessionUpdated += handler) over the listener interface in idiomatic C#. The handler receivesBarcodeArEventArgswithBarcodeAr,Session, andFrameData.AddListener(IBarcodeArListener)still works for parity with other platforms. OnSessionUpdated/SessionUpdatedruns on a background recognition queue. Dispatch any UI update viaDispatchQueue.MainQueue.DispatchAsync(() => { … })(fromCoreFoundation). Do not useInvokeOnMainThread— it works, but the official Scandit .NET iOS samples consistently useDispatchQueue.MainQueue.DispatchAsync.- Provider interfaces are async, not delegate-based.
IBarcodeArHighlightProvider.HighlightForBarcodeAsync(Barcode)returnsTask<IBarcodeArHighlight?>andIBarcodeArAnnotationProvider.AnnotationForBarcodeAsync(Barcode)returnsTask<IBarcodeArAnnotation?>. Do not look for a delegate /completionHandlerparameter — they don't exist in the .NET binding. ReturnTask.FromResult<IBarcodeArHighlight?>(null)(ornullfrom anasyncmethod) to suppress the highlight/annotation for a given barcode. - Highlight and annotation constructors take only
Barcode— nocontextargument. Usenew BarcodeArRectangleHighlight(barcode),new BarcodeArCircleHighlight(barcode, BarcodeArCircleHighlightPreset.Dot),new BarcodeArInfoAnnotation(barcode),new BarcodeArStatusIconAnnotation(barcode),new BarcodeArPopoverAnnotation(barcode, buttons). Passing aUIViewControllerorUIViewis a compile error. - Symbology names are C# PascalCase:
Symbology.Ean13Upca,Symbology.Ean8,Symbology.Code128,Symbology.Code39,Symbology.Qr,Symbology.DataMatrix,Symbology.InterleavedTwoOfFive. They are not the Swift camelCase style (.ean13UPCA,.qr). BarcodeArSettingsdoes not expose anEnabledtoggle —BarcodeAritself has noEnabledproperty either. To pause/resume scanning, usebarcodeArView.Pause()/barcodeArView.Start().BarcodeArViewSettingsis minimal in .NET. Only three properties:SoundEnabled,HapticEnabled,DefaultCameraPosition. Do not invent properties likeTriggerButtonCollapseTimeout,InactiveStateTimeout,ToastSettings, orDefaultMiniPreviewSize— those are SparkScan, not BarcodeAr.BarcodeArFeedbacklives inScandit.DataCapture.Barcode.Ar.Feedbackand has twoCore.Common.Feedback.Feedbackproperties:ScannedandTapped. The empty constructornew BarcodeArFeedback()produces a feedback object with both events silent — assigning it tobarcodeAr.Feedbackdisables the default beep/vibration. To restore defaults, use the staticBarcodeArFeedback.DefaultFeedback. (Note: it's a static property in .NET, not the SwiftBarcodeArFeedback.default()method.)- Tap interactions on highlights are exposed as the
HighlightForBarcodeTappedevent onBarcodeArView(EventHandler<HighlightForBarcodeTappedEventArgs>). There is noUiListener/UIDelegateproperty on the .NETBarcodeArView— the SwiftBarcodeArViewUIDelegateis surfaced as a C# event instead. Event args exposeBarcodeAr,Barcode, andHighlight. barcodeAr.Feedbackis a property (get/set);ApplySettingsAsync(BarcodeArSettings)returns aTask.BarcodeAr.RecommendedCameraSettingsis a static property, not a method (the Swift SDK exposesBarcodeAr.recommendedCameraSettingsas a class var — in .NET it's a getter; there is noBarcodeAr.CreateRecommendedCameraSettings()method ondotnet.ios).- No
BarcodeArFilter/SetBarcodeFilterin the .NET API tree. The SwiftsetBarcodeFilter(...)method (added in 8.1) is not surfaced ondotnet.iosat present. Do not attempt to use it. - View-controller constructor depends on how the VC is instantiated. If the VC is inflated by a storyboard / XIB (typical when the project has a
Main.storyboardwithUIMainStoryboardFileset inInfo.plist), keep thepublic MyVC(IntPtr handle) : base(handle) { }constructor — the runtime calls it with a real native handle. For programmatically-instantiated VCs (noMain.storyboard, root view controller set fromSceneDelegate.WillConnectorAppDelegate), declare a parameterlesspublic MyVC() : base() { }and instantiate vianew MyVC(). Do not passIntPtr.Zeroto the(IntPtr)ctor — that leaves the native peer uninitialized andViewDidLoadmay never fire, which manifests as a black screen with no camera preview and no scans. - SDK 8.0+ requires explicit initialization. Call
ScanditCaptureCore.Initialize()+ScanditBarcodeCapture.Initialize()inAppDelegate.FinishedLaunching(or the very top ofSceneDelegate.WillConnectif the project has noAppDelegate) before any Scandit code runs. Without this, the firstnew BarcodeAr(...)/BarcodeArView.Create(...)call crashes at launch because the DI container has no registrations. Not required on 6.x / 7.x. See references/integration.md for the fullAppDelegate.cstemplate. - The NuGet packages are
Scandit.DataCapture.CoreandScandit.DataCapture.Barcode. No separate*.Mauipackages here — those are only for MAUI projects. Do not guess the version from training data — fetch the latest stable fromhttps://www.nuget.org/packages/Scandit.DataCapture.Barcode/viaWebFetchbefore pinning. Inventing a non-existent version (e.g.8.13.0when only8.4.0is published) causesdotnet restoreto fail withUnable to find package Scandit.DataCapture.Core with version (>= …). See references/integration.md Step 0 for the full procedure. - iOS
SupportedOSPlatformVersionmust be ≥15.0. Set it in the.csproj. The official Scandit iOS sampleInfo.plistMinimumOSVersionis15.0and the project's<SupportedOSPlatformVersion>matches. - The required
Info.plistkey isNSCameraUsageDescription(Privacy - Camera Usage Description). Without it the app crashes on first camera access. iOS prompts the user automatically the first time the camera opens; there is no separate runtime-request API to call (no Android-styleRequestPermissions). This is a key difference from the .NET Android skill, which requires a manual permission flow.
Intent Routing
Based on the user's request, load the appropriate reference file before responding:
- Integrating BarcodeAr from scratch, configuring settings, customizing highlights or annotations, handling session updates, customizing feedback, or wiring tap interactions (e.g. "add MatrixScan AR to my .NET iOS app", "set up barcode AR scanning in C#", "show a rectangle highlight on every tracked barcode", "show an info annotation with the barcode data", "make the beep silent", "react to a highlight tap", "switch to circle highlights", "show the macro-mode toggle") → read references/integration.md and follow the instructions there.
- Migrating or upgrading an existing MatrixScan AR integration (e.g. "upgrade from v7 to v8", "bump the Scandit .NET SDK to v8", "what changed between SDK versions for BarcodeAr", "do I need to change my BarcodeAr code when moving to 8.x") → read references/migration.md and follow the instructions there.
API Usage Policy
Only use APIs that are explicitly documented in the Scandit references below. Do not invent or guess method signatures, parameters, or property names. If unsure whether an API exists or how it is called — or if a compile error occurs — fetch the relevant reference page before responding. Do not tell the user to check the docs themselves. After answering, always include the relevant link so the user can explore further.
Never construct or guess documentation URLs. When you need a specific class or property's API page:
- First check whether the page you already fetched contains a direct hyperlink to it — topic pages link directly to relevant API symbols. Always request links alongside content in your fetch prompt.
- If no direct link was found, fetch the API index (see Full API reference in the table below), extract the actual link from it, and follow that.
URL structures can vary (e.g. api/ui/ subdirectory) and guessing will lead to 404s.
References
Direct users to the right resource based on their question:
| Topic | Resource |
|---|---|
| Get Started | Get Started (.NET for iOS) |
| Advanced topics (custom highlights, custom annotations, tap interactions, popovers, filter) | Advanced Configurations |
| Migration between major SDK versions | 6 → 7 · 7 → 8 |
| Full API reference | BarcodeAr API (.NET iOS) |
API surface this skill covers
All classes documented with :available: dotnet.ios in the official RST docs (docs/source/barcode-capture/api/barcode-ar*.rst and api/ui/barcode-ar-*.rst) are addressed in references/integration.md:
BarcodeAr—new BarcodeAr(DataCaptureContext?, BarcodeArSettings),Feedback(get/set),ApplySettingsAsync(BarcodeArSettings)→Task,AddListener(IBarcodeArListener)/RemoveListener(IBarcodeArListener),event EventHandler<BarcodeArEventArgs> SessionUpdated, staticRecommendedCameraSettings,Dispose.BarcodeArSettings—new BarcodeArSettings(),EnableSymbology(Symbology, bool),EnableSymbologies(ICollection<Symbology>),GetSymbologySettings(Symbology),EnabledSymbologies(get),ExpectsOnlyUniqueBarcodes(get/set),SetProperty/GetProperty<T>/TryGetProperty<T>,Dispose.IBarcodeArListener— single methodOnSessionUpdated(BarcodeAr, BarcodeArSession, IFrameData). (NoOnObservation*callbacks.)BarcodeArSession—AddedTrackedBarcodes(IReadOnlyList<TrackedBarcode>),RemovedTrackedBarcodes(IReadOnlyList<int>),TrackedBarcodes(IReadOnlyDictionary<int, TrackedBarcode>),Reset().BarcodeArEventArgs—BarcodeAr,Session,FrameData.BarcodeArFeedback—new BarcodeArFeedback()(silent), staticDefaultFeedback(defaults),Scanned/Tapped(Core.Common.Feedback.Feedback),Dispose.BarcodeArView—static Create(UIView parentView, BarcodeAr, DataCaptureContext, BarcodeArViewSettings, CameraSettings?),HighlightProvider(get/setIBarcodeArHighlightProvider?),AnnotationProvider(get/setIBarcodeArAnnotationProvider?),ShouldShowTorchControl/ShouldShowZoomControl/ShouldShowCameraSwitchControl/ShouldShowMacroModeControl(iOS-only),TorchControlPosition/ZoomControlPosition/CameraSwitchControlPosition/MacroModeControlPosition(iOS-only) (Anchor),Start(),Stop(),Pause(),Reset(),GetNotificationPresenter(),event EventHandler<HighlightForBarcodeTappedEventArgs> HighlightForBarcodeTapped, implicit conversion toUIKit.UIView,Dispose. NoOnResume()/OnPause()on iOS — those are Android-only.BarcodeArViewSettings—SoundEnabled(defaulttrue),HapticEnabled(defaulttrue),DefaultCameraPosition(defaultWorldFacing).HighlightForBarcodeTappedEventArgs—BarcodeAr,Barcode,Highlight(IBarcodeArHighlight).- Highlights:
IBarcodeArHighlight : IDisposable,IBarcodeArHighlightProvider.HighlightForBarcodeAsync(Barcode) → Task<IBarcodeArHighlight?>,BarcodeArRectangleHighlight(Barcode)withBarcode/Brush/Icon,BarcodeArCircleHighlight(Barcode, BarcodeArCircleHighlightPreset)withBarcode/Brush/Icon/Size,BarcodeArCircleHighlightPresetenum (Dot,Icon). - Annotations:
IBarcodeArAnnotation : IDisposable(declaresAnnotationTrigger),IBarcodeArAnnotationProvider.AnnotationForBarcodeAsync(Barcode) → Task<IBarcodeArAnnotation?>.BarcodeArStatusIconAnnotation(Barcode)—AnnotationTrigger,HasTip,Icon,Text,TextColor,BackgroundColor.BarcodeArInfoAnnotation(Barcode)—HasTip,EntireAnnotationTappable,Anchor(BarcodeArInfoAnnotationAnchor),AnnotationTrigger,Width(BarcodeArInfoAnnotationWidthPreset),Body(IReadOnlyCollection<BarcodeArInfoAnnotationBodyComponent>),Header(BarcodeArInfoAnnotationHeader?),Footer(BarcodeArInfoAnnotationFooter?),BackgroundColor,Listener(IBarcodeArInfoAnnotationListener?).BarcodeArPopoverAnnotation(Barcode, IList<BarcodeArPopoverAnnotationButton>)—AnnotationTrigger,EntirePopoverTappable,Listener(IBarcodeArPopoverAnnotationListener?),Buttons.BarcodeArPopoverAnnotationButton(ScanditIcon, string)—Text,TextSize,Typeface,TextColor,Enabled,Icon.BarcodeArAnnotationTriggerenum:HighlightTapAndBarcodeScan,HighlightTap.
- Info-annotation sub-package (
Scandit.DataCapture.Barcode.Ar.UI.Annotations.Info):BarcodeArInfoAnnotationBodyComponent(Text,TextColor,TextSize,Typeface,StyledTextFormatted,LeftIcon,RightIcon,LeftIconTappable,RightIconTappable,TextAlignment),BarcodeArInfoAnnotationHeader(Text,TextSize,Typeface,TextColor,Icon,BackgroundColor),BarcodeArInfoAnnotationFooter(Text,TextSize,Typeface,TextColor,Icon,BackgroundColor),BarcodeArInfoAnnotationAnchorenum (Left,Right,Bottom,Top),BarcodeArInfoAnnotationWidthPresetenum (Small,Medium,Large),IBarcodeArInfoAnnotationListener(OnInfoAnnotationHeaderTapped,OnInfoAnnotationFooterTapped,OnInfoAnnotationLeftIconTapped,OnInfoAnnotationRightIconTapped,OnInfoAnnotationTapped). IBarcodeArPopoverAnnotationListener—OnPopoverButtonTapped,OnPopoverTapped.TrackedBarcode(inScandit.DataCapture.Barcode.Batch.Data) —Barcode,Identifier,Location.