Frameworks

RSS for tag

Ask questions about APIs that can drive features in your apps.

Posts under Frameworks tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

NWConnection WebSocket Protocol hangs on preparing for iOS 13 only
I have a critical issue where my websocket will not connect to a server that is sitting behind an NGINX reverse proxy only on iOS 13. I have tested on both a real device and simulator with no success. It simply hangs on preparing. it never receives updates to the viabilityUpdateHandler and only ever enters the preparing state of the stateUpdateHandler. On any iOS greater or equal to iOS 14 it works seamlessly. I can connect to a local server that is not dealing with any certificates on iOS 13 no problem, but when my production server is in play it does not communicate something properly. I am using NWConnection's NWProtocolWebSocket. The setup is basic and straight forward let options = NWProtocolWebSocket.Options() options.autoReplyPing = configuration.autoReplyPing options.maximumMessageSize = configuration.maximumMessageSize if configuration.urlRequest != nil { options.setAdditionalHeaders(configuration.urlRequest?.allHTTPHeaderFields?.map { ($0.key, $0.value) } ?? []) _ = configuration.cookies.map { cookie in options.setAdditionalHeaders([(name: cookie.name, value: cookie.value)]) } } if !configuration.headers.isEmpty { options.setAdditionalHeaders(configuration.headers.map { ($0.key, $0.value) } ) } let parameters: NWParameters = configuration.trustAll ? try TLSConfiguration.trustSelfSigned( configuration.trustAll, queue: configuration.queue, certificates: configuration.certificates) : (configuration.url.scheme == "ws" ? .tcp : .tls) parameters.defaultProtocolStack.applicationProtocols.insert(options, at: 0) connection = NWConnection(to: .url(configuration.url), using: parameters) The trust store is also straight forward public static func trustSelfSigned(_ trustAll: Bool, queue: DispatchQueue, certificates: [String]? ) throws -> NWParameters { let options = NWProtocolTLS.Options() var secTrustRoots: [SecCertificate]? secTrustRoots = try certificates?.compactMap({ certificate in let filePath = Bundle.main.path(forResource: certificate, ofType: "der")! let data = try Data(contentsOf: URL(fileURLWithPath: filePath)) return SecCertificateCreateWithData(nil, data as CFData)! }) sec_protocol_options_set_verify_block( options.securityProtocolOptions, { _, sec_trust, sec_protocol_verify_complete in guard !trustAll else { sec_protocol_verify_complete(true) return } let trust = sec_trust_copy_ref(sec_trust).takeRetainedValue() if let trustRootCertificates = secTrustRoots { SecTrustSetAnchorCertificates(trust, trustRootCertificates as CFArray) } dispatchPrecondition(condition: .onQueue(queue)) SecTrustEvaluateAsyncWithError(trust, queue) { _, result, error in if let error = error { print("Trust failed: \(error.localizedDescription)") } print("Validation Result: \(result)") sec_protocol_verify_complete(result) } }, queue ) sec_protocol_options_set_min_tls_protocol_version(options.securityProtocolOptions, .TLSv12) let parameters = NWParameters(tls: options) parameters.allowLocalEndpointReuse = true parameters.includePeerToPeer = true return parameters }
3
0
589
Aug ’23
Tap To Present ID (Data Request) - Possible Without Reader Token/Branding Configuration?
I am attempting to implement the Tap to Present ID (Data Request) feature and am wondering if the Data Request will succeed without a reader token. From the wording in the WWDC video (31:50 in WWDC2023-10114 video), it sounds the reader token is necessary, but the example is building off of the previous MobileDriversLicenseDisplayRequest example where the the reader token was used only for the branding to be displayed. In my app running on Simulator, I'm able to get the placeholder data to return from a MobileDriversLicenseDataRequest without using a reader token. Since I'm unable to test this on physical device (I don't live in a state that has Mobile ID's), I'm hoping an Apple engineer can comment on if the reader token is required strictly for the branding to be presented, and not for the Data Request itself to succeed. Thank you.
1
1
614
Aug ’23
Framework compatible issue
Hello everybody, I am a junior on iOS app development with Swift and Xcode IDE. I want to ask about the framework compatible issue. I got a framework called "RFIDBleFramework" which provided by vendor and this framework can help connecting to a RFID device and function well. After imported this framework to my project and build, I got the following error: "Failed to build module 'RFIDBleFramework'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.7.2 (swift-5.7.2-RELEASE)', while this compiler is 'Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)'). Please select a toolchain which matches the SDK." I want to know whether that means xcode for the same major, minor, and patch version of Swift(in this case, 5.7.2) still not compatible? Or I have some mistakes on import a framework? Sorry for my poor English, if there are some additional information required, I am willing to provide. Thank you for helping. My xcode version: Version 14.2 (14C18)
1
0
1.1k
Aug ’23
Code signing issue with SPM Dynamic Library
I have a framework (MyFramework) in which I want to use an existing dynamic framework via SPM (called now MyDynamicFramework). I included it as a package dependency and all seems to be good: Then, I created a test application in which I simply include my framework with Enbed & Sign. When I run this test application, it all works fine in simulator, but in real device I get the following signing-related issue: dyld[24248]: Library not loaded: @rpath/MyDynamicFramework.framework/MyDynamicFramework Referenced from: <ED356026-4AD8-3AD4-9CD7-BE977EE551E4> /private/var/containers/Bundle/Application/432B2A6D-55A7-4C9D-8EA2-622B81E215EA/MyFrameworkTestApp.app/Frameworks/MyFramework.framework/MyFramework Reason: tried: '/private/var/containers/Bundle/Application/432B2A6D-55A7-4C9D-8EA2-622B81E215EA/MyFrameworkTestApp.app/Frameworks/MyDynamicFramework.framework/MyDynamicFramework' (no such file), '/private/var/containers/Bundle/Application/432B2A6D-55A7-4C9D-8EA2-622B81E215EA/MyFrameworkTestApp.app/Frameworks/MyFramework.framework/Frameworks/MyDynamicFramework.framework/MyDynamicFramework' (code signature in <2BD920A5-1906-31B6-99B9-18DE47F02514> '/private/var/containers/Bundle/Application/432B2A6D-55A7-4C9D-8EA2-622B81E215EA/MyFrameworkTestApp.app/Frameworks/MyFramework.framework/Frameworks/MyDynamicFramework.framework/MyDynamicFramework' not valid for use in process: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.), '/Users/XXXXXXX/Library/Developer/Xcode/DerivedData/MyFramework-gedzmltwlpgatndvsrwkinsfgwhr/Build/Products/Debug-iphoneos/PackageFrameworks/MyDynamicFramework.framework/MyDynamicFramework' (no such file), ... Am I missing some settings? I thought that Embed & Sign should have solved the issue but it didn't. Thanks. It seems that it works if I embed the MyDynamicFramework in my test application as well, even thought that's already embedded into the framework (MyFramework) that I'm using. I don't see why should I do that, isn't that including the same dynamic framework twice?
0
0
584
Aug ’23
How to implement a search bar above the keyboard like Safari on iPad
How can I insert a UISearchBar in the middle of the shortcuts bar displayed above the keyboard on iPad? You insert custom shortcuts in the shortcuts bar using 'someTextField.inputAssistantItem' with 'leadingBarButtonGroups' or 'trailingBarButtonGroups' properties, but it has no 'middleBarButtonGroups'. If I add the search bar as 'inputAccessoryView', like 'someTextField.inputAccessoryView = UISearchBar()' it is added above the shortcuts bar.
0
1
429
Aug ’23
Flipped views & drawInRect behaviour on Sonoma
I've been running into an issue on Sonoma (currently running 14.0 Beta - 23A5328b). In my app, I have a class derived from NSView that draws an image. Up until now, the image has shown up in the proper location & with the correct orientation based on the overridden value of "isFlipped" along with the value of respectFlipped in drawInRect, but with Sonoma it's not working properly. As an example, in macOS 11.7 (Big Sur), I have my NSView-derived class, and some drawing code like this (I've hard-coded the rectangle's coordinates for ease of testing): [image drawInRect:NSMakeRect(10, 10, 48, 48) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0 respectFlipped:NO hints:nil]; In Big Sur, here's what I see: isFlipped returns NO & respectFlipped is NO: the image gets drawn near the bottom-left corner of the view & is oriented properly. isFlipped returns NO & respectFlipped is YES: same as case 1 isFlipped returns YES & respectFlipped is NO: same as case 1 isFlipped returns YES & respectFlipped is YES: the image gets drawn near the bottom-left corner & is flipped. In Sonoma, here's what I see: isFlipped returns NO & respectFlipped is NO: the image gets drawn near the bottom-left corner of the view & is oriented properly. isFlipped returns NO & respectFlipped is YES: same as case 1 isFlipped returns YES & respectFlipped is NO: the image gets drawn near the top-left corner & is flipped. isFlipped returns YES & respectFlipped is YES: the image gets drawn near the top-left corner & is oriented properly. The current code uses case 3 - isFlipped returns YES, but respectFlipped is set to NO. As such, the image that was appearing in the bottom-left corner in its correct orientation is now in the top-right corner & is flipped. I'm considering switching to case 1, but other parts of this view rely on isFlipped returning YES, so I'd have to redo a bunch of positioning math that we currently use. Anyway, I'd be interested to know if anyone else has encountered issues with flipped views & drawToRect calls in Sonoma.
2
0
561
Sep ’23
Documentation about MediaExtension framework vanished
A while ago there was documentation published about the apparently upcoming MediaExtension Framework that was announced to be included in macOS 14 (Sonoma). However, when I recently tried to look it up again, I noticed that all documentation about it now leads to "Not found" pages, even though it still appears in search results. https://developer.apple.com/documentation/mediaextension/ Was this accidentally unpublished or will it not be included in macOS 14 and was therefore removed from the documentation?
0
1
425
Aug ’23
framework or spm
Hello everyone, I have code in swift that wraps and implements using xcframework the login to the application, I also have files for the bridge that communicate between react native and native ios code, which inherit from RCTEventEmitter: one for declaring the methods in objc and others for implementing them that communicates between My code for the third party xcframework library. I need to take the files above (xcframework, bridges files: objc+ swift ) and my code in swift and export them to a unit that can use it in my project that can also interface with React with the bridge files and other applications in our company. I'm really at a loss as to what is best to use, spm or a framework, is spm good for an objc file and xcframework and will a lib like RCTEventEmitter be needed to import to this unit, or a framework that is scalable, dynamic and can fit? Thanks a lot in advance if you can give me any information about these and how to make this SPM or framework according to my needs? And what is the most correct and best practice?
0
0
413
Sep ’23
auval gives me bad hedaches with 3rd party framework
Hi guys, I’m building an audio unit and I need to add a 3rd party framework. Validating the AU with Logics plugin manager fails saying it could not find the framework. It says it is neither in /System/Library/Frameworks nor under @rpath. Then it was complaining that @ path expansion violates security policy. Logic will still load the plugin fine, if I force it to use it, though, which seems weird. Then I exchanged the @rpath reference in the AudioUnit with install_name_tool. That worked but told me that it had to break code signing. When I re-ran auval, the “not found” errors went away, but it still could not be loaded, supposedly because of the broken signing. Btw, I could only get detailled information about auvals complaints if I ran Logic and thus the scanning process inside the debuugger. If I did the same thing outside the debugger, auval would only say something like 'could not load, result code 0xSomething' but not give me any details. In both cases Logic would still load the plugin if forced to. What should I do here? Cheers and thanks in advance :-)
1
0
605
Sep ’23
XCFramework codesigning - expired identity behaviour
Xcode 15 introduces a feature where you can see if an XCFramework is signed - (see here) What is the behaviour when the identity expires? For example, do the app developers who have integrated the XCFramework require a brand new XCFramework which is signed with a new, valid identity? Or is there a way to address the expiration without any action from the app developers at all?
1
0
769
Sep ’23
Network framework crashes on fork
Hello, I have a Cocoa application from which I fork a new process (helper sort of) and it crashes on fork due to some cleanup code probably registered with pthreads_atfork() in Network framework. This is crash from the child process: Application Specific Information: *** multi-threaded process forked *** BUG IN CLIENT OF LIBPLATFORM: os_unfair_lock is corrupt Abort Cause 258 crashed on child side of fork pre-exec Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_platform.dylib 0x194551238 _os_unfair_lock_corruption_abort + 88 1 libsystem_platform.dylib 0x19454c788 _os_unfair_lock_lock_slow + 332 2 Network 0x19b1b4af0 nw_path_shared_necp_fd + 124 3 Network 0x19b1b4698 -[NWConcrete_nw_path_evaluator dealloc] + 72 4 Network 0x19af9d970 __nw_dictionary_dispose_block_invoke + 32 5 libxpc.dylib 0x194260210 _xpc_dictionary_apply_apply + 68 6 libxpc.dylib 0x19425c9a0 _xpc_dictionary_apply_node_f + 156 7 libxpc.dylib 0x1942600e8 xpc_dictionary_apply + 136 8 Network 0x19acd5210 -[OS_nw_dictionary dealloc] + 112 9 Network 0x19b1beb08 nw_path_release_globals + 120 10 Network 0x19b3d4fa0 nw_settings_child_has_forked() + 312 11 libsystem_pthread.dylib 0x100c8f7c8 _pthread_atfork_child_handlers + 76 12 libsystem_c.dylib 0x1943d9944 fork + 112 (...) I'm trying to create a child process with boost::process::child which does basically just a fork() followed by execv() and I do it before the - [NSApplication run] is called. Is it know bug or behavior which I've run into? Also what is a correct way to spawn child processes in Cocoa applications? As far as my understanding goes the basically all the available APIs (e.g. posix, NSTask) should be more or less the same thing calling the same syscalls. So forking the process early before main run loop starts and not starting another NSApplication in forked child should be ok ...or not?
3
0
1.2k
Sep ’23
Clarification on Privacy Manifest Requirements for Fraud Detection and Prevention
I work for a company that specializes in providing fraud detection With Apple's recent announcement regarding the introduction of privacy manifests, we are want to ensure that we are fully compliant with all requirements and standards. Our company provides third-party libraries for various businesses to integrate into their platforms, primarily to detect and prevent fraudulent activities. This data is solely used for fraud detection and prevention, and not for advertising or any other purposes. Given the outlined context, we seek clarity on the following points: As a third-party library provider focused on fraud prevention, do we need to disclose the specific data points we collect under the new privacy manifest requirements? Are there any particular considerations or exemptions for companies that use data exclusively for security and fraud prevention purposes and not for advertising or other unrelated functionalities? Same questions but regarding required reason API I have wrote the support but did not get any message back, so want to try my chance on the forum
2
0
603
Sep ’23
Building an xcframework with MacOS and Mac Catalyst support
Using xcodebuild, I have built (and archived) several variations of a framework with the following destinations: 'generic/platform=iOS', 'generic/platform=iOS Simulator', 'generic/platform=macOS', 'generic/platform=macOS,variant=Mac Catalyst' I now wish to combine the frameworks into an xcframework using the -create-xcframework switch to xcodebuild. As arguments I am passing an instance of each Archive and the framework to xcodebuild. For example: xcodebuild -archive mycode_ios.xcarchive -framework mycode.framework -archive mycode_ios_simulator.xcarchive -framework mycode.framework [... others here ...] -output mycode.xframework With the destinations above I get an error message: A library with the identifier 'macos-arm64_x86_64' already exists. I assume that the macOS framework and the Mac Catalyst framework are conflicting with one another as they share the same platform and architectures. For that matter I guess the iOS simulator may also be considered macOS with those architectures. How are the "library identifiers" generated and is there a way I can ensure the Mac Catalyst, MacOS, and iOS simulator identifiers are distinct? Perhaps I do not need to? Then what is the minimum set of frameworks I would need to support MacOS, Mac Catalyst, iOS (device) and iOS Simulator in one xcframework?
1
0
820
Sep ’23
Making https://github.com/pksprojects/ElasticSwift into an XCF is a living hell
Hello, I have been pulling my teeth out for the past days trying to make this tool into an XCF to cut down on CI time cos caching SPM in azure devops pipelines takes forever (potato download speed etcetc) So.. step 1: Make a framework project and add ElasticSwift from pods pod 'ElasticSwift', :git => 'https://github.com/msavoaia/ElasticSwift.git', :tag => 'v1.0.3' pod 'ElasticSwiftCore', :git => 'https://github.com/msavoaia/ElasticSwift.git', :tag => 'v1.0.3' pod 'ElasticSwiftQueryDSL', :git => 'https://github.com/msavoaia/ElasticSwift.git', :tag => 'v1.0.3' pod 'ElasticSwiftCodableUtils', :git => 'https://github.com/msavoaia/ElasticSwift.git', :tag => 'v1.0.3' pod 'ElasticSwiftNetworking', :git => 'https://github.com/msavoaia/ElasticSwift.git', :tag => 'v1.0.3' (this is a fork I use but you can use the original, it's all the same because the issue is not in Elastic swift but one of its dependencies, swift-nio) or you can add SPM package https://github.com/pksprojects/ElasticSwift Step 2: build fine on device/sim Step 3: try xcodebuild archive -configuration Release -project "ElasticSwiftDRM.xcodeproj" -scheme "ElasticSwiftDRM" -destination 'generic/platform=iOS Simulator' -archivePath "./build/iphonesimulator.xcarchive" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES (project or workspace, depending if you're using SPM or pods). Step 4: realise swift-nio can't be built with BUILD_LIBRARY_FOR_DISTRIBUTION=YES Step 5: cry All i want is this damned elastic swift as an XCF... please help
0
0
236
Sep ’23
how to create xcframework from swift package which has binaryTarget
I am a new developer for iOS. I have a swift package with three modules (A, B, C). A is the product Module A is written in Swift, module B is in objective C, module C is binary target. B is A's dependency, C is B's dependency. How to create xcframework to release as SDK for this swift package? Thanks a lot. Here is the package.swift: let package = Package( name: "A", platforms: [.iOS(.v14), .macOS(.v11)], products: [ .library( name: "A", targets: ["A"] ) ], dependencies: [ // .package(url: /* package url */, from: "1.0.0"), ], targets: [ .target( name: "A", dependencies: ["B"] ), .target( name: "B", dependencies: ["C"], publicHeadersPath: "include" ), .binaryTarget( name: "c", url: "url", checksum: "checksum" ), .testTarget( name: "ATests", dependencies: ["A"] ) ], cxxLanguageStandard: .cxx11
0
0
392
Sep ’23