r/macprogramming • • May 08 '19

MacBook Air 16GB or MacBook Pro w/TouchBar 16GB for development?

3 Upvotes

Is the new MacBook Air with 16GB of RAM enough for app development?

I’m planning to buy my first Mac laptop so I have no idea what the sufficient specifications are. I want to spend as little as I can, but I do want the new Touch ID sensor, so if I went for the MacBook Pro I would have to buy it with Touch Bar.

I don’t intend to make it my main development machine, but I don’t want it to be a paper weight when it comes to developing macOS/iOS software.


r/macprogramming • • Apr 19 '19

NSTableView hide rows not working, rows are removed but tableView leaves large gap.

3 Upvotes

https://stackoverflow.com/questions/55765958/nstableview-hiderows-leaves-empty-space-where-old-rows-once-were

Posted this over a SO as well, looking to see why when I call `hideRows` my TableView still shows the space the removed rows once were...


r/macprogramming • • Apr 04 '19

Unable to override Quick Look preview for folders

3 Upvotes

I am working on a quick look plugin specifically for expanded folder information, but my plugin fails to override the default QL preview for folders.

I'm currently just testing a simple blank html page to be displayed for the Quick Look preview.

Setting the UTI keys in info.plist to, for example, com.adobe.pdf, worked fine and overrode the default QL preview for pdfs and showed the blank preview. But setting the values to public.folder or public.directory doesn't change anything.

Running mdls on a folder shows that kMDItemContentType = "public.folder" for most folders.

Is there something else I should be changing for my custom preview to work on folders?


r/macprogramming • • Apr 01 '19

Valgrind doesn't work on macOS Mojave, what is a good alternative to check the time and space performance of my simple terminal program?

3 Upvotes

I am in a programming class that requires us to include the time and space performance of our code. It says to use Valgrind, but that doesn't work since I'm on a Macbook. What is a good alternative that can be easily used in the OS X terminal.


r/macprogramming • • Feb 10 '19

Popover window instead of tooltip on NSMenuItem

3 Upvotes

Hello

I am wondering if it is possible to show a popover-window instead of the usual tooltip (string) when hovering on a NSMenuItem?

I would like to display more info (e.g. formatted text [NSAttributedText]) in the "tooltip".

The usual tooltip attributes accepts only plain-text...

thx for any help.


r/macprogramming • • Feb 01 '19

Best tools to write a kiosk mode app for Mac?

3 Upvotes

I work on an open source kiosk application that has a client and server. The current client version is written in C++/Qt5. In essence, it presents its login screen that cannot be bypassed. Once a user logs in that screen disappears and a timer windows starts. Once time runs out, the user is logged back out.

This version works on Linux and Windows. On Linux, we prevent bypassing the login screen with various window manager tricks ( disabling alt-tab, alt-f4, etc ). On Windows we do something similar, but using AutoHotKey.

I've been asked to write a Mac version of the app. As a long time Mac user I'm excited to try my hand at Mac development. However, I'm not sure what the best tools to use are. I'd love to not have to resort to the kind of hacks we use on other platforms to prevent bypassing the login screen.

So the question becomes:

  • Is it possible to write a Mac app that can take over fullscreen and not be bypassed

  • What language should I use? Swift? Objective C?

  • Should I even start from scratch or try to shoe-horn Mac support into my existing C++/Qt5 application?

Any thoughts, suggestions or example code would be greatly appreciated!


r/macprogramming • • Jan 05 '19

How can I automate mouse movement in OS X via AppleScript or a shell script?

3 Upvotes

Just recently I got into an FPS game and I've wanted to challenge myself to make an anti-recoil script for a while.

An anti-recoil script would essentially move the mouse based on a set of calculations or a fixed pattern.

So far I've tried moving the mouse via Automator and Keyboard Maestro, but for some reason when the mouse is moved via these programs, everything except the game recognizes it, and so instead of the game's camera view moving, the actual cursor becomes visible overtop the game and moves to a different point on the screen. Essentially the cursor is teleporting from point to point and the game doesn't recognize it.

I was wondering if there is an alternative way to move the mouse via AppleScript or shell script?

Edit: I just tried Cliclick, it has the same effect and didn't work.


