Questions tagged [objective-c]
This tag should be used only on questions that are about Objective-C features or depend on code in the language. The tags [cocoa] and [cocoa-touch] should be used to ask about Apple's frameworks or classes. Use the related tags [ios], [macos], [apple-watch] and [tvos] for issues specific to those platforms.
290,566
questions
0
votes
0answers
5 views
Importing Swift classes from a react-native-library into an example app written in Objective-C
Background
I am building a react-native-library created from @react-native-community/bob with Swift for iOS and Kotlin for Android. The template provides an example app to test the module/library ...
-2
votes
0answers
8 views
how to implement simple screen recording in 2020?
is it possible to also overlay the UIWindow on the screen recording so that it doesn't go into the recording? (objective-c)
0
votes
0answers
23 views
How to deserialize binary formatted file from Objective C or Swift
I have a file and which is serialized into Binary format using the below C# code.
MemoryStream memStream = new MemoryStream();
BinaryFormatter binaryFormatter = new BinaryFormatter();
...
0
votes
0answers
18 views
Different compile times on Xcode - clang
When we are archiving our iOS app after cleaning the build folder, total compile time of archive process is 1700-1900 seconds.
After a few mins, still the same codes nothing is changed, and there is ...
0
votes
0answers
22 views
bringSubviewToFront does not work on custom button's subview [duplicate]
I have a custom button that initialized with a custom image of on top corner.
I am not able to bring that imageview to the front;
Hierarchy;
Initializing with the badge as;
- (instancetype)...
-2
votes
1answer
20 views
How to view the data stored in NSData?
I am pretty new to Objective C. I am analyzing the iOS App code and using xCode, I kept debug pointers and I am actually trying to view the data stored in an NSData variable.
But I am seeing the below ...
0
votes
0answers
16 views
AVMutableComposition in swift crashes
I am trying to merge musics in my app. I am using
AVMutableComposition
if there is a 2 or 3 musics then it works great.
but if there is more than that it crashes at
let composition:...
0
votes
1answer
25 views
UITableview buttons getting highlighted on scroll
I have toggle buttons in my tableview cells and I click them on for some cells but when I scroll down, those same buttons are selected for the bottom cells as well even though I didn't select them yet....
0
votes
1answer
16 views
NSKeyedArchiver deprecated method problem
Just a little background info. I lost my ability to speak a few years ago and learned how to code specifically to make a good text to speech app for myself. Amazingly a lot of others find it useful. ...
0
votes
0answers
16 views
C API to register a callback when iphone app will go to background
I have a small c library that needs to do some cleanup when the app will enter background. How can i do that in C/C++. In Objective-C and swift it seems there are ways to register callbacks.
iOS13 or ...
0
votes
1answer
14 views
Textfield insdie UITableViewCell
I have a textfield and two buttons inside a tableview cell and when you click on the textfield, it opens up a pickerview to make a selection. What I want is that, the user should only be able to click ...
1
vote
0answers
20 views
Missing required module when importing a framework that includes a nested internal framework
I have two Xcode 11.3.1 projects:
MyFramework: for generating a framework from Swift and Objective-C source files of mine. This source code uses OpenSSL framework, so MyFramework is a framework that ...
0
votes
0answers
13 views
Simulate phone call on hands-free to play audio files with AVAudioPlayer
Many older cars have no option to play music from external bluetooth devices (A2DP), they are only able to handle phone calls (hands free). But some navigation apps are able to play sounds simulating ...
-1
votes
1answer
23 views
Correct way to pass NSError from URLSession
I have Network layer class, which has method with URL request. Seems like this:
- (void)networkRequestWithError:(NSError *__strong *)responseError
andCompletion:(void (^)(NSData*))...
0
votes
0answers
9 views
Facing 'The default FirebaseApp instance must be configured' issue in swift iOS
In our project, we are using muliple targets and we have enabled the Target membership to two targets for appDelegate class. While running the below podfile in multiple targets i am facing the crash ...
0
votes
0answers
7 views
ARKit plane detection and visualisation won't work
I have an app, where I want to combine React Native, a WebView, and ARKit. So I stacked three views on top of each other with this code:
#import "AppDelegate.h"
#import <React/RCTBridge....
-1
votes
0answers
26 views
How to display one month steps count to Swift from an Objective C? [closed]
We have this new task wherein, we are going to change the interface of the mobile app. Below is the sample of the new Home Screen Design.
The HomeView Screen is where I will display the steps count ...
-1
votes
0answers
13 views
how to secureTextEntry interval in objective c? [closed]
I want to give the spacing between secureTextEntry in uitextfiled.
The circle of the secure text entry is attached. I want to give a space between the cost circles.
•••••• > • • • • • •
How ...
0
votes
0answers
17 views
NSTableView scrollbar
The NSTableView I created with Xib. On some machines or on some versions, the scroll bar on the view will cover the content, but the normal performance is that it will not be obscured. I set the ...
0
votes
2answers
32 views
How to get correct width of a UIView inside UITableViewCell?
I added a UICollectionView inside UITableViewCell. I am trying to set the collectionView.collectionViewLayout.itemSize.width equal to a UIView pageContainerView.bound.size.width inside table view cell....
0
votes
1answer
21 views
How to know if Objective C pointer is of `Class` type?
I would like to know if a pointer in my program is pointing to a Class type.
Something like:
if ([anObject isKindOfClass:[Class class]]])
This an error because [Class class] does not exist.
The ...
0
votes
0answers
10 views
[NSProgress cancel]_block_invoke crash, maybe in AFNetworking
I got 118 crash reports (from a single user) via Firebase:
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000010
Crashed: com.apple.root.background-qos
0 Foundation 0x18287a4b4 ...
1
vote
1answer
41 views
Objective C long bridged to Swift as int?
I can't bridge ObjectiveC long type into Swift.
//Swift
typealias Long = Int64
struct Item: Equatable {
let itemId: Long
...
}
//ObjC
@interface MyObject : NSObject
@property(nonatomic, ...
0
votes
0answers
15 views
Adding images to url outlook scheme in objective c
I am trying to attach an image or insert it in the body of the ms-putlook scheme.
I tried to do it like this:
for item in ITEMS {
for photo in item.photosCollection{
let htmlBody = &...
0
votes
0answers
31 views
current time as maximum time in UIDatePicker [closed]
If I need to show current date as maximum date then I can achieve it by doing following:
[self.dtPicker setMaximumDate:[NSDate date]];
but my requirement is to show only time formate(HH:mm) in ...
0
votes
0answers
26 views
When i turn on secure text entry for my UITextField the text is invisible
When I turn on secure text entry for my UITextField the text is invisible, If I turn it off I can see the text again.
I'm testing this on physical device and when I'm typing I can see only one letter ...
-1
votes
0answers
25 views
Apple documents said 'occasional' and 'frequent' but how can decide the difference? [closed]
From Apple Document (Threading Programming Guide), there is a note
Although good for occasional communication between threads, you should
not use the performSelector:onThread:withObject:waitUntilDone:...
0
votes
1answer
24 views
Objc headers - Fonction & protocols declaration
I've been programming on swift for a few years now, but I've only recently tried to understand better Objc.
I am doing a small project on my own, using VIPER architecture. I have a sample .swift ...
0
votes
0answers
31 views
Is it safe to consume a C library built with older version of Xcode?
We build and deploy a dynamic framework targeting iOS that contains Objective-c code. It consumes a "core" (our terminology) static library that contains C/C++ code. But we only consume it ...
0
votes
1answer
16 views
The Step by Step of an Appcelerator iOS Module with OpenCV Framework
Since there is no (at lest not good) documentation about the implementation of an Appcelerator iOS Module that uses the OpenCV Framework, I decided to ask this question and answer it with the most ...
0
votes
1answer
18 views
SwiftUI Widget: 'Expected a type' error on UILabel argument in an imported Objective-C header file
I'm encountering a build error when importing an Objective-C class (via bridging header) into my SwiftUI widget extension target.
The Objective-C class defines a method method which accepts a UILabel ...
0
votes
0answers
18 views
iOS restore subscription button not always working
I have an iOS app with a non-auto subscription. I added a restore button to the app to allow user to restore their subscription if they install the app on another phone. However users are experiencing ...
0
votes
0answers
14 views
Create Status Bar menu item from NETCore on macOS
I am creating an application for MacOS with .NET Core 3.1 and Avalonia UI framework. And faced a problem, that Avalonia doesn't have TrayIcon/StatusBar implementation for macOS yet. In this fact, I ...
1
vote
1answer
15 views
Linker error when using Swift ObservableObject from Objective-C
I am trying to use a Swift class from Objective-c (as I do for many other classes) with the following error.
Undefined symbol: OBJC_CLASS$__TtC9FileCloud18BrowserCoordinator
The issue seems to be ...
0
votes
0answers
23 views
Not able to scroll UITableView and didSelectRowAtIndexPath is not called [closed]
In my iPad app, I have a TableView with each row with another TableView with custom cell. This inner tableView could scroll horizontally and selecting this row would fire a delegate with selected item ...
2
votes
1answer
28 views
Objective C block syntax - Xcode autocomplete is not working
Some OBJECTIVE-C blocksyntax help, please.
This is my call site (AppDelegate) - autocompleted by XCode
Objective-C
[SwiftClass passValue: response completion:^(NSDictionary<NSString *,NSString *&...
-1
votes
0answers
16 views
Swift & Unity header file not found
My end goal is to run a model using CoreML and pass the results back to Unity. Right now I am starting small and trying to call a basic swift function in Unity..
The expected result is to have the ...
0
votes
0answers
13 views
Clear Video exif or GPS information in a video file in Objective-C
I'm trying to clear all exif and GPS data from a video file in iOS, there was an answer for image, but I can't really find any for a video file. Using the suggested answer for removing those ...
0
votes
1answer
29 views
How to check the PDF size before uploading in iOS?
I have a requirement of uploading PDF file which is not more than 2 MB. Right now I am using the UIDocumentPickerViewController to browse the PDF files. Is there any way to check whether the PDF's ...
1
vote
1answer
45 views
Read binary files without having them buffered in the volume block cache
Older, now deprecated, macOS file system APIs provided flags to read a file unbuffered.
I seek a modern way to accomplish the same, so that I can read a file's data into memory without it being cached ...
0
votes
1answer
38 views
How to programmatically set Desktop Background to solid colors in os x?
How to set a solid color as background in os x desktops programmatically?
Have found the way to change it programmatically using the image.
[[NSWorkspace sharedWorkspace]setDesktopImageURL:url ...
0
votes
1answer
16 views
How to register device token for Urban Airship SDK latest versions?
In the older versions of SDK we can register device token using below SDK delegate methods.
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(...
1
vote
0answers
112 views
iOS IDFA AppsFlyer - Events Won't Log
In an app I am working on we are using Appsflyer to track events in the app.
We are using Appsflyer for years now, but since March 2020 we stopped seeing events in the console.
In Android App ...
-1
votes
0answers
41 views
Broadcast iPhone home screen
I am looking for the solution, where i can broadcast my Iphone Screen and get each frame buffer.
I am using
RPScreenRecorder *screenRecorder = [RPScreenRecorder sharedRecorder];
[screenRecorder ...
0
votes
0answers
14 views
AVMutableComposition not showing frames on simulator but works fine on device
Following is a simple two video merging code using AVFoundation's AVMutableComposition. I use two different mutable tracks for two videos and manage their layer opacity according to time:
import UIKit
...
-1
votes
0answers
38 views
How to use unarchivedObjectOfClass: fromData: error: when decoding two customize classes
currently I learned to use [NSKeyedArchiver archivedDataWithRootObject:requiringSecureCoding:error] to encode Data and use [NSKeyedUnarchiver unarchivedObjectOfClass:fromData:error:] to decode Data. (...
0
votes
0answers
13 views
Setting “text” property of UITextField in Swift code from Objective-C method
My iOS Swift app has also a file with Objective-code and its header.
An alert is created and displayed in Swift code, this alert has a TextField:
alert.addTextField(configurationHandler: nil)
let ...
0
votes
0answers
35 views
How to reference an array from another function Objective-C
I have declared array in SomeClass.h It's a global variable isn't it?
@property (nonnull, nonatomic, retain) NSMutableArray *additional_tabs;
Below I declared 2 function where I use this array.
- (id ...
0
votes
0answers
16 views
Differences in memory management between Release and Debug build configurations [closed]
I am working on an old project for a client. I did this project back in 2011 or 2012 using Objective C, and the Sparrow Framework.
Of course now, when I resurrect the project with Xcode 11 the app ...
1
vote
0answers
43 views
Converting an NSBitmapImageRep to NSImage
I'm flipping between NSImage and NSBitmapImageRep(because only NSBitmapImageRep lets me find-replace colors per-pixel, but only NSImages can be used in a NSImageView/NSImageCell's setImage). I know ...