Collect all kinds of ios programming exceptions and fault solutions.

Memory leak when initializing @ObservedObject inside View

I have a ViewModel class that is an ObservableObject and I initialize it when initializing its corresponding view. It seems that if I have any bindings to the ViewModel inside the view, the ViewMod...

How to increase tappable area of navigationBarItem in SwiftUI?

I have this code for my view
struct ContentView: View {
var body: some View {
ForEach(0...5, id: \.self) { note in

What is the best way to make decisions in iOS with Swift

I want to make a simple app with a simple AI.
I did allot of research and found some articles about decision-trees, Rules and behavior-trees.
I saw a video of the WWDC2016 where the new GKDecision...

UILabel Text Not Appearing on Some Devices for iOS

This problem appears to only affect the iPad Mini 5 and the iPad Mini 4. Not the iPhone 11.
It's only the UILabel fields text. It's only on the Device, not on the Simulator.
The text display fine on

Facebook SDK: UINavigationController has no member 'push'

I am using Facebook's SDK to allow a user to sign into my App using Facebook. The log in button works perfectly. It allows the user to log in and out and the right profile is found. However, when the

How to switch programmatically to dark mode swift

How can I make a switch to change programatically to dark or light mode in my iOS app?
I'm using Swift.

Updating/Changing root view controller after initially opening app for iOS13+

I'm trying to update the root view controller from ViewController() to fourYearPlan(). When the user initially opens the app, they are greeted in ViewController() and led to a TableViewController()...

What is PassthroughSubject & CurrentValueSubject

I happen to look into Apple's new Combine framework, where I see two things
PassthroughSubject<String, Failure>
CurrentValueSubject<String, Failure>
Can someone explain to me what is

Spoof location iPhone with flutter

I have been looking for a package that spoofs/mocks location with flutter for iPhone but have not been able to find any. Does one exist or is it only possible through swift?

Hitting iOS assertion when dismissing ViewController containing WKWebView displaying a PDF

I'm hitting an iOS assertion when dismissing a UIViewController. The UIViewController has a UIView, to which I've added a WKWebView. Into that WKWebView I've loaded a PDF file. The PDF displays ...

Authorization failed: Error Domain=AKAuthenticationError Code=-7026 "(null)" UserInfo={AKClientBundleID=my bundile id}

Authorization failed: Error Domain=AKAuthenticationError Code=-7026 "(null)" UserInfo={AKClientBundleID=my bundile id}
I have the same issue. I enabled the sign in with apple capability both devel...

UITableView Slow to load when using UIView.snapshotView

I'm quite new to Swift programming. Currently I'm implementing kind of notebook application for iPads. Each page of the notebook corresponds to a UIView. We can draw anything on the page and we can...

Webapp in iOS opens popup when outside scope

Since Apple iOS 13.1+ all webapps without the proper manifest and/or scope directive will be left with a popup IN the webapp when changing URL's. When the manifest is OK and holds the right scope (...

iOS 13 [Add to Home Screen] and [Hide Toolbars]

In previous iOS (12 and before) or any Android phone, we are able to use the [Add to Home Screen] in Safari (or any browser in Android) and hide the toolbars of a PWA by using the following techniq...

Load a completely static collection view cell?

With a UITableView, say you know there will only ever be a few unchanging items (say, 10 items) in the table.
Simply on storyboard, you can click "make table static".
It will never reload...

SwiftUI | Using onDrag and onDrop to reorder Items within one single LazyGrid?

I was wondering if it is possible to use the View.onDrag and View.onDrop to add drag and drop reordering within one LazyGrid manually?
Though I was able to make every Item draggable using onDrag, I...

How to change the size of a UISlider thumb when seeking

I'd like to make my UISlider thumb size change while I scrub the slider, much like how the seeker works in Apple Music or Spotify. Is this possible to do with a vanilla UISlider? Any pointers on ho...

React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:

I am new to react-native ios development. I am getting an error at run time.
error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:

Flutter MethodChannel from iOS to Native not working

I have a Flutter project trying to establish two-way communication between Flutter and iOS Native. So far it's working perfectly from Flutter to iOS, but the other way around it's silent. When I ca...

'UNLocationNotificationTrigger' is not available in Mac Catalyst

I'm trying to port an app to MacOS via Catalyst but I've immediately hit a roadblock.
UNLocationNotificationTrigger not being available in MacOS makes complete sense. You're not wandering about wit...

How to obtain photo data/metadata after being picked in PHPickerViewController?

In the app I work on, I am being tasked with a requirement to present the user their device photos using a PHPickerViewController.
Once selected, I need access to:
The original image data
The file...

Constraint Outlet position

I have an issue with an imageOutlet on a view controller (First picture), it seems that it's constraints issue. I thought I have not set up properly the constraint on the GoalsVC, but after multi...

Apple subscription or in-app purchase not working in store version - inApp-products details not displaying or getting

Last week we have submitted an App that had in-app purchase for one product. The app & in-app product got approved and got a mail from the apple. Then We tried to subscribe to the product, but ...

Send Http.MultipartRequest as array in flutter?

this is how i am post in data to server
var request = new http.MultipartRequest("POST", uri);
request.fields['property_id'] = property_id; //value from

Safety of using an empty reference instance across multiple threads

I have a class Data that stores multiple input parameters and a single output value.
The output value is recalculated whenever one of the input parameters is mutated.
The calculation tak...

Why does masked image pixel RGB values show original image RGB values in IOS image masking?

I am working on image processing mobile app with segmentation technics. I try to get masked image and succeed it. However when I want to save the masked image to my photo album original image is sa...

react native 063 ld: library not found for -lDoubleConversion

Since I updated my project to 0.63 whenever i build for profiling the app errors on
ld: library not found for -lDoubleConversion
When I run the app normally it works perfectly.
My pods has at the ...

Archive with SDK issue: bitcode bundle could not be generated

I got stuck trying archive my app for deployment. While archiving I got the following error:
bitcode bundle could not be generated because

Flutter - My keyboard pops out, out of nowhere and when it shouldn't?

I have a problem in my app...
I have an game app that needs to implements players at the beginning of the app. So in the first page called PlayerSelectionPage, you can add players to the game. Then...

Get user-added parameter from Firebase Dynamic Link iOS

I have Firebase Dynamic Link with custom parameter id
How can I get id parameter in app?
Or how is it possible to get this url

Converting Dictionary data to JSON format with Swift 5

At play ground I used following code to convert dictionary data to
create JSON file. It worked but not exactly as I wanted.
var topLevel: [AnyObject] = []
var myDict : [String:Any] = [:]
myDict [&...

xcrun from XCTest on iOS

Is it possible to execute an xcrun simctl command from XCTest when targeting iOS?
This is possible when the target is macOS via Process(), but that doesn't exist for an iOS Test Host. And trying to

Hide StatusBar And NavigationBar On MainView But Show It On DetailView In Swift

I've written two SwiftUI Views like below. In here, I want to;
Hide statusbar and navigation bar on mainview
Show StatusBar and NavigationBar on DetailView
But when I implement it like below,

Questions about CocoaLumberjack

How do I remove the extra timestamps that appear? I'm already using a custom formatter and they still appear in my console, but not in the log files.
How do I change the save directory to somewhere...

passing data (json) to another controller in swift 5.2 con Alamofire

I have a Login view that asks for a card and password. I consult an API and if the entered data is correct, it sends me a JSON like this. Which return has the button method? How do I send that data...

Not able to fit UIView to the full size of UIViewController when using FreeForm as Simulated Size in XCode 11

I made a freeform UIViewController of width 1875 and height 667. I am not able to fit the UIView to the full size of the UIViewController. But it is maxed out at 712 * 627. I checked all the similiar

swift infinite scrolling for loading previous chat history

As a iOS developer I need to fetch my chat messages seamlessly in a chat room using Swift 5.2
When it comes to implementation, I apply loading previous messages on cellForItemAt. This makes user sc...

How to programatically stop a ReplayKit 2 system broadcast without RPSystemBroadcastPickerView

I am trying to implement a broadcast upload extension and I want the user to be able to click a button in my app to stop the broadcast.
As far as I can tell from the docs, the only ways to stop a s...

RemoteIO Unit remove background noise

Is there a way to remove background noise from audio samples coming from microphone(RemoteIO Unit) like Apple does it in AirPods during phone call? Which AudioUnit is most effective to achieve this?

Form in SwiftUI, position the user picture like in the setting of IOS using swiftUI

How can I put the image in the Form of swiftUI in order to have the same effect like the picture attached?
I have try with this code, but not working:
struct UserDetails: View {

In Swift why would a Struct/Class with stored property of type Protocol won't conform to Codable by default?

Below code compiles fine (Swift 5.0+)
import Foundation
protocol PriceType: Codable {
var value: Double {get set}
var currency: String {get set}
struct Price: PriceType {
var value:

How can I access Height of inside tableviewcell in the maintableviewcell in swift

I am new in swift and I am unable to access the height of inside UITableviewCell in main UITableviewCell.
in my main tableviewcell my code in cellforrowatindexpath my code is like this

IOS efficient wake word method

I used the speech recognition framework to implement wake word in my app, but it turns out that it's a high battery impact solution, because it is always listening to the mic input.
I tried looking...

Firebase: How to get email from sign in with apple on real device?

I'm implementing a sign in with apple, this is my code on apple button press
onAppleButtonPress = async () => {
// performs login request
const appleAuthRequestResponse = await appleAuth.

How to round the UITextField topRight and bottomLeft corners in Swift

I want to round the corner of UITextField topLeft and bottomRight.
func conerRounderTextField(sides: CACornerMask) -> UITextField {
let tf = UITextField()
tf.backgroundColor = .white

AVAudioFile (Mac/iOS) : encode audio to constant bitrate AAC

I would like to encode audio buffers to M4A/AAC file using AVAudioFile. It works except that the output file is always AAC with a variable bitrate, even when I configure the AVAudioFile with specific

Flurry send test push message stopped working

In my project sending Flurry campaigns to a specific iOS device using Push Token stopped working suddenly.
I have previously configured Flurry with an Apple Push Services certificate for production...

iOS: pair a Bluetooth peripheral in my app, instead of using Settings

The Question
I'm writing an app for a Bluetooth peripheral, and I want to pair the peripheral to the iPhone directly in my app, without asking the user to go the Settings app and do the pairing man...

How to fetch live photo or video from PHPickerViewController delegate

Apple's new iOS 14 PHPickerViewController delegate receives only an NSItemProvider. The 2020 WWDC video shows how to get from there to a UIImage:
let prov = result.itemProvider

How to cover all branches of function with #available statement with XCTest

I have a function with an #available statement and would like to cover all branches with a unit test using XCTest. Is that possible?
func foo() -> String {
if #available(iOS 13, *) {