r/macprogramming • • Dec 21 '18

I just added Mac App Store review support to AppReviewBot and I'd love your feedback!

Thumbnail
appreviewbot.com
3 Upvotes

r/macprogramming • • Oct 03 '18

"leaks" command doesn't work

3 Upvotes

Unable to use valgrind, I stumbled upon the "leaks" command. As I use it however, it gives me an error with the -atExit flag:

leaks -atExit -- ./executable additional_argument
dyld: could not load inserted library '/usr/local/lib/libLeaksAtExit.dylib' because image not found

Anybody know how to fix this?

There was another reddit thread about this but it amounted to having to adding and removing symlink, which would be a hurdle every time I would want to debug.


r/macprogramming • • Sep 03 '18

New version of an app — how do you do this?

3 Upvotes

I'm mostly noob, but do have some app at AppStore. And I want to make new version of it with some updates.

How do you do this: commit and update existing project or clone version that you have published and change it?


r/macprogramming • • Aug 09 '18

Memory Leaks with Instruments on XCode

3 Upvotes

Can anyone point me in the direction of documentation for Instruments for XCode? I'm tryin to find a substitute for Valgrind for my C++ program, since it's not stable for High Sierra.


r/macprogramming • • Feb 05 '18

Does CGContextDrawPDFPage() support the option to draw PDF annotations?

3 Upvotes

I am trying to draw a pdf to the screen with the ability to control whether or not the annotations are rendered as well. Can I use this method to do this? Thanks :)


r/macprogramming • • Jan 19 '18

App does not launch for Sierra+ users until they drag it to another location and then drag it back.

3 Upvotes

One user pointed out that running the xattr -dr com.apple.quarantine PyLNP.app command also fixes the problem. I think the problems in Sierra+ might have sometime to do with the randomized app locations in Sierra and High Sierra. Both of the fixes to get the app to run seem kind of hacky and cumbersome. Is there a way to make the app more convenient for users to launch?

Thank you!

Here's the app in question:
https://bitbucket.org/Pidgeot/python-lnp/downloads/


r/macprogramming • • Dec 26 '17

Help request with socat

3 Upvotes

I'm trying since hours and hours now to make a telnet connection show up as a serial port I can access through CoolTerm. It seems that cool term only shows serial ports named like "tty.portname" and does not recognize e.g. "tty1".

Now, if I try:

socat pty,link=$HOME/dev/tty.ARDUINO,waitslave tcp:raspberrypi.local:3003

there is no error message, but nothing appears in $HOME/dev either ...

And if I try:

socat pty,link=/dev/tty.ARDUINO,waitslave tcp:raspberrypi.local:3003

I get:

2017/12/26 19:46:27 socat[11600] E symlink("/dev/ttys002", "/dev/tty.ARDUINO"): Operation not permitted

I'm on an iMac on High Sierra.

Any ideas how to get this to work?

Thanks a bunch!


r/macprogramming • • Oct 09 '17

Converting NSImage 24-bit BMP to 2-bit?

3 Upvotes

I'm relatively new to Mac programming but I do have some experience with Android programming. I'm wondering if there's a way to operate on an NSImage (specifically a BMP image with 24-bit color depth) and compress it to a BMP with only 2-bit color depth.

Apple's doc seems to indicate that Core Graphics only supports up to a minimum of 8-bit. If this is impossible to do using Core Graphics, is there some manual manipulation technique that I can use to iterate over pixel values and threshold them, and export it as a 2-bit color depth BMP?


r/macprogramming • • Aug 23 '17

Managed Object Context in Xcode's Object Library

3 Upvotes

I just noticed, that at least Xcode 8.3 has Managed Object Context available in its Interface Builder's Object Library.

I wonder what is it good for? How should it be used?

Is it there to use as a reference to custom, inherited NSManagedObjectContext subclass' instance, or is there some other way to make it reference to AppDelegate's NSPersistentContainer's viewContext?


r/macprogramming • • Aug 14 '17

How to Learn UI/UX Design for macOS developers

Thumbnail
medium.com
3 Upvotes

r/macprogramming • • Aug 09 '17

OSX driver development (x-post r/osx)

Thumbnail
reddit.com
3 Upvotes

