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.

Filter by
Sorted by
Tagged with
0
votes
1answer
14 views

how to make sure threads get unlocked properly

in this code based on my readings unlock does not make sure the threads get unlocked in the same order they got locked. Is this statement right?. What is the best synchronization scheme to make sure ...
0
votes
1answer
27 views

How to make sure my timer run is race free

This is not the actual code, only to provide the idea behind the logic in actual code. Do I need a Mutex, mylock2 ,inside the timer function?. The timer runs every 0.02 seconds. Or, the timers are ...
0
votes
0answers
6 views

open an especific app from notification Action Button on IOS?

I am working in a piece of functionality for an IOS app (with objective C) with local notifications using UserNotification framework. By now, I was able to schedule a notification and It gets display ...
0
votes
0answers
6 views

How can we create shared instance for SceneDelegate [duplicate]

We are used to create shared instance of AppDelegate class. Like : + (AppDelegate *)sharedInstance { return (AppDelegate *)[[UIApplication sharedApplication] delegate]; } Now from Xcode 11, ...
0
votes
0answers
9 views

What is the “direct-parameter” in ObjC / Apple Events

I'm currently reading through sdef files with the mindset of creating a TypeScript library generator for OSAScript. In the command tags I am often seeing a distinction between direct-parameter and ...
0
votes
0answers
19 views

NSAlert not visible if open near screen edge in macOS Catalina

