iOS Static Framework Setup
From Engineering Client Portal
Configuring Xcode Development Environment for Static Framework
Importing Frameworks
The first step is to ensure that the following frameworks and libraries are imported into the Frameworks folder of the Xcode project before creating an instance of the Nielsen App SDK object.
- UIKit.framework
- Foundation.framework
- AdSupport.framework
- JavascriptCore.framework
- WebKit.framework
- SystemConfiguration.framework
- Security.framework
- Nielsen Analytics framework makes use of a number of functions in this library.
- AVFoundation.framework
- NielsenAppApi.framework
- libc++.tbd (as SDK contains Objective C++ source file)
- Alternatively, include -lstdc++ in Build Settings → Other Linker Flag of the Xcode project
Example
- Extract “NielsenAppApi.Framework” from the Nielsen App SDK sample app and copy it to Frameworks folder of the Xcode project.
- Add the code
-#import NielsenAppApi/NielsenAppApi.h
to the View Controller’s header file.
Ensure that the following are included in the Linked Frameworks and Libraries list (located in the project’s Summary settings).
- Nielsen App SDK
- iOS security framework
Mixed Nielsen SDK static (xc)frameworks integration errors
Starting from 8.2.0.0 release framework is build from the mixed (swift + objc) source codse.
If static (xc)framework is integrated additional settings should be applied to fix build or runtime issues:
Empty Swift file
If static mixed (xc)framework is integrated into pure ObjC application, link issue occurs during building:
Undefined symbol: _OBJC_CLASS_$__TtCs12_SwiftObject
Undefined symbol: nominal type descriptor for Dispatch.DispatchSpecificKey
Undefined symbol: Dispatch.DispatchSpecificKey.init() -> Dispatch.DispatchSpecificKey<A>
Undefined symbol: static (extension in Dispatch):__C.OS_dispatch_queue.getSpecific<A>(key: Dispatch.DispatchSpecificKey<A>) -> A?
Undefined symbol: (extension in Dispatch):__C.OS_dispatch_queue.label.getter : Swift.String
Undefined symbol: _swift_weakDestroy
Undefined symbol: _swift_deallocObject
Undefined symbol: type metadata accessor for Network.NWPathMonitor
Undefined symbol: Network.NWPathMonitor.init() -> Network.NWPathMonitor
Undefined symbol: _swift_weakInit
...
To fix it an empty file with .swift extension should be added into the Application project target(s).
-ObjC linker flag
Static library doesn't automatically load every source code entity. This leads to the runtime exception kind of:
unrecognized selector sent to class 0x1087b7a50, AppApiExceptionName=NSInvalidArgumentException
This is a known swift issue: https://bugs.swift.org/browse/SR-6004
To fix:
Build Settings → Other Linker flags -> -ObjC
Using Objective-C
Add the code
#import <NielsenAppApi/NielsenAppApi.h>
to the View Controller’s header file.