Questions tagged [cocoa]

36941 questions
0

votes
0

answer
2

Views

how to install skype web plugins in webkit?

I want to make audio and video call from skype, skype i have loaded using url https://web.skype.com/ in webview but audio and video options and disabled in webview for that i think i need to install web plugins of skype so how do i acheive that I followed this and this but that doesn't seem to help...
zack
1

votes
2

answer
82

Views

bundleAtPath gives me the wrong path

I've put a actual folder inside my app project and i would like to get the content of the folder out. I've tried the code below, but it always sends me to my home directory on my computer. How do you get to root level in your app? NSArray *test = [[NSFileManager defaultManager] contentsOfDirectoryAt...
Niels Sønderbæk
1

votes
2

answer
154

Views

How can I make my app behave like I'm changing Application is agent(UIElement) at runtime using Swift?

I am coding a Mac app that is an NSPopover on the right side of the menu bar (Application is agent(UIElement) is set to YES). I allow the user to detach the popover by clicking and dragging it downward, which puts the app inside of a window. This is working fine; however, when the app is dragged of...
W. Cook
1

votes
2

answer
64

Views

Passing an object to a ViewController from AppDelegate

In my application, a Connection object is initialized in my AppDelegate.swift, applicationDidBecomeActive(). How do I pass that Connection object to my ViewController subclass?
coiax
1

votes
1

answer
46

Views

Change CALayer properties: EXC_BAD_INSTRUCTION

I'm trying to implement selection of a subLayer by clicking on it and visualize that it is had been selected by for example changing the background color of the subLayer. However, I end up with the following error whatever and however I attempt to change any property: Thread 1: EXC_BAD_INSTRUCTION...
user29809
1

votes
2

answer
55

Views

Cocoa class member variable allocated inside function call nil unless forced to init/load

I come from a C/C++ background and am currently learning a bit about Cocoa and Objective-C. I have a weird behavior involving lazy initialization (unless I'm mistaken) and feel like I'm missing something very basic. Setup: Xcode 10.1 (10B61) macOS High Sierra 10.13.6 started from a scratch Cocoa pro...
JLL
1

votes
2

answer
58

Views

How can I get DispatchQueue() code to cleanup on application exit

I have a process running in a DispatchQueue which creates a temporary file. The file is deleted in a defer block so the clean up occurs regardless of whether an error is thrown or I just return from process() normally. See code below func process() throws { let file = createTemporaryFile() defer { d...
Spads
1

votes
1

answer
36

Views

cocoa app exit code wont execute even if i had sleep thread

i'm trying to save the peferences on my application on app exit but the code wont run i tried diff code and same result func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply { // print(arrayOfUsernamesList) UserDefaults.standard.setValue('prefs1', forKey: 'prefer...
bibble triple
1

votes
2

answer
2.8k

Views

iPhone No Saved Photo Album created on iPhone

I am using iPhone 2.0 SDK. I used the API UIImageWriteToSavedPhotosAlbum to save an image. A Saved Photos album gets created on the iPhone Simulator when I save an image but tested on the device the image gets added in the Camera Roll album. While debugging, no errors occur but the Saved Photos albu...
Neo
1

votes
1

answer
892

Views

Is there a way for me to check if a song exists on the iPhone? [closed]

Can i see if a song exists on the phone? This is for when i'm loading up the app, so i can see if they've removed the song or not.
Andrew
1

votes
2

answer
318

Views

Can Text Fields Auto-Recognize Phone Numbers and Links?

Is it possible for a text field to auto-recognize phone numbers and links? I think I've seen such options somewhere, but I forget where.
user4951
1

votes
1

answer
1.3k

Views

NSTableView Delegate Called But Data not showing

i have a very strange problem with NSTableView in XCode 4.2. I've set the datasource an delegate for the table. My table has 3 columns where each of the column has an identifier ('name','mugshot','lastSeen'). My delegate -(id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableCol...
Martin
1

votes
2

answer
1.5k

Views

Don't change NSButton appearance when pressed or disabled

I have two NSButtons with images for both their on states and off states. Only one should be active at a time; click one and then click the other to change a property back and forth. The problem is that if I disable a button when it's clicked so it cannot be clicked again, then the image is dimmed w...
Chad Schultz
1

votes
0

answer
567

Views

Cannot read and write Userdefaults in sandboxed app

I sandboxed my app and since then I´m getting the following errors: 2017-12-29 19:31:19.649922+0100 Testapp[74854:12059315] [User Defaults] Failed to read values in CFPrefsPlistSource (Domain: testapp, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null)): accessing preferences outside an...
Josch Hazard
1

votes
1

answer
359

Views

WKWebKit does not refresh webpage

I am using Xcode 8.3.3 and Swift 3 to develop an app for the iMac using Cocoa. My goal is to use VCgoToWebPage and display a webpage to the user. My program calls this function many times, but the only webpage I see is the last one called. How do I implement a window refresh inside this function and...
TurboPascal
1

votes
0

answer
104

Views

Presenting a specific view controller messes up the app on device (works on simulator)

I'm facing a very weird bug. I have a button and I'm pushing a view controller normally, using segues. However, when I push the view controller the whole app layout messes up: it sometimes works, sometimes glitches such as leaving me with a blank view with nothing but the tabbar, or previous view co...
Can Poyrazoğlu
1

votes
1

answer
30

Views

iOS, leftButtonItem 'are you sure?' approach to confirming exit from screen approach?

I'm trying to figure out the standard approach or the best approach. I don't want my users (children) to accidentally tap the back button and lose what they have entered into a view. 1) In a very old implementation, there's a leftBarButtonItem with an action which shows an alert asking are you sure....
Jules
1

votes
0

answer
85

Views

Swift JavascriptCore Node.js Stream

I've recently read about how to use NPM packages in Swift. There is an NPM package that creates a Node.js Stream. In Node.js I can just do the following to pipe that stream to the filesystem and create a file from it. const fs = require('fs'); myStream(myDetails).pipe(fs.createWriteStream('test.txt'...
Charlie Fish
1

votes
0

answer
21

Views

Controlling the “Open in …” button in the Quick Look (preview) panel

The QLPreviewPanel window has a button that will allow the user to open the quick look document they are currently previewing by launching its original application. Is it possible to (a) disable this button for some documents and (b) learn if the user has clicked that button. My problem is that some...
James Bucanek
1

votes
0

answer
360

Views

Dynamically loaded Swift framework bundle's principalClass is NIL

A rare case when an iOS app needs to load/execute/unload bundle code on demand. While it works with an Objective-C framework, Swift framework proves to be a hurdle: Bundle.principleClass consistently returns nil. I have followed the example in this blog post Plugin Architecture in Swift(ish) plus so...
Denis Zubkov
1

votes
0

answer
412

Views

How put a custom view on a selected row for an uipickerview rxswift?

I use Pickerview with Rx and i would like to know how you can change view of the selected row with a custom view. i tried on a picker view without RX it works. But the same with Rx and Custom Adapter don't work. Do you have an idea to do this ? Thanks for your answers : For example without Rxswift :...
julien hamon
1

votes
2

answer
196

Views

NSAlert won't disappear

I'm using a simple NSAlert based on Apple's sample code, and while it displays fine, it never disappears. Code: void DisplayAlert() { NSAlert *alert = [[NSAlert alloc] init]; NSLog(@'TEST'); [alert addButtonWithTitle:@'OK']; [alert setMessageText:@'Yay!']; [alert setInformativeText:@'This is an info...
ashgromnies
1

votes
1

answer
122

Views

How can I get the original font name of some text using PDFKit?

I wrote a script which parses information from PDF files and outputs it to HTML. It's written in Python, using pdfminer. On some text segments, the font style can have semantic significance. For instance: bold, italic and color should trigger different behavior. Pdfminer provides scripts with the fo...
zneak
1

votes
0

answer
151

Views

Identifying content/image type from NSImage

I have an NSImage instance and I'd like to identify the type of image it is (JPG, PNG, GIF, etc.). Is the original format of the image preserved and possible to retrieve somehow? EDIT: Answers in other questions mention using CGImageSource. However, there does not seem to be a way of extracting the...
Andy Hin
1

votes
0

answer
386

Views

awakefromnib not called for UICollectionReusableView when using RxSwift datasource

I'm using RxSwift, I managed to create the dataSource and I retrieve cells correctly. Problem is with the section headerView. I have created a UICollectionReusableView class, attaching outlets from storyboard. The problem is that I retrieve the view with collectionview.dequeueReusableSupplementaryV...
Andrea.Ferrando
1

votes
2

answer
79

Views

Storyboard outlet's weak references retention unclear behavior

Objects added to an interface builder scene created from an 'Object' template can have referencing outlets on the view controller marked both as weak and strong. We have recently observed a behavior where the outlet to an 'Object' marked as weak would retain its value after the view controller creat...
Isaac Carol Weisberg
1

votes
1

answer
234

Views

MySQL Client in a Cocoa App

I'm trying to connect to a remote MySQL database from a macOS app (written in Swift). I've embedded the MySQL C library (libmysqlclient.18.dylib) into the app, and imported the headers using a module map. Everything seems to compile and link correctly. For some reason, I can't get the client to actu...
hundley
1

votes
1

answer
280

Views

Tooltips in NSTextView/NSTextfields

I want to display tooltips over parts of an attributed string, and thought that using an NSToolTipAttributeName attribute on the required ranges would do the trick but I can't get it to work. I am trying in MACOS, Xcode (9.2) NSString *fullString = @'Create a new tooltip'; NSString *compareString =...
Nomita
1

votes
0

answer
70

Views

Sketch plugin development, how get layers hierarchy

I have a function like this: function selectLayersOfType_inContainer( layerType, containerLayer ) { // Filter layers using NSPredicate var scope = containerLayer.firstObject().children(), predicate = NSPredicate.predicateWithFormat( '(className == %@)', layerType ), layers = scope.filteredArrayUsi...
La_Concorde
1

votes
0

answer
41

Views

Check if NSColorPanel is 'sampling'?

In NSColorPanel the user can click on the pipette symbol to sample a colour from anywhere on the screen. Our app uses popovers to ask for optional data (like color) that we hide once the user clicks outside of the popover. However if an NSColorPanel is launched from the popover to pick a color and t...
ATV
1

votes
0

answer
68

Views

NSWindow fixed position while switching between Spaces (Desktops)

Is it possible to fix position of NSWindow while switching between spaces? It is possible to use window?.collectionBehavior = [.canJoinAllSpaces] to share window in all spaces, but I want same effect like Dock or Picture in Picture does - the NSWindow always stays in same position, even if we switch...
Vadim
1

votes
0

answer
80

Views

NSFilePromiseReceiver returns NSURLErrorDomain -1001 “(null)” when receiving files

I've been working to update the performDragOperation method to use NSFilePromiseReceiver. However, any time I drag a file, the reader returns Error Domain=NSURLErrorDomain Code=-1001 '(null)' Here's the code: NSString *tempPath = [NSTemporaryDirectory() stringByAppendingPathComponent:[[NSUUID UUID]...
Drew
1

votes
0

answer
89

Views

What is difference between showWindow: and makeKeyAndOrderFront: in NSWindowController

What is basic difference between showWindow: and makeKeyAndOrderFront: methods of NSWindowController. When to go for showWindow: and when to go for makeKeyAndOrderFront: Which is most recommended method
S. S
9

votes
3

answer
9.5k

Views

NSInteger set to 0 but returns nil

I have an NSInteger in my class like so In @interface: NSInteger currentRow; @property (assign) NSInteger currentRow; In @implementation: @synthesize currentRow; Doing [self setCurrentRow:0] seems to work fine, but using [self currentRow] just returns null for some reason, not sure why. When...
BytesGuy
1

votes
0

answer
113

Views

Xcode 9 autosave doesn't work if I quit my app using NSApp.terminate()?

I am building a macOS app using Xcode 9 with Swift 4. I want to save the size and position of my window, and recover it when users open it next time. Therefore, I gave my Window an autosave name RectangleWindow in the Storyboard. If I quit my app using the stop running application button in Xcode, I...
Jay Wong
1

votes
1

answer
88

Views

Objective-C throwing an exception in a static library. How can I catch the exception from a program using the library?

I am writing a static library with Cocoa and the Xcode project contains an 'Example App' target. In the library, there are places in which I create an NSException object and raise it, with either the raise method or the @trow directive. I don't succeed to catch the exception in the example app. My c...
Alfonso Tesauro
1

votes
0

answer
72

Views

Can't wrap static library in Cocoa Touch Framework

I tried the steps in this link. I added all linked libraries which should also include a library called myLib.a, but I got an undefined symbols for architecture arm64 error. Furthermore, when I used the command nm -arch arm64 -g myLibraryName, I found out that the symbols in myLib.a were missing.
Lumialxk
1

votes
0

answer
139

Views

Swift Too many Cocoa pods?

So I am creating an app that uses Firebase, Google maps SDK, Core location and loads of other little third party things going on, but is there a point where all these pods become too many? What are the negatives to having this many pods other than the obvious large project and IPA file size? To give...
Niall Kiddle
1

votes
1

answer
195

Views

How to change safari setting programmatically

is it posible to change Mac safari setting by app after getting user permission if yes then how its done by objective c code. if no why.
Ron Gahlot
1

votes
0

answer
43

Views

prevent cocoa application from becoming active

I have a cocoa application that has an NSView in the primary NSWindow that can be clicked. When the NSView is clicked, I want the mousedown event to fire, but I do not want my application to become the active application. For example, if the user is in Safari typing in a webpage and clicks my appli...
John VanSickle

View additional questions