For windows located near the screen edges: On some monitors (or computers) NSAlert opened as a sheet on a window moves the window to make the alert sheet visible. But on some others monitors (or ...
-1
votes
0answers
28 views

Is it Possible to Merge Objective-C Project with SwiftUI Project

I am working on a project with a group of developers. They created a part of the app with objective-C, including UI, model, and controllers. I am using Swift on my end, and recently I've began using ...
0
votes
0answers
8 views

Is it possible to interrupt NSURLSessionDownloadTask after getting headers, before start getting data?

I have NSURLSessionDownloadTask, loading large file. Trying to check if it was modified since the specific timestamp on the server. Server (over which I have no control) doesnt seem to support If-...
0
votes
0answers
12 views

handling firebase direct channel notifications on background on IOS?

I am developing a framework (with objective C) that receives data messages from FCM (no content, soun or badges just simple data) and inside this framework I will make the translation to local ...
0
votes
0answers
29 views

pass completion block from swift to back to objective

Trying to get completion block back from swift code, but looks like I'm doing something wrong. My objC code which I want to replicate for my swift view controller BMPSSecurityQuestionViewController ...
0
votes
1answer
54 views

Add objects in a NSMutableArray and use it multiple times in my project (Objective C)

I am new to Objective C, I'm trying to add objects to NSMutableArray and use it multiple times in my project. I have a Model class: MainTarget.h @interface Target1 : NSObject @property (strong, ...
1
vote
3answers
47 views

How can I throw an NSError from a Swift class and catch it in an Objective-C class?

I need to implement a try-catch structure in Objective-C to handle Swift thrown NSErrors. I've written an NetService manager with Swift code and I am implementing it on an already existent Objective-...
0
votes
0answers
13 views

Referencing class directive inside .h file

I am following some tutorials to learn how to use the storyboard in xcoe with objectivec. however, i found that that tutorial is referrig to @class inthe @ interface file .h file!! I tried to google ...
1
vote
0answers
26 views

Separating real and dummy windows returned by CGWindowListCopyWindowInfo

I am creating a window switcher for macOS. I am using CGWindowListCopyWindowInfo to get the list of open windows. let windows = CGWindowListCopyWindowInfo([.excludeDesktopElements], ...
0
votes
0answers
17 views

Searchbar disappears from tableview header after Cancel button click

I've changed searchDisplayController with searchController for ios 8 support in my app where i use Objective-C. it works perfectly at the first try, but whenever i click on cancel button on search ...
-1
votes
0answers
14 views

Attachment from iOS app to Outlook using Objective-C [on hold]

I want create button "email copy" to outlook but can't found any solution to pass file from my app(iOS) to outlook. Button in my app should send file to outlook application, also it can be any sdk to ...
0
votes
0answers
12 views

How to properly close a FFmpeg stream and AVFormatContext without leaking memory?

I have built an app which uses FFmpeg to connect to remote IP cameras in order to receive video and audio frames via RTSP 2.0. The app is built using XCode 10-11 and Objective-C with a custom FFmpeg ...
0
votes
1answer
24 views

Use Custom UIView as IBOutlet in .xib

I have a custom class inherited from UIView @interface StatusBarView : UIView @property (weak, nonatomic) id <ActivationStatusDelegate> delegate; //MARK: init - (id) initWithCustom: (struct ...
0
votes
0answers
15 views

Xcode 10.1 error Could not build module 'GooglePlaces'

I'm facing an import issue in my Xcode. I have googled and followed the steps in the following link. iOS : Could not build module <framework-name> But Still I'm not able to rectify the error., ...
-6
votes
0answers
45 views

How can I implement screen offset with code? [on hold]

I want to create an offset like the one showed on the picture. There is a left black bar offsetting the desktop itself. I want to implement this by code and not to be limited only to left -> right ...
0
votes
2answers
25 views

How to add UIButton on WKWebview?

I have two viewcontrollers which the viewcontroller1 has a NSTimer countdown to 0 and present viewcontroller2. The viewcontroller2 has a wkwebview, and I also want to add UIButton on it. Because I ...
0
votes
0answers
6 views

iOS/Theos GraphicsServices Events are not sent

I am trying to build a tweak to lock the screen programmatically but it seems like I'm doing something wrong. I know there other tweaks doing this and some are even open source, so I literally copy-...
1
vote
1answer
43 views

Cannot load a local html file into a WKWebView on device only (works on simulator)

The local code below loads into a WKWebView a local HTML file (from the app container, not the app bundle). - (void)loadIndexConteneurWithHash:(NSString *)hash { NSString *fileName = @"index.html"...
0
votes
1answer
29 views

Cannot load local html file into WKWebView on ios device (not simulator) [duplicate]

I'm having troubles with the following code. It's supposed to load a local HTML file into a WKWebView. It works fine on any simulator I've tried (ios 12 / ios 13). For a reason I do not understand ...
-1
votes
0answers
11 views

PHAssetCollection.localizedTitle returns key instead of value

I'm trying to get albums titles: PHFetchResult *smartAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum subtype:PHAssetCollectionSubtypeAny options:nil]; ...
0
votes
0answers
11 views

Firebase dynamic link not open in development app while app is not in appstore

I am working on dynamic link objective c as i have tested my app is configure fine in firebase but when I am share my product with other user they tap on url its open in web browser instead of ...
-1
votes
1answer
26 views

Error: Manually adding the rootViewController's view to the view hierarchy is no longer supported

I upgraded to Xcode 11.1 and trying to compile an older Objective C app that programmatically sets the rootViewController. How do I work around this error? - (BOOL)application:(UIApplication *)...
-2
votes
0answers
17 views

How to integrate a unity app to iOS app using a server to download package of game? [on hold]

I want to know there is a possibility to download a package of game and just play it using a server of file?
0
votes
0answers
16 views

Disable editing of a NSTextFieldCell on right clicking on a row

I've got a view based NSTableView with a NSTextFieldCell inside. If I select a row and then right click on the same row, the table view puts the field into edit mode after a short delay! Right ...
0
votes
0answers
14 views

NFC “Tag connection lost” object-c

Im trying to send data to an NFC tag. But I'm getting a stack error with codes 100. Here is the code I'm using. NFCISO7816APDU * iso = [KSNFCAPDUManager resumeCardWalletWithModel:self.model sPass:@"...
-1
votes
1answer
35 views

why sending RGBA data in a BGRA pipelineDescriptor work?

My MTKView is in BGRA and I setup my pipelineDescriptor in BGRA like below : pipelineDescriptor.colorAttachments.objectAtIndexedSubscript(0).setPixelFormat(MTLPixelFormatBGRA8Unorm); now the ...
0
votes
1answer
20 views

How to function dispatch_group?

I am using dispatch_group in my code, but it's functionality not cleared to me. I have used below code: 1.dispatch_group_t group = dispatch_group_create(); 2.dispatch_group_enter(group); 3.[self ...
0
votes
0answers
16 views

What is correct way of validate the URL string and loading it in WKWEBVIEW based on responses with status code like 200… in IOS Objective-C?

I have Strings like https://www.google.com,htpps://www.tempalate-name1 and need to validate those strings are valid or not, loading it in wkwebview and validating it based on responses with status ...
0
votes
1answer
38 views

tel: url scheme showing as action sheet in ios 13?

How to show tel url scheme as alert in ios 13 I want make a call from app so i am using te url scheme it is presenting as alert below ios 13 but from ios 13 it is displaying as action sheet [[...
-1
votes
1answer
46 views

How to get a device timezone using Swift [duplicate]

In my scenario, I am trying to get current device timezone name. I seen many enables related to Objective C but didn’t get exact solution using Swift. I need to get a names like ADT, IST, PST. Get ...
0
votes
2answers
27 views

NSTimer don't stop when I present another viewcontroller

I have a viewController1 setting a timer. When the timer countdown to 0, I'll present viewController2. The timer also keeps going, although I call the timer function invalidate Then I mark present ...
-1
votes
0answers
24 views

Detect iPhone Lock State when application is not running

We are monitoring region and doing certain process in background. I need to allow the process only when the device is unlocked. Is there any way to identify the device state in this case?
1
vote
1answer
12 views

Why WKWebView doesn't apear in screen ? ( objective c )

I'm trying to add a UIView and WKWebView in a ViewController , I added programmatically with constraints. UIView is showing and positioning well without any problem but WKWebView appear only for 0,5 ...
-1
votes
0answers
12 views

Create directory programmatically(Objective c) in iOS app and get directory data into the iMessage extension

I would like to create a directory programmatically(Objective c) in an iOS application and want to get the directory in my iMessage extension. We download the image from the server and save it into ...
0
votes
0answers
16 views

Problems with launching via XPC. XPC error : Connection interrupted

I am trying to run my cocoa application from root with Objective-c, when I run it very first time after starting Xcode it runs properly, but as a stop the application and run again it show me error - "...
1
vote
0answers
18 views

Animating a UIPopoverPresentationController view's center position

Overall my goal is to present a custom UIViewController over the screen as a sort of "widget". The view would animate by starting out with its center at a starting point in my root view and then move ...
-3
votes
1answer
33 views

how to convert completion viewcontroler code from objc into swift

I need to make init for my view controller in swift. so how can I make similar init method in swift. - (instancetype)initWithFormlyData:(NSDictionary *)json afterUpdatingProfile:(void (^)(BOOL, ...
0
votes
0answers
21 views

How to save game progress for different devices?

I have a simple word game that I just put up on the App Store. The games progress is saved from session to session on my iPad and iPhone 7 plus but not on iPhone XS Max. So, the code is working for ...
1
vote
1answer
50 views

Call String extension including function written in Swift from Objective-C

When an extension in Swift just uses a variable as follows: extension NSString { var isNumber: Bool { return length > 0 && rangeOfCharacter(from: CharacterSet....
0
votes
0answers
19 views

How to reference private instance variable in main.m

I am leaning objective-c, and as shown below in the code, I created an interface with a private instance variable section. In the main.m, a pointer instance variable was created as shown below. what I ...
0
votes
0answers
11 views

What is the purpose of mentioning @interface notation is important in .m file [duplicate]

I am leaning how to build an iOS app in objective-c. i used to split the .h and .m files. However in the pdf I am following the author split dboth of them , but moreover in the .m file he added the ...
0
votes
1answer
34 views

define a delegate that not get dereferenced?

Right now I am implementing FIRMessaging for receiving notifications from Firebase Cloud Messaging. I made a test by creating a new project into firebase console, then registered my bundle ID, I ...
0
votes
0answers
16 views

NSTableView Remembers old Ordering

I have added some Columns in the .xib file. They are standing in the order they should be shown. https://i.imgur.com/DTd1v3F.png But because i have played around with Reordering it remembers that ...
0
votes
1answer
26 views

How to set custom width of tableViewIndex?

I want to change width of tableViewIndex. I didn't find any tableView's method to increase width of tableViewIndex programatically. I have written this method: - (CGFloat)...
0
votes
0answers
16 views

Is there an API that will run on iOS in order to change the Frame Per Second of an existing video?

I am looking for a way to receive as an input any video (that is supported on iOS) and save on the device a new video with a new Frame Per Second rate. The motivation is to decrease the video size, ...