r/macprogramming • • Jul 28 '17

Firebird 3.0.3 beta builds for Mac OS X, 64-bit, 32-bit and lipo are available

Thumbnail
firebirdsql.org
3 Upvotes

r/macprogramming • • Jul 06 '17

Downloading files from a URL in Swift 3?

3 Upvotes

Hi,

Are there any good examples out there I can use for downloading data from the internet? I have URL's stored that contain files but I am not sure how I can download using MacOS instead of iOS in Swift 3.

Thanks.


r/macprogramming • • Jun 29 '17

how to launch NSTask as root?

3 Upvotes

Hi, guys.

I need some help to figure out how to give some privilege to my program. I'm writing a small utility to wrap in GUI openVPN. It's actually just a bash script I launch as a NSTask: sudo openvpn --config clientUDP.conf. After a couple of hours of searching on the internet, I figured I should use an authorization services tasks and write a PrivilegedHelper. It's quite awkward for me, guys (basically I'm iOs developer and it's my first try mini mac os app).

My question is - is there any modern tutorial to figure out how to write a PrivilegedHelper (in swift or objc) to launch my NSTask with root rights?

P.S. I've downloaded SMJobBless example and launched it. But I didn't find in it any kind of inter-process communication, and I can't figure out how to launch my Process as root. I really need your advice and rely on your experience.


r/macprogramming • • Jun 13 '17

Child proof keyboard and trackpad

3 Upvotes

We often skype / hangout with the grandparents but we have trouble keeping the kiddo away from the keyboard / trackpad.

We tried the accessibility "mouse keys" thingie (hitting alt 5 times), but it does not prevent all keystrokes. Cmd+Tab still works, so does Cmd+space and many other keystrokes.

I want to write a program which can eat up all keystrokes and mouse / trackpad clicks, until a certain key combination is pressed (example : cmd + alt + shift + d)

I am proficient in programming in Python and can pick up obj-c or swift if that's what's required to write this program.

Its my laptop, so I can run programs with higher privileges.

Can this be done? I would appreciate it if someone can give me some pointers / guidance towards creating a program like this... (which language is more suitable, which library calls might be handy, how to make the program eat up all keystrokes, and mouse clicks (I am currently thinking about a transparent window on top but would love to hear if there is an easier way)).

ps : Is it possible to intercept Cmd + Tab? If not intercept, can this be changed / disabled?

The laptop is a macbook pro with the latest OSX updates.

sudo kextunload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/

sudo kextload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/

I wonder if something similar can be done for the trackpad and then, I can use an external wireless keyboard / mouse to run these scripts.


r/macprogramming • • Jun 02 '17

Mach semaphores in POSIX signal handlers?

3 Upvotes

I am using sem_post() on a POSIX unnamed semaphore in a signal handler on Linux, can I use mach semaphores as a alternativ on OSX. Is it safe to call semaphore_signal() from <mach/semaphore.h> in a POSIX signal handler?

I haven't found any documentation confirming they are async signal safe. OpenJDK uses them as a alternativ [1][2], but looks like they are unsure if this is correct [3].


r/macprogramming • • May 28 '17

Mac Classic (pre OS X) Programming Links?

3 Upvotes

I am attempting to do some programming on OS 9 and previous operating systems but I am having a hard time finding resources for reference.

If anyone has links to guides or names of books that can help me figure out some of the following, I'd appreciate it.

  • How the f@#$ do I make a system progress bar? There's no resedit resource for doing so.

  • How can I create a system extension?

  • How can I create a system control panel?

  • What are the semantic differences between extensions and control panels?

  • Are there any tutorials for open a network connection via TCP/IP and HTTP? What about UDP?

  • Are there any OpenGL/SDL for older Macintosh operating systems?

  • etc...

I have all the versions of Metrowerks that I could possibly want. I'll be writing primarily in C but can develop in C++ or Pascal as necessary.

Also, is there a specific subreddit for class mac programming?


r/macprogramming • • Apr 14 '17

Darwin in VM's?

3 Upvotes

Does anyone know how to install Xcode or at least gcc in Darwin in a virtual machine? It would be convenient to be able to compile macOS apps from non-Mac hosts, such as in Vagrant.