Re: Sending SIGUSR1 to a process

2024-01-29 Thread Saagar Jha via Cocoa-dev
Yes, this should work. The only changes I know of is that you can’t signal some 
Apple processes these days if System Integrity Protection is engaged.

Saagar Jha

> On Jan 28, 2024, at 23:06, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> IIRC, one process cannot send a Unix signal to another one.
> At least, not any more, and not without special privileges.
> 
> But would it be possible for a user to send a SIGUSR1 (using 'kill -30 ' 
> on the command line) to a process they own?
> 
> I couldn't find information about that.
> In fact, in the developer docs i couldn't find any info about Unix signals, 
> what is possible or not under the new security regime in macOS.
> (I can't remember where i read about the new limitations regarding signals 
> under the new security regime.)
> 
> Any info will be highly appreciated.
> 
> Best regards, Gabriel
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Confusion with app settings / NSUserDefaults

2023-08-16 Thread Saagar Jha via Cocoa-dev
Yes, although in practice I’ve seen the preferences make it to disk fairly 
quickly after app termination.

Saagar Jha

> On Aug 15, 2023, at 13:36, Gabriel Zachmann  wrote:
> 
> Ah, thanks a lot for the insights!
> 
> Could it happen that the new settings have not been written to disk even if 
> the app has quit normally?
> Or, in other words, there might be key/value pairs stored in cfprefsd's 
> internal/runtime storage, even if i have changed the app and those key/value 
> pairs do no loner correspond to any of the app's settings?
> 
> Best regards, Gabriel
> 
> 
> 
>> On 6. Aug 2023, at 12:57, Saagar Jha  wrote:
>> 
>> The plist file on disk is written to sporadically. cfprefsd is generally the 
>> arbiter what the real values are, and it may or may not write things to disk 
>> immediately. Conversely, it’s not necessarily sitting around watching the 
>> plist file for changes. The correct way to update user defaults in an ad-hoc 
>> fashion is to use the defaults command. 
>> 
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Confusion with app settings / NSUserDefaults

2023-08-06 Thread Saagar Jha via Cocoa-dev
The plist file on disk is written to sporadically. cfprefsd is generally the 
arbiter what the real values are, and it may or may not write things to disk 
immediately. Conversely, it’s not necessarily sitting around watching the plist 
file for changes. The correct way to update user defaults in an ad-hoc fashion 
is to use the defaults command. 

> On Aug 6, 2023, at 01:53, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> I am pretty confused with the NSUserDefaults system.
> 
> My app stores different settings for different monitors in the 
> [NSUserDefaults standardUserDefaults].
> To do so, I generate 
>   defaults_ = [NSUserDefaults standardUserDefaults];
> 
> Then, I create a dictionary containing the default settings and register 
> them, like this:
> 
>NSDictionary * monitor_defaults = [NSDictionary 
> dictionaryWithObjectsAndKeys: defaultsForMonitor, displayname, nil ];
>[defaults_ registerDefaults: monitor_defaults];
>NSDictionary * monitor_user_prefs = [defaults_ dictionaryForKey: 
> displayname];
> 
> Then, I read the actual values from monitor_user_prefs.
> 
> When the user changes a setting, I do the inverse, like this:
> 
>.. create a new dictionary monitor_user_prefs, containing all the 
> key/value pairs of the settings ..
>[defaults_ setObject: monitor_user_prefs forKey: displayName_];
>bool success = [defaults_ synchronize];
> 
> Now, the focusing part is the following.
> I delete the Preferences folder in the app's container.
> I can check with the the 'defaults' command line tool that it's really gone:
> 
>  % defaults read de.zach.ArtSaverApp
>  Domain de.zach.ArtSaverApp does not exist
> 
> I run the app, and its settings are properly populated with the defaults I 
> set programmatically in the app.
> E.g., DurationPerImage is 60 (sec).
> 
> *However*, when I open the plist file in Xcode, I see four key/dictionary 
> pairs!
> The keys are the names of some of the monitors I have used in the past, so 
> they are not entirely bogus.
> But right now, my laptop is not connected to any external monitor, just the 
> internals LCD display.
> So there should be really only one dictionary, with the name "Built-in Retina 
> Display".
> 
> Next thing that's also very confusing is the following.
> I close the app. Then I change a value in the plist using XCode. 
> Then I save the plist (CMD-S) in Xcode.
> Then I run my app again - but the setting has not changed!
> 
> It seems as if macOS is keeping the settings somewhere else, instead of the 
> plist file.
> OTOH, when I change a setting in the app, the value in plist file reflects 
> that, even while I have the plist file open in Xcode.
> 
> Very confused,
> Gabriel.
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How do decipher an exception in the log file

2023-07-20 Thread Saagar Jha via Cocoa-dev
Console should have it. That crash log will have the base address in it that 
you can use to symbolicate things.

Saagar Jha

> On Jul 18, 2023, at 16:01, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 
>> That number is 0x7FFF, which is particularly recognizable and 
>> happens to be the value of NSNotFound.
>> 
>> I imagine that in the preceding line of code you called -indexOfObject: on 
>> an array that didn't contain the object, but then failed to test the value 
>> against NSNotFound before trying to fetch from that index.
>> 
> 
> Thanks a million!
> Very interesting observation. 
> The fact that  
>  9223372036854775807 = 0x7FFF 
> escaped me.
> And, indeed, I do have a few indexOfObject's in my code, and luckily not that 
> many.
> 
> 
>>> More precisely, is there a way I can determine the location in the code 
>>> where the exception occurred?
>> 
>> Do you have symbols for the particular build of the app that crashed? If so, 
>> there ought to be some way to symbolicate the list of addresses in the 
>> "Stack trace:" line of the log messages... although maybe not, without 
>> knowing the base load address of the executable.
> 
> Problem is that its a screensaver (i.e., a .saver file).
> I guess the base adress is always different, at least I have no idea what the 
> base address might be.
> 
>> A full-on crash report, rather than log messages, would be a lot more useful.
> 
> Where would i find that crash report, given its a screensaver?
> Just in case something like that happens again ...
> 
> 
> Best regards, Gabriel
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Memory leak in Apple's image handling frameworks ?

2023-05-01 Thread Saagar Jha via Cocoa-dev
malloc is not the only way for your app to leak memory. CGImage in particular 
allocates its own anonymous VM regions. footprint against your process (man 1 
footprint) is a good way to get a quick look at where the system thinks this 
memory is going. Once you’ve looked at that, Instruments or vmmap or leaks is a 
good way to further refine your search.

Saagar Jha

> On May 1, 2023, at 04:04, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> Thanks so much again!
> 
> I tried, and it didn't give me a good clue, though.
> What I got as output is:
> All zones: 1466 nodes malloced - Sizes: 117040KB[25] 96KB[25] 8KB[2] 5.5KB[1] 
> 5KB[1] 4KB[2] 3KB[3] 2.5KB[2] 2KB[4] 1.5KB[4] 656[15] 592[2] 528[2] 512[2] 
> 448[5] 400[3] 384[2] 368[3] 352[1] 336[1] 304[35] 288[19] 272[16] 256[29] 
> 240[8] 224[6] 208[40] 192[9] 176[15] 160[7] 144[5] 128[7] 112[30] 96[7] 
> 80[32] 64[115] 48[298] 32[553] 16[130] 
> 
> So that does not account for the 5+GB (after a few minutes, and growing), I 
> think.
> 
> Best regards, Gabriel
> 
> 
> 
> 
>> On 30. Apr 2023, at 20:41, Rob Petrovec  wrote:
>> 
>> Oh yeah, Gabriel, another technique you can use is to start your app and 
>> create a memgraph _before_ reproducing the problem.  Then reproduce the 
>> problem and run ‘heap MyApp --diffFrom MyApp.memgraph’.  It will show the 
>> new objects that have been created since the memgraph was taken, sorted 
>> number of objects. That might narrow down what object(s) are eating your 
>> memory.  Good luck.
>> 
>> —Rob
>> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: OS/X Java native bug

2023-03-17 Thread Saagar Jha via Cocoa-dev
The implementation of -[ThreadUtilities performOnMainThreadWaiting:block:] does 
the right thing here, which is calling the block directly if it’s already 
running on the main thread: 
https://github.com/openjdk/jdk/blob/9d518c528b11953b556aa7585fc69ff9c9a22435/src/java.desktop/macosx/native/libosxapp/ThreadUtilities.m#L103.
 It’s likely that your hang is caused by something else.

Saagar Jha

> On Mar 17, 2023, at 01:58, Michael Hall via Cocoa-dev 
>  wrote:
> 
> This was just brought to my attention on a java mailing list.
> 
> An option was added to java startup options on OS/X -XstartOnFirstThread so 
> the code starts on the main Appkit thread.
> 
> Currently if a java Swing application starts with that option it hangs. 
> 
> https://bugs.openjdk.org/browse/JDK-8289573
> 
> This bug indicates a regression from an earlier one…
> 
> https://bugs.openjdk.org/browse/JDK-7128597
> 
> For apparently pretty much the same problem it suggests…
> 
>> If +[NSThread isMainThread] returns true, you can simply call your 
>> initializer directly, instead of punting it onto the main thread.
> 
> That from a former Apple Java Swing support person. Mike Swingler. 
> 
> Which resulted in a fix including…
> 
>> the addition of +[NSThread isMainThread] was done at Mike's suggestion
> 
> I found some old code that seems to include that fix…
> 
> if ([NSThread isMainThread]) {
>  [GraphicsConfigUtil _getCGLConfigInfo: retArray];
>  } else {
>  [GraphicsConfigUtil performSelectorOnMainThread: 
> @selector(_getCGLConfigInfo:) withObject: retArray waitUntilDone: YES];
>  }
> 
> The current code that seems to regress to the original bug now looks like…
> 
> [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
> 
> With what appears to be all the code that was in the selector 
> _getCGLConfigInfo following in an inline block. This always appears to run on 
> main thread which I think is the reverted to bug. 
> 
> I’m not that familiar with code including blocks. Is there some fairly easy 
> way to modify this and keep it running as an inline block but also add the 
> isMainThread check to not always run on the main thread?
> Or, would you have to put it back to include the check and invocation of a 
> standalone selector?
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Screensaver Options under macOS 13 (Ventura) doesn't work

2022-11-07 Thread Saagar Jha via Cocoa-dev
I have a couple of custom screensavers where the button works, so it sounds 
like this must be something with your setup. Perhaps looking at Console might 
be helpful?

Saagar Jha

> On Nov 6, 2022, at 13:21, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> I've got a screensaver (sitting in System Preferences) that works fine under 
> macOS 12.x and that still seems to work fine under macOS 13 (Ventura) - 
> except that users cannot open the "Options" dialog any more!
> (I can't investigate directly, since I cannot upgrade to Ventura just yet).
> 
> My question is: does anyone know of any changes under macOS 13 that might 
> prevent the Options pane from appearing?
> 
> I have already tried to recompile my screensaver for macOS 13 and sent it to 
> the user, to no avail.
> The log file they sent to me does not show anything - the Options dialog just 
> does not open. 
> The Options button is not greyed out.
> 
> Any ideas will be highly appreciated.
> 
> Best regards, Gabriel
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Xcode 14 minimum deployment target

2022-10-28 Thread Saagar Jha via Cocoa-dev
I believe Xcode 14 has the old macOS bits (with the new iOS SDK). Try 14.1?

> On Oct 28, 2022, at 03:51, Eyal Redler via Cocoa-dev 
>  wrote:
> 
> I read somewhere (can't recall where) that xcode 14 will not support 
> deployment target < macOS 10.13.
> I was bracing myself for having to somehow develop my app on two machines for 
> a while or ditching my pre 10.13 users but after installing xcode 14 on my 
> new M1 machine I found out that I can compile and build my app with minimum 
> deployment target of 10.9 and could not find an issue when running it on 10.9.
> 
> I'm not sure what to make of it, did I misunderstand this, is it a fluke? Did 
> Apple change their policy?
> 
> Eyal Redler
> 
> "If Uri Geller bends spoons with divine powers, then he's doing it the hard 
> way."
> --James Randi
> www.eyalredler.com
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Are runtimes of system objects dynamic/SDK dependent/whatever?

2022-06-14 Thread Saagar Jha via Cocoa-dev
Option 2 is pretty much what happens. In addition, the behavior of doCoolStuff 
might change in 11.0 versus 10.15; the system framework will pick between the 
two by checking which SDK you were linked against. 

> On Jun 14, 2022, at 12:30, Aandi Inston via Cocoa-dev 
>  wrote:
> 
> I'm trying to understand how Mac OS X actually implements the predefined
> objects like NSApplication. Not in detail by function, but where the code
> lives. This is by way of understanding what happens if the SDK version
> doesn't match the system version. Let's suppose I would like to use an
> imaginary method [NSApplication doCoolStuff] which was added in Mac OS
> 10.15, but I'm linking with the 10.14 SDK.
> 
> So, where does doCoolStuff actually exist? I can think of several
> possibilities.
> 
> 1. The code for NSApplication and its methods is linked entirely into my
> application. This makes it self contained, though it might depend on system
> calls and external services. So NSApplication exists inside my application,
> and it runs the version written as part of the SDK I link with (10.14).
> There is no way for me to call   [NSApplication doCoolStuff]  , because it
> doesn't exist in the NSApplication I am using (10.14 runtime).
> 
> 2. The code for NSApplication is dynamically linked from system-provided
> shared code of some kind, using the same code regardless of the SDK version
> used. The shared code may include some differences according to info it has
> on the SDK used to build the current app. In this case perhaps I could call
> [NSApplication doCoolStuff], though not by coding that; something involving
> NSSelectorFromString.
> 
> 3. The code for NSApplication is dynamically linked from system-provided
> shared code of some kind, using code dependent on the SDK version used. The
> methods provided will depend on the SDK version used. This would imply
> that, like case 1, is no way for me to call  [NSApplication doCoolStuff]  ,
> because it doesn't exist in the NSApplication runtime I am using.
> 
> 4. The code for NSApplication is a stub to some other kind of external
> interface I never heard of...
> 
> Thanks in advance!
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: dispatch_apply() on an NSArray and Thread Sanitizer

2022-04-19 Thread Saagar Jha via Cocoa-dev
If Thread Sanitizer says your code has a race, it almost certainly has a race. 
Your simple code seems OK superficially, but there are a couple things that 
could be problematic here: either your real code is actually mutating 
something, or (unlikely) you are touching some internal state, perhaps a CoW 
optimization, that is not visible to you but is silently changing things under 
the hood. In any case, I would generally suggest using -[NSArray 
enumerateObjectsAtIndexes:options:usingBlock:] with the NSEnumerationConcurrent 
flag, which should rule out any issues with concurrent access on the array 
itself.

Regards,
Saagar Jha

> On Apr 19, 2022, at 14:02, Sean McBride via Cocoa-dev 
>  wrote:
> 
> Hi all,
> 
> If one wants to do something with every item in an NSArray in a concurrent 
> way, is the following safe/correct?
> 
> 
> NSArray* array = @[@5, @6, @7, @8, @9, @10, @11];
>   
> dispatch_apply([array count], DISPATCH_APPLY_AUTO, ^(size_t idx) {
>   id unused = array[idx];
> });
> 
> 
> Here of course I'm not doing anything interesting, just extracting the object 
> from the array.  This is a reduced example.
> 
> On one Mac I have, Thread Sanitizer says there is a data race there.  On 
> another Mac, Thread Sanitizer does not complain.
> 
> My understanding is that this code is correct, and that TSan is wrong to 
> complain, but maybe I'm wrong...
> 
> Thanks,
> 
> Sean
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Archive for "Any Mac" automatically ?

2021-08-28 Thread Saagar Jha via Cocoa-dev
This should “just work” if your ARCHS is set to “Standard Architectures” and 
ONLY_ACTIVE_ARCH is set to NO for the build configuration you use for Archiving 
(which is probably Release).

> On Aug 28, 2021, at 04:44, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> Would it be possible to make Xcode settings such that Xcode will 
> automatically use the "Any Mac" destination, i.e., compile a universal 
> binary, whenever I "Archive" my macOS app?
> 
> (The "Archive" version is, of course, intended for distribution.)
> 
> 
> Best regards, Gabriel
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Question about Info.plist's

2020-08-19 Thread Saagar Jha via Cocoa-dev
Which file are you modifying? The one in your source directory? Because the one 
that goes in the final product doesn’t get copied over until after you’ve lost 
most control over the build process (it’s done by Xcode after the normal build 
stages).

> On Aug 19, 2020, at 09:58, Owen Hartnett via Cocoa-dev 
>  wrote:
> 
> You can also use a build script that calls PlistBuddy to alter the contents 
> of a plist called using a Run Script in Build Phases just before Compile 
> Sources.  I used to use one to apply the subversion revision number to the 
> build version, but then I switched to git.
> 
> 
> -Owen
> 
>> On Aug 19, 2020, at 12:44 PM, Glenn L. Austin via Cocoa-dev 
>> mailto:cocoa-dev@lists.apple.com>> wrote:
>> 
>> No, you can't use an "earlier" key to create a "later" value - but you can 
>> use code to do basically the same thing.
>> 
>> Or, you can use the same variable that sets your CFBuildNumber to set your 
>> CFBundleVersion.
>> 
>> --
>> Glenn L. Austin, Computer Wizard and Race Car Driver <><
>> 
>> 
>>> On Aug 19, 2020, at 9:07 AM, Gabriel Zachmann via Cocoa-dev 
>>>  wrote:
>>> 
>>> Question:
>>> 
>>> Is there a way to use a key/value that was defined earlier in the plist file
>>> to define a value for a later key?
>>> 
>>> Explanation:
>>> I have a macOS project with an automatically created "About" window.
>>> The plist file has, additionally to all the default stuff, the key 
>>> CFBuildNumber (with a value that I increment automatically).
>>> 
>>> In Xcode, I tried to change "Bundle version" to a value like
>>> 
>>> $(CURRENT_PROJECT_VERSION)_$(CFBuildNumber)
>>> 
>>> However, in the final Info.plist in the app's bundle, this then looks like
>>> 
>>>  CFBundleVersion
>>>  3.1_
>>> 
>>> Notice the underscore, but the value of CFBuildNumber is gone.
>>> "3.1", BTW, is the value I have set under
>>> 
>>>  Project / Targets / General / Identity / Build
>>> 
>>> I have tried to change parentheses into curly braces, to no avail.
>>> 
>>> So, question again: is there a way to use a key/value that was defined 
>>> earlier in the plist file
>>> to define a value for a later key?
>>> I'd like to do that so that the "About" window contains the build number, 
>>> too.
>>> 
>>> Thanks a lot in advance.
>>> 
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/cocoa-dev/glenn%40austinsoft.com
>>> 
>>> This email sent to gl...@austinsoft.com
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/owen%40clipboardinc.com 
>> 
>> 
>> This email sent to o...@clipboardinc.com 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
> )
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com 
> 
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com 
> 
> 
> This email sent to saa...@saagarjha.com 
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Launching in fullscreen gives "Funk" sound sometimes

2020-06-25 Thread Saagar Jha via Cocoa-dev
It’s possible that the “funk” sound is coming from the other app if it still 
has keyboard focus. Try attaching to that instead and seeing if it hits NSBeep.

Saagar Jha

> On Jun 25, 2020, at 02:09, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 
>> 
>> Set a symbolic breakpoint on NSBeep and see whether it?s your code that?s 
>> calling it.
>> 
>> 
> 
> Thanks a lot for the hint!
> 
> I think I managed to do that (it's a bit tricky, since my app gets launched 
> in fullscreen mode by some other app).
> Alas, the debugger did not break at any time when I heard the "Funk" sound.
> So, I guess, we can conclude that my app does not call NSBeep().
> 
> Maybe, the keyboard focus is still on some other app? 
> and that's why I 'm hearing the "funk" sound, because I am typing a key that 
> is meaningful for my app, but not for the other app.
> 
> Or could it be that my app still has some other (hidden) windows open, behind 
> the fullscreen window, which somehow produce the "funk" sound?
> 
> 
> Best regards, Gabriel
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Points vs pixels in a bash script

2020-06-10 Thread Saagar Jha via Cocoa-dev

Saagar Jha

> On Jun 10, 2020, at 13:52, Ken Thomases via Cocoa-dev 
>  wrote:
> 
> On Jun 9, 2020, at 8:11 AM, Gabriel Zachmann  wrote:
>> 
>>> In particular, you're not taking into account the current screen resolution 
>>> (a.k.a. display mode).  The user can select different scaling for a Retina 
>>> display in System Preferences > Displays.
>> 
>> Good point.
>> I wasn't taking that into consideration.
>> 
>> So, what would be a robust way to determine whether or not a window (as 
>> reported by "System Events") has a fullscreen size?
>> 
>> Or is there another way to determine whether or not an app is in fullscreen?
>> 
>>> First, you're going to have to explain exactly what you're planning to do 
>>> with the results of your calculation.  Do you really want the physical 
>>> screen size?  Or do you want the size of the 
>> 
>> I only want to have a little shell script 
>> (or other little utility ) that runs inconspicuously in the background (or 
>> in the top right menu bar) and launches a specific app once the user has 
>> been inactive for a while,
>> UNLESS there is another app running at the moment in fullscreen.
>> 
>> Does anyone have some code they could share?
> 
> You could do, for example:
> 
> python -c 'import AppKit ; print 
> AppKit.NSScreen.screens()[0].frame().size.width'

Note that this will make the Python rocket ship pop into your Dock for a split 
second, so I’m not sure I could call this “inconspicuous” :P

(Also, if you, like me, have another Python installed on your system, make sure 
you’re not using that when trying the code above as it’s unlikely to work.)

> 
> Similarly for height.
> 
> Regards,
> Ken
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Performance issue on macOS 10.15 obtaining display name for ~/Desktop, ~/Documents, and ~/Downloads

2020-04-23 Thread Saagar Jha via Cocoa-dev

Saagar Jha

> On Apr 23, 2020, at 21:26, Allan Odgaard via Cocoa-dev 
>  wrote:
> 
> On 24 Apr 2020, at 9:57, Rob Petrovec wrote:
> 
>>> Also weird, why would it phone home for a shell script which has neither 
>>> been stapled nor even code-signed?
>> I think you answered the question just then…  a "shell script which has 
>> neither been stapled nor even code-signed”.  Google XProtect & Gatekeeper.
> 
> GateKeeper is basically Safari adding a quarantine flag (via extended 
> attributes)

Nit: not just Safari; other applications do this to at their discretion when 
appropriate (for example, if they too download files from the internet). 
Quarantine is just one part of GateKeeper.

> to files downloaded form the internet, and then having Finder check this 
> flag, throwing up a dialog if the flag is set, and recently, also checking if 
> the code signature is from a verified developer (possibly refusing to launch 
> at all, if not).
> 
> XProtect is basically a blacklist that applications are checked against. If 
> an application matches, it’s considered malware. The blacklist is a local 
> file on your system but updated by Apple.
> 
> These things operate very differently than having low-level system calls 
> potentially contact Apple’s servers every time a process is launched on your 
> system (or, as it appears to be the case on my system, when processes are 
> accessing certain locations in the file system).
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Performance issue on macOS 10.15 obtaining display name for ~/Desktop, ~/Documents, and ~/Downloads

2020-04-23 Thread Saagar Jha via Cocoa-dev
I believe that is why you are supposed to staple notarization tickets to your 
apps.

Saagar Jha

> On Apr 23, 2020, at 12:12, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
>> 
>> It appears the problem is not with a local service, but that Apple 
>> actually ?phones home? when a program asks for display name.
>> 
>> I don?t know if this is common knowledge, but with notarization, Apple 
>> now validates executables on your system before they are executed, and 
>> it does so in calls like execve(), where it will actually stall 
>> execution, contact Apple?s servers, and then proceed once the 
>> executable got validated.
> 
> 
> I am just curious: what does it when there is *no* internet connection?
> (Suppose, someone downloads the app, then disconnects from internet, then 
> executes it;
> or copies the app via USB drive to the machine without internet connection.)
> And what is it *supposed* to do in that case?
> 
> 
> Best regards, Gabriel
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Confusion about screen resolution

2020-02-22 Thread Saagar Jha via Cocoa-dev
I believe this became the default with the new MacBook Pros that came out in 
2016.

Saagar Jha

> On Feb 22, 2020, at 09:13, Steve Mills via Cocoa-dev 
>  wrote:
> 
>> On Feb 22, 2020, at 10:04, Richard Charles via Cocoa-dev 
>>  wrote:
>> 
>> This is bizarre. When did this start, Catalina? It has been my experience 
>> that the default scale factor is 1.0 for normal displays and 2.0 for Retina 
>> displays.
> 
> It’s been that way for quite a while. 10.12 or 10.13 maybe? I can’t remember 
> for sure. They all blur together. It makes sense to default to a size that’s 
> usable for most users, And if high res screens still look great at <2x, then 
> there’s no reason why fractional resolutions shouldn’t be used.
> 
> Steve via iPad
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Confusion about screen resolution

2020-02-22 Thread Saagar Jha via Cocoa-dev
No, the default on recent Macs is scaled to slightly under 2x.

Saagar Jha

> On Feb 22, 2020, at 05:55, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
>> 
>> What have you set in System Preferences > Displays > Resolution. On a Retina 
>> MacBook most 
> 
> I have set it to "Default for display" - shouldn't that set the resolution to 
> the native one?
> 
> Best regards, Gabriel
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Future of Cocoa

2019-12-16 Thread Saagar Jha via Cocoa-dev
Now that I think about it, you can probably do this without support from the 
runtime by interposing the handful of runtime functions that invalidate the 
method cache…

Saagar Jha

> On Dec 16, 2019, at 00:23, Jean-Daniel  wrote:
> 
> My bad, I just see that when rereading the description. Of course, it will 
> requires an updated runtime.
> 
>> Le 16 déc. 2019 à 09:21, Saagar Jha > <mailto:saa...@saagarjha.com>> a écrit :
>> 
>> There’s also a check for method swizzling and other invalidation, assuming 
>> that there is cooperation from the runtime. Unless I’m misunderstanding what 
>> you mean by the selector changing?
>> 
>> Saagar Jha
>> 
>>> On Dec 16, 2019, at 00:16, Jean-Daniel >> <mailto:mail...@xenonium.com>> wrote:
>>> 
>>> 
>>>> Le 16 déc. 2019 à 06:05, Saagar Jha >>> <mailto:saa...@saagarjha.com>> a écrit :
>>>> 
>>>> It’s been a while, but I just thought you both might be interested in some 
>>>> follow-up I did for this idea. I implemented it for fun in clang 
>>>> <https://github.com/saagarjha/expresscall> and it turns out that it’s a 
>>>> pretty decent performance win 
>>>> <https://saagarjha.com/blog/2019/12/15/bypassing-objc-msgsend/> over 
>>>> objc_msgSend, both because it dispatches faster and because the compiler 
>>>> can do a full inline through it.
>>> 
>>> Yes, but you don't preserve the objc_msgSend semantic.
>>> 
>>> If I understand you code correctly, all you do is checking if it is the 
>>> same ISA, which does not guarantee in anyway that the selector did not 
>>> change since the previous call.  
>>> 
>>> As classes are fully dynamic and methods can be swizzle, you must perform a 
>>> full IMP lookup for every calls, which complexly defeat the purpose of 
>>> inline caching.
>>> 
>> 
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Future of Cocoa

2019-12-16 Thread Saagar Jha via Cocoa-dev
There’s also a check for method swizzling and other invalidation, assuming that 
there is cooperation from the runtime. Unless I’m misunderstanding what you 
mean by the selector changing?

Saagar Jha

> On Dec 16, 2019, at 00:16, Jean-Daniel  wrote:
> 
> 
>> Le 16 déc. 2019 à 06:05, Saagar Jha > <mailto:saa...@saagarjha.com>> a écrit :
>> 
>> It’s been a while, but I just thought you both might be interested in some 
>> follow-up I did for this idea. I implemented it for fun in clang 
>> <https://github.com/saagarjha/expresscall> and it turns out that it’s a 
>> pretty decent performance win 
>> <https://saagarjha.com/blog/2019/12/15/bypassing-objc-msgsend/> over 
>> objc_msgSend, both because it dispatches faster and because the compiler can 
>> do a full inline through it.
> 
> Yes, but you don't preserve the objc_msgSend semantic.
> 
> If I understand you code correctly, all you do is checking if it is the same 
> ISA, which does not guarantee in anyway that the selector did not change 
> since the previous call.
> 
> As classes are fully dynamic and methods can be swizzle, you must perform a 
> full IMP lookup for every calls, which complexly defeat the purpose of inline 
> caching.
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Future of Cocoa

2019-11-20 Thread Saagar Jha via Cocoa-dev
Oh, I guess I didn’t explain what I was talking about well. I’m saying that the 
compiler would do a full method inline but put it behind a check to see if it’s 
legal to continue executing. For example, code like this:

@interface Foo
- (void)bar;
@end

// Another method in some random class
- (void)baz {
Foo *foo = // whatever
[foo bar];
}

would end up being compiled to something like this:

- (void)baz {
Foo *foo = // whatever
if (bar_is_unswizzled()) {
// Inlined version of -[Foo bar]
} else {
// Fall back to going through objc_msgSend
}
}

where bar_is_unswizzled() is some sort of runtime check that makes sure that 
the actual target is what we had thought it’d be at compile time. I’d hope that 
a branch predictor would be able to do a pretty good job on this considering 
that the guessing “true” would work 99% of the time.

Saagar Jha

> On Nov 20, 2019, at 17:01, Jens Alfke  wrote:
> 
> 
> 
>> On Nov 20, 2019, at 2:46 PM, Saagar Jha > <mailto:saa...@saagarjha.com>> wrote:
>> 
>> I am curious why this optimization went in instead of guarded speculative 
>> inlining, which would let you keep dynamism. 
> 
> If I understand it correctly, that only 'inlines' (really caches) the 
> resolved method address for the call site. That's not much of a win in Obj-C 
> where method lookup is already quite fast.
> 
> The real win comes with literally inlining the method at compile time. 
> Link-Time Optimization allows _any_ method anywhere in the program to be 
> inlined, provided the call is monomorphic. And this new feature allows 
> monomorphic method calls in Obj-C. This is a big win for small method like 
> getters/setters, and for methods with only one call site (i.e. where you 
> factor out a method for readability even though it's only used in one place.)
> 
> —Jens

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Future of Cocoa

2019-11-20 Thread Saagar Jha via Cocoa-dev
I am curious why this optimization went in instead of guarded speculative 
inlining, which would let you keep dynamism. Maybe that was too complicated to 
implement or didn’t have the right performance characteristics. But I guess 
this isn’t really the right list for discussing that…

Saagar Jha

> On Nov 20, 2019, at 14:27, Jens Alfke via Cocoa-dev 
>  wrote:
> 
> 
> 
>> On Nov 20, 2019, at 2:16 PM, Jean-Daniel via Cocoa-dev 
>>  wrote:
>> 
>> If Obj-C is dead, why is Apple still adding new language extensions (and not 
>> minor one) ?
>> 
>> https://github.com/llvm/llvm-project/commit/d4e1ba3fa9dfec2613bdcc7db0b58dea490c56b1
>>  
>> <https://github.com/llvm/llvm-project/commit/d4e1ba3fa9dfec2613bdcc7db0b58dea490c56b1>
> 
> Oh neat, this is basically non-virtual methods for Objective-C. Useful for 
> optimization of internal methods — not just because the call is faster, but 
> because the method body is now inlineable.
> 
> I remember talk of this inside Apple way back when (early 2000s) but at the 
> time IIRC it was considered too dangerous to be worth the performance gain. 
> These days it's probably even more of a win because of LTO.
> 
> —Jens
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on Objective-C++

2019-11-19 Thread Saagar Jha via Cocoa-dev
Based on the listing, I’d guess UWP.

Saagar Jha

> On Nov 19, 2019, at 21:18, Richard Charles via Cocoa-dev 
>  wrote:
> 
>> On Nov 13, 2019, at 11:58 AM, Richard Charles  wrote:
>> 
>> Apple released iTunes for Windows in October 2003.
>> 
> 
> 
> Apple just posted a job opening for a Senior Software Engineer- Windows Media 
> Apps. It would be interesting to know how they plan on porting the new macOS 
> media apps to Windows and what tools and frameworks they will be using.
> 
> https://jobs.apple.com/en-gb/details/200013614/senior-software-engineer-windows-media-apps
> 
> --Richard Charles
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Future of Cocoa

2019-11-19 Thread Saagar Jha via Cocoa-dev

Saagar Jha

> On Nov 19, 2019, at 20:01, Richard Charles via Cocoa-dev 
>  wrote:
> 
> 
>> On Nov 19, 2019, at 6:24 PM, Pier Bover via Cocoa-dev 
>>  wrote:
>> 
>>> When/if Apple decides to deprecate Cocoa they will announce it many years 
>>> ahead of time
>>> 
>> 
>> Like they did with 32 bits and OpenGL deprecation?
>> 
> 
> 
> The 32 bit depreciation has had a lot of discussion on this thread.
> 
> Although depreciated OpenGL and related dynamic libraries are still present 
> in system frameworks on macOS Catalina. I have an app that depends on OpenGL 
> and GLU and it runs fine on Catalina.
> 
> OpenGL was release 27 years ago and is used extensively in many technical 
> fields. Perhaps this is why Apple has not yet removed these libraries from 
> the system and GPU vendors still support the OpenGL compatibility profile.

There are also a number of system applications that depend on it, so the 
framework will presumably stick around for a little while (though possibly be 
stripped of its headers and moved into the PrivateFrameworks folder at some 
point…)

> --Richard Charles
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on Objective-C++

2019-11-13 Thread Saagar Jha via Cocoa-dev

Saagar Jha

> On Nov 13, 2019, at 12:43, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> 
>> be a good time for a SwiftUI pivot. If true, Cocoa is the new Carbon.
>> 
> 
> I think, eventually, maybe in 5 years' time, that will be the case.
> This is really just a guess, I have no insights into Apple's roadmap.
> 
> Speaking of which: I have never been there myself, but wouldn't the apple 
> engineers
> at WWDC share some private, unofficially insights into Apple's future plans?

No, they’re not supposed to.

>> We have to plan 5 or 10 years ahead, because it takes that long to create
> 
> I can understand that.
> 
> My guess would be that in 5-10 years' time, iPad's (i.e., tablets in general),
> will be powerful enough that there won't be any laptop's any more, 
> except maybe some rare models for the gamers.
> The laptops by that time will essentially be tablets that come with 
> pre-installed keyboard.
> 
> I am not sure what will happen to the standard desktop market.
> OTOH, tablets by that time will be powerful enough that , I guess, 90 % of 
> all office applications will run just fine on a tablet.
> OTOH, CIO's are usually reluctant to try out new hardware.
> 
> That would mean that macOS might go away eventually, too,
> because everything will run under iOS.
> 
> Best regards, Gabriel
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on Cocoa source code

2019-10-11 Thread Saagar Jha via Cocoa-dev
I’m sure much of the Cocoa code is quite old, but it’s mostly all Objective-C. 
If you’re curious how it might work, but don’t want to use a disassembler, the 
GNUstep project has a somewhat decent (though incomplete) reimplementation 
<https://github.com/gnustep/libs-gui> that you can look at.

Saagar Jha

> On Oct 11, 2019, at 06:18, Turtle Creek Software via Cocoa-dev 
>  wrote:
> 
>>> If you combine otool, classdump and Hopper Disassembler, you can find
> how some Cocoa methods are working in any Obj-C executable pretty easily.
> 
> Here's the thing.  We started out as construction folks who learned Excel.
> Then HyperTalk.  Then C++. As a business, our main strength is knowing the
> construction business, and how to talk to folks in it. Our time is best
> spent solving business-related problems.  Along the way we have learned
> many programming and human-interface skills, but the less time we need to
> spend on that, the better.
> 
> If a programming environment requires zombies, disassemblers and other BS
> just to make it work, that is a big problem. It's too much extra overhead.
> Our company can't afford it.
> 
> I'd agree that the documentation for Cocoa is deficient.
> 
> CodeWarrior included a huge Inside PowerPlant book, modeled on our
> well-worn copies of Inside Macintosh. But we rarely used it.  Having
> clearly-written source code and good comments is probably the best form of
> documentation. Being able to step through it easily and see it in action is
> a huge plus.
> 
> I suspect that Cocoa source code is ancient C that is badly in need of a
> refactoring. Making it open, understandable and self-documenting would be a
> great way to improve it.  Based on our refactoring experiences, it would
> end up being faster, safer and less buggy.
> 
> There probably are some parts of Cocoa that are extremely proprietary- but
> even then, plain old patents are better than hiding the code, as a way to
> protect the jewels. Competitors can always disassemble, as you suggest.
> 
> Speaking of early-Aughties history. We hired some subs to write the Windows
> version of our app. They took a short-cut and used QuickTime DLLs, though a
> lot still needed native MFC.  Metrowerks offered to buy it from us so they
> could make PowerPlant cross-platform.  Sadly, before we finished
> negotiations, Motorola did a re-org and our contact disappeared.  MW soon
> sold off their Intel compiler, just in time for Mac to switch chips. The
> rest is history.
> 
> Casey McDermott
> TurtleSoft.com
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on Cocoa source code

2019-10-09 Thread Saagar Jha via Cocoa-dev
Nothing is statically linked. The version of the SDK you compile with is 
embedded into your application and Cocoa (and other Apple frameworks) consult 
this at runtime to determine appropriate behavior. Often this means you don’t 
get the new behavior, but sometimes Apple will automatically “opt you in” if 
they feel like it doesn’t break too many applications (for example, macOS 
Sierra’s window tabbing).

Saagar Jha

[Snipped to stay under the list limit]
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on Cocoa source code

2019-10-09 Thread Saagar Jha via Cocoa-dev

Saagar Jha

> On Oct 9, 2019, at 10:19, Turtle Creek Software via Cocoa-dev 
>  wrote:
> 
> Why is Cocoa source code hidden?
> 
> Many of the frustrations we had with the 64-bit update attempt were caused
> by Cocoa's lack of visible source. It was a "black box" that often required
> trial-and-error to figure out. Yeah, the headers are visible, and Apple has
> info online. But sometimes that was not sufficient to understand the actual
> implementation details.
> 
> When debugging, the stack trace inside Cocoa was just a bunch of
> rarely-helpful Assembly. No way to set breakpoints inside Cocoa classes, or
> step through their C code. More mysteries and headaches.

You can set symbolic breakpoints inside of Cocoa. And a good disassembler will 
get you a significant portion of the way there if you’re trying to debug in the 
internals of a method.

> I personally learned C++ while using the PowerPlant library from
> Metrowerks. Its source files were totally exposed. Seeing comments and code
> really helped. When designing or debugging, it was possible to step through
> their code and see exactly how it functioned.  Cocoa would be so much
> easier to use if its source was accessible like that.
> 
> In fact, why isn't Cocoa open source?  Apple open-sources Swift and the
> Darwin kernel. Surely the GUI can't be any riskier to expose to developers?
> 
> Our programmers found several PowerPlant bugs over the years. We fixed them
> right away in our copy, and reported them so they were fixed in the next
> update. Apple could get the same benefit for Cocoa. Seems like a win-win.
> 
> Someone suggested that I send comments to Tim Cook or whomever at Apple.
> That seems a good idea, but I'd like to see discussion results, first.
> Assemble more viewpoints.
> 
> Casey McDermott
> TurtleSoft.com
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why is / a metachar in regular expressions ?

2019-09-18 Thread Saagar Jha via Cocoa-dev
If you need any more confirmation, Swift’s NSRegularExpression escapes this 
exact set of characters 
<https://github.com/apple/swift-corelibs-foundation/blob/61340367345ddee8f126a1eb8db319a2925bd3be/CoreFoundation/String.subproj/CFRegularExpression.c#L70>,
 so there isn’t an error in the documentation. (NSRegularExpression in 
Foundation uses the same set, but it doesn’t go through this specific code path 
as far as I can tell.)

Saagar Jha

> On Sep 18, 2019, at 15:06, Rick Mann via Cocoa-dev 
>  wrote:
> 
> Ah! So it is. Definitely not an error in the docs, assuming 
> NSRegularExpression supports flags.
> 
>> On Sep 18, 2019, at 14:54 , Steve Mills via Cocoa-dev 
>> mailto:cocoa-dev@lists.apple.com>> wrote:
>> 
>> On Sep 18, 2019, at 16:50:39, Rick Mann via Cocoa-dev 
>>  wrote:
>>> 
>>> Yeah, I'm inclined to think it's an error in the docs.
>> 
>> If you look at the input expression in this great site, you'll see 2 /'s as 
>> part of it. They mark the beginning and the end (before flags).
>> 
>> https://regexr.com
>> 
>> --
>> Steve Mills
>> Drummer, Mac geek
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/rmann%40latencyzero.com 
>> <https://lists.apple.com/mailman/options/cocoa-dev/rmann%40latencyzero.com>
>> 
>> This email sent to rm...@latencyzero.com <mailto:rm...@latencyzero.com>
> 
> 
> -- 
> Rick Mann
> rm...@latencyzero.com <mailto:rm...@latencyzero.com>
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
> <mailto:Cocoa-dev@lists.apple.com>)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com 
> <http://lists.apple.com/>
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com 
> <https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com>
> 
> This email sent to saa...@saagarjha.com <mailto:saa...@saagarjha.com>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: 10.15 command line tools headers missing

2019-09-13 Thread Saagar Jha via Cocoa-dev
FWIW, the Command Line Tools (which is significantly smaller than Xcode) 
includes the headers (at 
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/), and will 
also set Clang’s default header search path so that these can be found. You can 
get that with “xcode-select --install”, though if you’re trying to future-proof 
your setup I’ve heard rumors that the Command Line Tools may be dropped as well 
:( I don’t know what Homebrew finally decided on, but I do remember it being 
“pretty broken” (well, more than it usually is) during the macOS Mojave beta 
period because many of their formulas depended on /usr/include existing and 
would only build if you installed the headers package.

Saagar Jha

> On Sep 13, 2019, at 09:58, Jens Alfke via Cocoa-dev 
>  wrote:
> 
> 
> 
>> On Sep 13, 2019, at 1:32 AM, Mark Allan via Cocoa-dev 
>>  wrote:
>> 
>> I was initially reluctant to post this here because of NDA concerns
> 
> No worries, there hasn't been a F*cking NDA for years now. You can talk about 
> beta Xcode builds in public.
> 
>> They've pulled the same trick again with 10.15 but this time, the installer 
>> for the headers is also missing meaning I'm unable to compile 3rd party 
>> software using the command line tools because of missing headers like zlib 
>> and libxml2.
> 
> That's the first I've heard of this — I've had Xcode 11 for months and I 
> build 3rd party software with CLI tools all the time. And I assume lots of 
> other people do too, otherwise HomeBrew would be pretty broken :)
> 
> The SDK headers aren't installed in /usr/include or 
> /System/Library/Frameworks, but Clang's default header search path is 
> pre-configured to include the equivalent dirs in the SDK.
> 
> —Jens
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: ARC

2019-08-27 Thread Saagar Jha via Cocoa-dev
I highly doubt that setting a breakpoint on objc_retain would be useful: it’s 
called too often. Just launching Calculator, for example, hits the function 
over 20 times, so even a conditional breakpoint would make execution 
prohibitively slow. I would expect you to have more luck finding every location 
that releases mainWindowController statically and setting breakpoints there.

Saagar Jha

P.S. The code for the Objective-C runtime is available here 
<https://opensource.apple.com/source/objc4/objc4-756.2/>. Significant portions 
are still in assembly, but you might find a useful comment or two.

> On Aug 27, 2019, at 16:37, Uli Kusterer via Cocoa-dev 
>  wrote:
> 
> On 8/26/2019 8:28 PM, Turtle Creek Software via Cocoa-dev wrote:
>>>> @property (weak) GSOutlineWindowController *mainWindowController;
>>>> self.mainWindowController = [[GSOutlineWindowController alloc]
>> 
>> initWithWindowNibName : @"GSOutlineWindowController"];
>> [self.mainWindowController showWindow : self];
>> 
>> Sadly, nothing changes after the syntax changes.  @property (strong) also
>> fails.
>> 
>>>> A better way to investigate such issue is using the memory debugging
>> tools in Instrument IMHO.
>>>> That would let you see all stack traces of retain/release calls.
>> 
>> We tried that last week.  The problem with ARC debugging is that
>> breakpoints in dealloc()
>> happen long after the release.  You know it died, but not when or how.
>> Sometimes we turn off ARC for one class with compiler directives, then
>> breakpoint on release.
> Have you tried turning on NSZombie etc.? There are a bunch of neat debug
> helpers in your Build Scheme's settings.
> 
> I think there's also a function objc_retain() or something like that,
> which is a *function* in the ObjC runtime that serves as the central
> bottleneck. You may have more luck breaking on that.
> 
> Cheers,
> -- Uli Kusterer
> http://www.zathras.de <http://www.zathras.de/>
> "The Witnesses of TeachText are everywhere..."
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Trouble assigning datasource and delegate to an instance of NSTableView

2019-03-28 Thread Saagar Jha
Yup, this declares ImportTool (a subclass of NSObject) with the lightweight 
generic parameters X, Y, and Z. Here 
<https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/using_imported_lightweight_generics_in_swift>
 are some examples and how they map to Swift, which makes the exact declaration 
syntax a bit more clear.

Regards,
Saagar Jha

> On Mar 28, 2019, at 18:49, Andy Lee  wrote:
> 
> The compiler may accept it, but it doesn't interpret it the way you think.  
> You can confirm by checking whether your class formally conforms to the 
> protocols.  Try this with your old code and your new code, and compare:
> 
> NSLog(@"conforms to protocol? %d", [ImportTool 
> conformsToProtocol:@protocol(NSTableViewDataSource)]);
> 
> I think Quincey is right, what you really did is declare a generic type.  
> It's a subtle mistake.  Notice that this also compiles:
> 
> @interface  ImportTool  : NSObject
> @end
> 
> --Andy
> 
> On Mar 28, 2019, at 7:44 PM, Peter Hudson  <mailto:peter.hud...@me.com>> wrote:
>> 
>> Very strange - the compiler is quite happy with my waywardness. 
>> Peter
>> 
>>> On 28 Mar 2019, at 23:39, Quincey Morris 
>>>  wrote:
>>> 
>>>> On Mar 28, 2019, at 15:58 , Peter Hudson  wrote:
>>>> 
>>>> @interface  ImportTool >>> NSEncoding> : NSObject
>>> 
>>> You’re Doing It Wrong™. You mean:
>>> 
>>>> @interface  ImportTool : NSObject >>> NSTableViewDelegate, NSEncoding>
>>> 
>>> 
>>> I don’t know what it means the way you wrote it. Something about 
>>> lightweight generic syntax, perhaps?
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com 
>> <https://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com>
>> 
>> This email sent to ag...@mac.com <mailto:ag...@mac.com>
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
> <mailto:Cocoa-dev@lists.apple.com>)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com 
> <http://lists.apple.com/>
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com 
> <https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com>
> 
> This email sent to saa...@saagarjha.com <mailto:saa...@saagarjha.com>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Questions regarding the sandbox in iOS

2019-02-05 Thread Saagar Jha
FYI, iOS apps start with their working directory set to “/“ (but don’t depend 
on this!), so trying to write there is going to fail. NSHomeDirectory is an 
easy way to get your sandbox root, but you should probably be using the options 
the others have mentioned.

Regards,
Saagar Jha

> On Feb 4, 2019, at 19:30, Carl Hoefs  wrote:
> 
> iOS 12
> 
> Q1. In general, is an iOS app expected to determine the sandbox path to 
> manage its files? 
> 
> Q2. Does the sandbox behave like the "current working directory" default on 
> macOS? (i.e., if a function writes out a file to just "filename" with no 
> path, does it get written automatically to the sandbox?)
> 
> Q3. What is the proper way to determine the app sandbox path? Is there an 
> app-wide runtime global?
> 
>NSString *sandbox = 
> [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES)
>  lastObject];
> 
> -Carl
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: continuity scanner

2018-11-19 Thread Saagar Jha
Are you asking about Continuity Camera? NSTextView supports this out of the 
box, if you’re using it. If you want to add support to your own views, 
implement NSResponder.validRequestor(forSendType:returnType:) and return 
something that conforms to NSServicesMenuRequestor.

Sent from my iPad

> On Nov 19, 2018, at 02:34, Torsten Curdt  wrote:
> 
> So far I haven't found docs on how to use the continuity scanner in Mojave.
> Is this still Apple only? Or does someone have a pointer to some
> docs/examples?
> 
> cheers,
> Torsten
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Dealing with an @available warning

2018-10-25 Thread Saagar Jha
FWIW, I don’t see this in Objective-C++ either.

Saagar Jha

> On Oct 23, 2018, at 17:54, James Walker  wrote:
> 
> On 10/23/18 5:36 PM, Saagar Jha wrote:
>> Saagar Jha
>>> On Oct 23, 2018, at 17:15, James Walker >> <mailto:jam...@frameforge3d.com>> wrote:
>>> 
>>> On 10/23/18 3:12 PM, Saagar Jha wrote:
>>>> What build command are you using? I’m not seeing any warnings with this 
>>>> code, compiled with clang -x objective-c -framework AppKit 
>>>> -Wunguarded-availability -mmacosx-version-min=10.9 - :
>>> 
>>> If you compile with a deployment version of 10.9, I don't know if it even 
>>> bothers to look at the else clause.  Try -mmacosx-version-min=10.8.
>> Oops, that was a typo. I meant -mmacosx-version-min=10.8. Either way, 
>> @available is checked at runtime, so both cases must be compiled anyways.
>>>> 
>>>> #import 
>>>> 
>>>> int main() {
>>>> NSPrintInfo *info;
>>>> if (@available(macOS 10.9, *)) {
>>>> info.orientation = NSPaperOrientationPortrait;
>>>> } else {
>>>> info.orientation = NSPortraitOrientation;
>>>> }
>>>> }
>>>> 
>>>> Regardless, if you really need a fix, you should be able to cast through 
>>>> NSInteger, instead of NSPrintingOperation, as a fallback.
>>> 
>>> I'm not sure what you mean by "cast through NSInteger", but if I say
>>> 
>>> info.orientation = (NSInteger) NSPortraitOrientation;
>>> 
>>> then there's an error, "assigning to NSPaperOrientation from incompatible 
>>> type NSInteger (aka long)”.
>> I’m not seeing that error at all, even with -Wall -Wextra. What flags are 
>> you using?
> 
> 
> Hmm, it appears to be because I'm using Objective-C++.  When I put that line 
> in a .m file, there was no error.
> 
> 
>>> 
>>>> 
>>>> Saagar Jha
>>>> 
>>>>> On Oct 23, 2018, at 15:01, James Walker >>>> <mailto:jam...@frameforge3d.com>> wrote:
>>>>> 
>>>>> I had some code like this
>>>>> 
>>>>> pInfo.orientation = NSPaperOrientationPortrait;
>>>>> 
>>>>> where pInfo is of type NSPrintInfo*.  When compiling with 
>>>>> -Wunguarded-availability, I got a warning saying that 
>>>>> NSPaperOrientationPortrait is only available on macOS 10.9 and later. So 
>>>>> I wanted to change it to:
>>>>> 
>>>>> if (@available( macOS 10.9, * ))
>>>>> {
>>>>> pInfo.orientation = NSPaperOrientationPortrait;
>>>>> }
>>>>> else
>>>>> {
>>>>> pInfo.orientation = NSPortraitOrientation
>>>>> }
>>>>> 
>>>>> But then I get an error, "assigning to NSPaperOrientation from 
>>>>> incompatible type NSPrintingOrientation".  If I fix the error by adding a 
>>>>> typecast to NSPaperOrientation, then I get a warning that 
>>>>> NSPaperOrientation is only available on 10.9 and later.  Is there any way 
>>>>> out of this roundabout, other than using a later deployment target?
>>> 
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Dealing with an @available warning

2018-10-23 Thread Saagar Jha

Saagar Jha

> On Oct 23, 2018, at 17:15, James Walker  wrote:
> 
> On 10/23/18 3:12 PM, Saagar Jha wrote:
>> What build command are you using? I’m not seeing any warnings with this 
>> code, compiled with clang -x objective-c -framework AppKit 
>> -Wunguarded-availability -mmacosx-version-min=10.9 - :
> 
> If you compile with a deployment version of 10.9, I don't know if it even 
> bothers to look at the else clause.  Try -mmacosx-version-min=10.8.

Oops, that was a typo. I meant -mmacosx-version-min=10.8. Either way, 
@available is checked at runtime, so both cases must be compiled anyways.

>> 
>> #import 
>> 
>> int main() {
>>  NSPrintInfo *info;
>>  if (@available(macOS 10.9, *)) {
>>  info.orientation = NSPaperOrientationPortrait;
>>  } else {
>>  info.orientation = NSPortraitOrientation;
>>  }
>> }
>> 
>> Regardless, if you really need a fix, you should be able to cast through 
>> NSInteger, instead of NSPrintingOperation, as a fallback.
> 
> I'm not sure what you mean by "cast through NSInteger", but if I say
> 
> info.orientation = (NSInteger) NSPortraitOrientation;
> 
> then there's an error, "assigning to NSPaperOrientation from incompatible 
> type NSInteger (aka long)”.

I’m not seeing that error at all, even with -Wall -Wextra. What flags are you 
using?

> 
>> 
>> Saagar Jha
>> 
>>> On Oct 23, 2018, at 15:01, James Walker >> <mailto:jam...@frameforge3d.com>> wrote:
>>> 
>>> I had some code like this
>>> 
>>> pInfo.orientation = NSPaperOrientationPortrait;
>>> 
>>> where pInfo is of type NSPrintInfo*.  When compiling with 
>>> -Wunguarded-availability, I got a warning saying that 
>>> NSPaperOrientationPortrait is only available on macOS 10.9 and later. So I 
>>> wanted to change it to:
>>> 
>>> if (@available( macOS 10.9, * ))
>>> {
>>> pInfo.orientation = NSPaperOrientationPortrait;
>>> }
>>> else
>>> {
>>> pInfo.orientation = NSPortraitOrientation
>>> }
>>> 
>>> But then I get an error, "assigning to NSPaperOrientation from incompatible 
>>> type NSPrintingOrientation".  If I fix the error by adding a typecast to 
>>> NSPaperOrientation, then I get a warning that NSPaperOrientation is only 
>>> available on 10.9 and later.  Is there any way out of this roundabout, 
>>> other than using a later deployment target?
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Dealing with an @available warning

2018-10-23 Thread Saagar Jha
What build command are you using? I’m not seeing any warnings with this code, 
compiled with clang -x objective-c -framework AppKit -Wunguarded-availability 
-mmacosx-version-min=10.9 - :

#import 

int main() {
NSPrintInfo *info;
if (@available(macOS 10.9, *)) {
info.orientation = NSPaperOrientationPortrait;
} else {
info.orientation = NSPortraitOrientation;
}
}

Regardless, if you really need a fix, you should be able to cast through 
NSInteger, instead of NSPrintingOperation, as a fallback.

Saagar Jha

> On Oct 23, 2018, at 15:01, James Walker  wrote:
> 
> I had some code like this
> 
> pInfo.orientation = NSPaperOrientationPortrait;
> 
> where pInfo is of type NSPrintInfo*.  When compiling with 
> -Wunguarded-availability, I got a warning saying that 
> NSPaperOrientationPortrait is only available on macOS 10.9 and later. So I 
> wanted to change it to:
> 
> if (@available( macOS 10.9, * ))
> {
>   pInfo.orientation = NSPaperOrientationPortrait;
> }
> else
> {
>   pInfo.orientation = NSPortraitOrientation
> }
> 
> But then I get an error, "assigning to NSPaperOrientation from incompatible 
> type NSPrintingOrientation".  If I fix the error by adding a typecast to 
> NSPaperOrientation, then I get a warning that NSPaperOrientation is only 
> available on 10.9 and later.  Is there any way out of this roundabout, other 
> than using a later deployment target?
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: C++ pointer to Cocoa object

2018-09-07 Thread Saagar Jha
Usually the way you get an NSAtom is because you’re reading garbage–either 
somebody scribbled over your pointer or it was garbage to begin with. Does 
mCocoaPopupPtr ever get set to nil? Does it have a consistent value? What 
happens if you run with the Address Sanitizer enabled, or with NSZombieEnabled 
set?

Saagar Jha

> On Sep 7, 2018, at 10:46, Casey McDermott  wrote:
> 
> We need to link some of our C++ classes to a matching Cocoa class.
> It's easy for Cocoa to reference C++ objects.  Going the other way is harder.
> 
> We have been using a linker class that has a void pointer to the Obj-C object
> in the C++ header.  We then cast it to a Cocoa object in the Obj-C++ source.
> For example, in the C++ header we have:
> 
> void *mCocoaPopupPtr = nil;
> 
> Then in the source:
> 
> void GSCocoaPopupLinker::setCocoaFieldVisible(const BOOL inValue)
> {
>   if (mCocoaPopupPtr != nil)
>   {
>   GSPopupButton *cocoaPopup = (__bridge GSPopupButton 
> *)mCocoaPopupPtr;
>   [cocoaPopup setHidden : !inValue];
>   }
> }
> 
> Problem is, with ARC turned on, the pointer is never nil, so it crashes.  
> The void pointer somehow becomes an NSAtom instead of 0.
> 
> There's very little documentation on NSAtom, but it appears to be Apple's way 
> to 
> use the excess bits in a 64-bit address to store class info. 
> 
> Is there some other way to test for an invalid void pointer?
> 
> Thanks,
> 
> Casey McDermott
> TurtleSoft.com
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Carbon -> Cocoa

2018-08-22 Thread Saagar Jha


Sent from my iPhone

> On Aug 22, 2018, at 10:40, Alastair Houghton  
> wrote:
> 
>> On 22 Aug 2018, at 17:53, Jens Alfke  wrote:
>> 
>>> On Aug 21, 2018, at 8:33 AM, Alastair Houghton 
>>> mailto:alast...@alastairs-place.net>> wrote:
>>> 
>>> So, for instance, it’s not so good on macOS or iOS if its event dispatcher 
>>> is based on select(), (e)poll() or kqueue() because what you really want on 
>>> macOS/iOS is for the event dispatch to go via CFRunLoop; if it doesn’t, 
>>> you’ll end up having to use threading to run the network library’s event 
>>> loops on background threads, which for an async networking library kind of 
>>> defeats the point IMO.
>> 
>> It does mean you have to spin up one background thread to sit and wait for 
>> events; but that's not a big hardship. You still get the scalability 
>> benefits of event-driven I/O, vs. having to use one thread per socket the 
>> old-fashioned way.
> 
> Well, yes and no. If the network library works that way, it’ll fire its 
> callbacks on the background thread, which makes life awkward if you’re 
> interacting with the UI as you’ll need to forward to the main thread and it 
> may in some cases for you to use synchronisation when you wouldn’t have 
> needed to. Much better to use a library that’s properly integrated with the 
> native run loop and that therefore doesn’t end up calling your code on a 
> background thread.
> 
>> (NSURLSession and Network.framework are doing the same thing under the hood, 
>> after all.)
> 
> Are they? kqueue() supports monitoring of fds, Mach ports and timers, so 
> there’s really no reason that CFRunLoop would have to spawn a background 
> thread just to monitor some file descriptors. As far as I can tell, the 
> current CFRunLoop implementation is built on top of GCD, which sadly we don’t 
> have the source code for

libdispatch is open source: https://github.com/apple/swift-corelibs-libdispatch

> ; I don’t have time to reverse engineer it right now to see whether or not 
> GCD does in fact spawn background thread(s) for this or not, but I see no 
> particular reason it should have to.
> 
> Kind regards,
> 
> Alastair.
> 
> --
> http://alastairs-place.net
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Custom keyboard with search bar not behaving

2018-08-20 Thread Saagar Jha
What does [UIApplication.sharedApplication.keyWindow 
performSelector:@selector(firstResponder)] give you?

Saagar Jha

> On Aug 20, 2018, at 06:16, Steve Mills  wrote:
> 
> I guess I'll try this list as well.
> 
> I’m implementing a custom keyboard for iOS. It contains a UISearchBar the 
> user can use to filter the “keys” they can use to type. When the search 
> button is used, I call [searchBar resignFirstResponder] to have the search 
> bar give up its capture of input. The insertion point has been and still will 
> be blinking in the document view, yet calling [self.textDocumentProxy 
> insertText:s] no longer inserts text into the document.
> 
> I thought this was working earlier in the project development. Any ideas? I 
> see a similar feature working in Google's Gboard. Maybe I need to use a fake 
> search bar so the text input chain never gets disturbed?
> 
> BTW, I've only tested from the Simulator available on my work Mac, which is 
> still maddeningly stuck on macOS 10.10.
> 
> --
> Steve Mills
> Drummer, Mac geek
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Carbon -> Cocoa

2018-08-19 Thread Saagar Jha

Saagar Jha

> On Aug 17, 2018, at 10:51, Jeremy Hughes  wrote:
> 
>> Of course, the C++ business logic doesn't need any changes.  The concern is,
>> how long will it last?  Seems like the future is an entirely Swift-based API
>> that replaces Objective-C Cocoa in 5 years, with no easy way to link to 
>> other languages.
> 
> Core parts of Webkit are written in C++, so I think you’re safe with that.
> 
> I haven’t tried to interface between Swift and C++, but I think it’s possible 
> and will probably get easier. You could ask in the Swift forums.

This isn’t currently possible, and would be a huge undertaking since bridging 
with C++ essentially requires adding the (complex) semantics of C++ to the 
bridging language. That being said, I think this is something that the Swift 
core team was interested in.

> 
> I think ObjC will be around for a while, at least the next ten years.
> 
> Jeremy
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Mac App Store paid upgrades and app settings

2018-08-13 Thread Saagar Jha

Saagar Jha

> On Aug 13, 2018, at 13:40, Martin Wierschin  wrote:
> 
>> So does this mean that the new Mac App Store will allow for upgrade payments 
>> or recurring payments?
> 
> You never know. It’s always possible there are MAS enhancements coming to 
> help facilitate paid updates. Or maybe more permissible guidelines from Apple 
> regarding subscriptions. But I won’t be holding my breath.
> 
> There’s probably ugly workarounds you can do using in-app purchases, to 
> transform a purchased app into a new version via an IAP, but that would be 
> quite contrived and burdensome to implement. Developers are already using 
> IAPs for similar purposes, like free limited-time demos, but that's also not 
> exactly what I’d call a perfect solution for these kinds of needs.
> 
> Well, I was hoping I had missed some nice automatic way to import a sandbox 
> container from a prior version of my app, but I suppose there isn’t. I’ll 
> probably just have to bother the user with an alert and folder selection 
> dialog.

Perhaps you could put both apps in an app group, so they get access to the same 
sandbox container?

> 
> ~Martin Wierschin
> 
> 
>> On Aug 13, 2018, at 1:08 PM, Richard Charles  wrote:
>> 
>> 
>>> On Aug 13, 2018, at 10:17 AM, Martin Wierschin  wrote:
>>> 
>>> The new version is to be a paid upgrade, which I know the MAS doesn't 
>>> really support.
>> 
>> It has been reported that Microsoft Office 365 and Adobe Lightroom are 
>> coming to the new Mac App Store. Those apps surely are not single time 
>> payment apps. So does this mean that the new Mac App Store will allow for 
>> upgrade payments or recurring payments? Perhaps Apple, Microsoft and Adobe 
>> know the answer to that question but are not telling anyone.
>> 
>> --Richard Charles
>> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Archiving a project

2018-08-05 Thread Saagar Jha
There used to be an Xcode mailing list, but it was shut down a while back. I 
assume most of the usual traffic to that list has thoroughly dispersed 
throughout the rest of the lists on this site, as well as help groups elsewhere 
on the internet.

As for making sure your app is the correct one, you could just put an abort 
somewhere in your app’s startup path to make sure your app is being updated. Or 
try poking around the disassembly of the method you’re changing?

Regards,
Saagar Jha

> On Aug 5, 2018, at 16:23, Daniel Santos  wrote:
> 
> Hello,
> 
> Since I couldn’t find a xcode mailing list I am posting this here.
> I have a swift/cocoa app that I developed. I archived it and placed it on the 
> applications folder.
> I am writing an applescript script to drive it using system events.
> There is a button I am activating that causes the application to crash.
> I corrected the bug, re-archived it and ran the applescript again. It crashes 
> anyway.
> I then made some other changes to the line of code stated on the error 
> report, and re-archived it.
> It always crashes on the same line. Even removing an array indexing 
> instruction that is the cause of the error (index out of range)
> 
> I suspect that the archives are not being updated with the compiled code. Am 
> I going nuts ?
> 
> Thanks
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UNIX error exception: 17

2018-06-09 Thread Saagar Jha
I can’t tell you anything else without more details, but I do know that errno 
17 is EEXIST: File exists. Maybe that can help you figure out what’s going 
wrong, or at least give you something to start with?

Saagar Jha

> On Jun 8, 2018, at 19:00, Richard Charles  wrote:
> 
> I have a document based core data application. When ever the application 
> launches the following messages appear in the Console app.
> 
> default   19:45:53.391888 -0600   MyApp   UNIX error exception: 17
> default   19:45:53.392367 -0600   MyApp   0x60268a40 opened 
> /private/var/db/mds/system/mdsDirectory.db: 50744 bytes
> default   19:45:53.393995 -0600   MyApp   UNIX error exception: 17
> default   19:45:53.394243 -0600   MyApp   UNIX error exception: 17
> 
> When the app is launched from within Xcode the debug area is blank.
> 
> Any idea what could be causing this?
> 
> --Richard Charles
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Avoiding link conflicts with a static library

2018-04-05 Thread Saagar Jha
I’m basing this on rdar://problem/19209161 , which 
appears to still be open. I haven’t tried this myself.

Saagar Jha

> On Apr 5, 2018, at 18:06, Alex Zavatone <z...@mac.com> wrote:
> 
> 
>> On Apr 5, 2018, at 7:49 PM, Saagar Jha <saa...@saagarjha.com 
>> <mailto:saa...@saagarjha.com>> wrote:
>> 
>> I think there used to be a bug (might still be?) where Xcode didn’t 
>> automatically strip out the x86 simulator slices when you were archiving.
>> 
>> Saagar Jha
> 
> When looking at the Archive scheme, it should use Release as the build 
> config.  Release will not have i386 in it unless you add it manually.  Like I 
> said, if you set this up in the build configurations, you should be able to 
> get this all to be done automatically.  
> 
> Unless I’m wrong and someone is willing to share a better way to get this 
> organized within Xcode.
> 
> Cheers,
> - Alex Zavatone

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Avoiding link conflicts with a static library

2018-04-05 Thread Saagar Jha
I think there used to be a bug (might still be?) where Xcode didn’t 
automatically strip out the x86 simulator slices when you were archiving.

Saagar Jha

> On Apr 5, 2018, at 07:29, Alex Zavatone <z...@mac.com> wrote:
> 
> 
>> On Apr 5, 2018, at 4:19 AM, Redler Eyal <e...@mellel.com> wrote:
>> 
>>>> 
>>>>> 2. (More importantly) It makes the client's binary larger since it will 
>>>>> have to include our full library, including simulator code. (correct me 
>>>>> if I'm wrong)
>>>> 
>>>> No, you should ask your client to remove the simulator slice before 
>>>> submitting to the App Store.
>>> 
>>> This is controlled in the build settings for release builds.  Compiled 
>>> Simulator code is not packaged and should not be packaged in a release 
>>> build.
>> 
>> My understanding is that the dynamic lib is copied as a resource and not 
>> processed automatically that way.
>> 
> 
> 
> But when it is built, it is built as Release or Debug, unless you have added 
> other build configurations.  When Archive is selected, that uses Release.
> 
> Why would a Simulator i386 architecture be used in a release build?  You can 
> check the configuration and see if that architecture is even there in the 
> build config.
> 
> - Alex Zavatone
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Avoiding link conflicts with a static library

2018-04-05 Thread Saagar Jha
You could weak link against OpenCV then dlopen it at runtime depending on 
whether it’s already loaded or not. As for packaging, I’d stick them both in a 
zip with a README telling them where to drag each thing in Xcode.

Saagar Jha

> On Apr 5, 2018, at 01:42, Redler Eyal <e...@mellel.com> wrote:
> 
>>>>> We have two issues with the dynamic framework
>>>>> 1. It makes it easier to pirate our technology (having our stuff neatly 
>>>>> packaged seperaterly)
>>>> 
>>>> I may be misunderstanding you, but why does your code need to be separate? 
>>>> Can’t you statically link against your framework, which dynamically opens 
>>>> OpenCV (packaged as a framework)?
>>> 
>>> At the moment, we deliver a static framework. This is linked statically to 
>>> the client's app and delivered inside the main executable to the app store. 
>>> If we switch to a dynamic library then our library will be a separate 
>>> component that is delivered as such to the app store. The potential pirate 
>>> will only have to dig our the library from the application package (and 
>>> overcome the other protections, of-course)
>> 
>> OK, but is there anything stopping you from having your static library 
>> dynamically open OpenCV?
> 
> Perhaps not but I'm wondering
> a. Will it actually solve the issue (the conflict with the clients OpenCV)?
> b. Is it possible to package a static framework with a dynamic library in one 
> package?
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Avoiding link conflicts with a static library

2018-04-04 Thread Saagar Jha

Saagar Jha

> On Apr 4, 2018, at 12:55, Redler Eyal <e...@mellel.com> wrote:
> 
>>>>> On Apr 4, 2018, at 9:25 AM, Redler Eyal <e...@mellel.com> wrote:
>>>>> 
>>>>> We are aware that the following are possible solutions to the problem:
>>>>> a. Switch to use the same version of OpenCV as our client.
>>>>> b. Build our framework as a dynamic library (where we a supposed to be 
>>>>> able to hide openCV inside)
>>>>> Both of these options are not optimal for us and we trying to see if we 
>>>>> have any other option.
>>>> 
>>>> Those are the only options I know will work. (But I'm not a linker expert, 
>>>> and it may be that you could get the single-object pre-link to work.)
>>>> 
>>>> I also work on a 3rd party iOS SDK*; version 1.x was shipped as a static 
>>>> library, but it was such a pain in the butt in many ways. We only did it 
>>>> that way because we started back before iOS apps were allowed to contain 
>>>> dynamic libraries. In 2.0 we happily switched to a framework.
>>>> 
>>>> I would highly recommend switching to a dynamic library (actually a 
>>>> framework**.) It's the way things are Supposed To Work™, and it's a lot 
>>>> cleaner.
>>>> 
>>>> —Jens
>>>> 
>>>> * https://github.com/couchbase/couchbase-lite-ios/
>>>> ** Apple will reject submissions that include 'bare' dylibs in the app 
>>>> bundle.
>>> 
>>> We have two issues with the dynamic framework
>>> 1. It makes it easier to pirate our technology (having our stuff neatly 
>>> packaged seperaterly)
>> 
>> I may be misunderstanding you, but why does your code need to be separate? 
>> Can’t you statically link against your framework, which dynamically opens 
>> OpenCV (packaged as a framework)?
> 
> At the moment, we deliver a static framework. This is linked statically to 
> the client's app and delivered inside the main executable to the app store. 
> If we switch to a dynamic library then our library will be a separate 
> component that is delivered as such to the app store. The potential pirate 
> will only have to dig our the library from the application package (and 
> overcome the other protections, of-course)

OK, but is there anything stopping you from having your static library 
dynamically open OpenCV?

> 
>> 
>>> 2. (More importantly) It makes the client's binary larger since it will 
>>> have to include our full library, including simulator code. (correct me if 
>>> I'm wrong)
>> 
>> No, you should ask your client to remove the simulator slice before 
>> submitting to the App Store.
> 
> I guess, but it would hurt the usage simplicity. Certainly compared to the 
> current solution as a static library.
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Avoiding link conflicts with a static library

2018-04-04 Thread Saagar Jha

Saagar Jha

> On Apr 4, 2018, at 12:17, Redler Eyal <e...@mellel.com> wrote:
> 
>>> On Apr 4, 2018, at 9:25 AM, Redler Eyal <e...@mellel.com> wrote:
>>> 
>>> We are aware that the following are possible solutions to the problem:
>>> a. Switch to use the same version of OpenCV as our client.
>>> b. Build our framework as a dynamic library (where we a supposed to be able 
>>> to hide openCV inside)
>>> Both of these options are not optimal for us and we trying to see if we 
>>> have any other option.
>> 
>> Those are the only options I know will work. (But I'm not a linker expert, 
>> and it may be that you could get the single-object pre-link to work.)
>> 
>> I also work on a 3rd party iOS SDK*; version 1.x was shipped as a static 
>> library, but it was such a pain in the butt in many ways. We only did it 
>> that way because we started back before iOS apps were allowed to contain 
>> dynamic libraries. In 2.0 we happily switched to a framework.
>> 
>> I would highly recommend switching to a dynamic library (actually a 
>> framework**.) It's the way things are Supposed To Work™, and it's a lot 
>> cleaner.
>> 
>> —Jens
>> 
>> * https://github.com/couchbase/couchbase-lite-ios/
>> ** Apple will reject submissions that include 'bare' dylibs in the app 
>> bundle.
> 
> We have two issues with the dynamic framework
> 1. It makes it easier to pirate our technology (having our stuff neatly 
> packaged seperaterly)

I may be misunderstanding you, but why does your code need to be separate? 
Can’t you statically link against your framework, which dynamically opens 
OpenCV (packaged as a framework)?

> 2. (More importantly) It makes the client's binary larger since it will have 
> to include our full library, including simulator code. (correct me if I'm 
> wrong)

No, you should ask your client to remove the simulator slice before submitting 
to the App Store.

> 
> Eyal
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Custom font in IB doesn't work reliably

2018-02-12 Thread Saagar Jha
Is this only happening in Interface Builder, or does it occur when running your 
app as well?

Saagar Jha

> On Feb 12, 2018, at 13:48, Viacheslav Karamov <ubuntul...@yandex.ru> wrote:
> 
> I'm using custom iconic font in my project, added it to info.plist and "Copy 
> Bundle Resources" phase.
> 
> I set this as the font of labels in IB, but sometimes the glyphs from my font 
> are rendered using system font.
> 
> It happens rarely, but still. How can I avoid this?
> 
> 
> Thanks,
> 
> Viacheslav.
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CBPeripheralManager state unsupported Mac OS 10.12.6

2018-02-06 Thread Saagar Jha
Wait, is it returning “unknown” or “unsupported”?

Saagar Jha

> On Feb 5, 2018, at 21:20, Devarshi Kulshreshtha <devarshi.bluec...@gmail.com> 
> wrote:
> 
> My macbook is - MacBook Pro (13-inch, 2017)
> System Information shows -
> Bluetooth Low Energy Supported:   Yes
> LMP Version: 4.2 (0x8)
> 
> I know that if it shows a version of '0x6' or greater, BT 4.0 is supported. 
> However for some reasons I am getting state as unknown in the delegate.
> 
> 
> On Tue, Feb 6, 2018 at 2:07 AM, Saagar Jha <saa...@saagarjha.com 
> <mailto:saa...@saagarjha.com>> wrote:
> What Mac are you using? Are you sure your Mac supports Bluetooth LE (I’m sure 
> you already know this, but I just wanted to make sure)?
> 
> Saagar Jha
> 
>> On Feb 5, 2018, at 05:25, Devarshi Kulshreshtha <devarshi.bluec...@gmail.com 
>> <mailto:devarshi.bluec...@gmail.com>> wrote:
>> 
>> I am trying to turn my macbook into BLE by using below code:
>> 
>> var peripheralManager: CBPeripheralManager!
>> let uuid = "A6C4C5FA-A8DD-4BA1-B9A8-A240584F02D3"
>> 
>> let options = [CBCentralManagerOptionShowPowerAlertKey:0]
>> manager = CBPeripheralManager(delegate: self, queue: nil, options: options)
>> 
>> For some reasons peripheral state being received in below delegate is
>> unsupported :
>> 
>> func peripheralManagerDidUpdateState(_ peripheral: CBPeripheralManager) {
>>if peripheral.state == .poweredOn {
>>let dataToBeAdvertised:[String: [AnyObject]] =
>> [CBAdvertisementDataServiceUUIDsKey : [CBUUID(string: uuid)]]
>>peripheralManager.startAdvertising(dataToBeAdvertised)
>>}
>> }
>> 
>> Any ideas on what could be the issue?
>> 
>> -- 
>> Thanks,
>> 
>> Devarshi
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
>> <mailto:Cocoa-dev@lists.apple.com>)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com 
>> <http://lists.apple.com/>
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com 
>> <https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com>
>> 
>> This email sent to saa...@saagarjha.com <mailto:saa...@saagarjha.com>
> 
> 
> 
> 
> -- 
> Thanks,
> 
> Devarshi

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CBPeripheralManager state unsupported Mac OS 10.12.6

2018-02-05 Thread Saagar Jha
What Mac are you using? Are you sure your Mac supports Bluetooth LE (I’m sure 
you already know this, but I just wanted to make sure)?

Saagar Jha

> On Feb 5, 2018, at 05:25, Devarshi Kulshreshtha <devarshi.bluec...@gmail.com> 
> wrote:
> 
> I am trying to turn my macbook into BLE by using below code:
> 
> var peripheralManager: CBPeripheralManager!
> let uuid = "A6C4C5FA-A8DD-4BA1-B9A8-A240584F02D3"
> 
> let options = [CBCentralManagerOptionShowPowerAlertKey:0]
> manager = CBPeripheralManager(delegate: self, queue: nil, options: options)
> 
> For some reasons peripheral state being received in below delegate is
> unsupported :
> 
> func peripheralManagerDidUpdateState(_ peripheral: CBPeripheralManager) {
>if peripheral.state == .poweredOn {
>let dataToBeAdvertised:[String: [AnyObject]] =
> [CBAdvertisementDataServiceUUIDsKey : [CBUUID(string: uuid)]]
>peripheralManager.startAdvertising(dataToBeAdvertised)
>}
> }
> 
> Any ideas on what could be the issue?
> 
> -- 
> Thanks,
> 
> Devarshi
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Checking if a string is valid JSON

2018-01-29 Thread Saagar Jha

Saagar Jha

> On Jan 29, 2018, at 13:25, Quincey Morris 
> <quinceymor...@rivergatesoftware.com> wrote:
> 
> On Jan 29, 2018, at 12:42 , Eric E. Dolecki <edole...@gmail.com> wrote:
>> 
>> So this would do it?
> 
> I would strongly recommend using JSONDecoder instead of JSONSerialization. 
> The errors JSONDecoder throws are AFAIK more detailed than JSONSerialization, 
> and will tell you the exact location in the string of any error you find.

Uhh…JSONDecoder swallows all of JSONSerialization’s errors and wraps it into 
its own 
<https://github.com/apple/swift/blob/e5fdc0955ce662bd929c7e1706d4a1f1d0f5d397/stdlib/public/SDK/Foundation/JSONEncoder.swift#L1097>.
 I’m not sure this counts as “more detailed”.

> 
> Also, FWIW, I beg you not to use this pattern (if you actually do, outside of 
> this sample fragment):
> 
>>   let jsonData = jsonString.data(using: String.Encoding.utf8)
>>  …
>>   _ = try JSONSerialization.jsonObject(with: jsonData!)
> 
> 
> but do this instead:
> 
>>   let jsonData = jsonString.data(using: String.Encoding.utf8)!
>>  …
>>   _ = try JSONSerialization.jsonObject(with: jsonData)
> 
> 
> That is, don’t let optionals “escape” from the place where they first appear. 
> If, in real code, you’re going to make the string decoding failure a handled 
> error too, then this would of course become:
> 
>>   if let jsonData = jsonString.data(using: String.Encoding.utf8) {
>>  …
>>  …
>>   _ = try JSONSerialization.jsonObject(with: jsonData)
> 
> 
> where the optional still doesn’t escape from its point of appearance.
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Checking if a string is valid JSON

2018-01-29 Thread Saagar Jha
I believe jsonObject(with:options) will throw if the JSON is invalid, so you 
might be able to get away with just the try/catch. Besides, your JSON top level 
object might be an array, in which case I’d expect that casting to an 
NSDictionary would fail.

Saagar Jha

> On Jan 29, 2018, at 12:17, Eric E. Dolecki <edole...@gmail.com> wrote:
> 
> I am generating a String of JSON. Before I use it, I want to check to make
> sure that it's valid. My code is below. Does this look alright?
> 
> Thanks,
> Eric
> 
> 
> 
>let jsonString = composedString
> 
>let jsonData = jsonString.data(using: String.Encoding.utf8)
> 
>do {
> 
>if (try JSONSerialization.jsonObject(with: jsonData!, options:
> []) as? NSDictionary) != nil {
> 
>print("JSON is a dictionary. Valid.")
> 
>} else {
> 
>print("Not valid JSON data.")
> 
>}
> 
>} catch let error as NSError {
> 
>print("Not valid JSON. \(error.localizedDescription)")
> 
>}
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Crash in Touchbar

2018-01-29 Thread Saagar Jha

Saagar Jha

> On Jan 29, 2018, at 06:06, sumit bansal <sumitonline.ban...@gmail.com> wrote:
> 
> Hi All,
> 
> I am getting 2 non-reproducible crashes in my application related to Touch
> Bar. It may be the bug in Appkit code. Does anyone has any idea about it?
> 
> 
> ==
> Stack#1
> 
> Application Specific Information:
> objc_msgSend() selector name: convertPoint:fromView:
> 
> 
> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
> 0   libobjc.A.dylib0x7fffa725605d objc_msgSend + 29
> 1   com.apple.AppKit  0x7fff902c7120
> -[_NSScrubberPressAndHoldTransposer transposeTouch:] + 199
> 2   com.apple.AppKit  0x7fff902de112
> -[NSTouchBarPressAndHoldTransposer transposeEvent:] + 653
> 3   com.apple.AppKit  0x7fff9078d462
> __37-[NSTouchBarItemOverlay trackTouches]_block_invoke + 89
> 4   com.apple.AppKit  0x7fff904d222d __50-[NSTouchDevice
> _commandeerDirectTouches:handler:]_block_invoke + 237
> 5   com.apple.AppKit  0x7fff9044a469
> _NSSendEventToDequingObservers + 372
> 6   com.apple.AppKit  0x7fff9063706e
> -[NSApplication(NSEvent)
> _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 876
> 7   com.apple.AppKit  0x7fff8feb03db -[NSApplication run] +
> 926
> 
> 
> ==
> Stack#2
> 
> Crashed Thread:0  Dispatch queue: com.apple.main-thread
> 
> Exception Type:EXC_BAD_ACCESS (SIGSEGV)
> Exception Codes:   KERN_INVALID_ADDRESS at 0x40dedeadbec0

This address looks very suspicious, and it might be trying to tell you 
something. Try turning on zombies and seeing if you can reproduce the crash 
again.

> Exception Note:EXC_CORPSE_NOTIFY
> 
> Termination Signal:Segmentation fault: 11
> Termination Reason:Namespace SIGNAL, Code 0xb
> Terminating Process:   exc handler [0]
> 
> VM Regions Near 0x40dedeadbec0:
>Memory Tag 255 3e811498-3e8114a0 [  512K]
> rw-/rwx SM=PRV
> -->
>MALLOC_NANO6000-6400 [ 64.0M]
> rw-/rwx SM=PRV
> 
> Application Specific Information:
> objc_msgSend() selector name: removeFromSuperview
> 
> 
> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
> 0   libobjc.A.dylib0x7fff7cb68e9d objc_msgSend + 29
> 1   com.apple.AppKit  0x7fff53efad2e
> -[NSTouchBarColorPickerSwitcher hidePopover:] + 51
> 2   com.apple.AppKit  0x7fff534d8cef -[NSView
> _setSuperview:] + 212
> 3   com.apple.AppKit  0x7fff534ddc7d -[NSView
> removeFromSuperview] + 252
> 4   com.apple.AppKit  0x7fff535f1740 -[NSView
> removeFromSuperviewWithoutNeedingDisplay] + 38
> 5   com.apple.AppKit  0x7fff53da0690 -[NSView _finalize] +
> 1068
> 6   com.apple.AppKit  0x7fff534eba62 -[NSView dealloc] + 164
> 7   com.apple.AppKit  0x7fff53b98d86
> -[_NSTouchBarColorPickerContainerView dealloc] + 111
> 8   com.apple.AppKit  0x7fff537932f4 -[NSViewController
> dealloc] + 224
> 9   com.apple.AppKit  0x7fff53ed278c
> -[NSTouchBarColorPickerViewController dealloc] + 161
> 10  com.apple.AppKit  0x7fff5353beed -[NSViewController
> release] + 127
> 11  com.apple.AppKit  0x7fff535f1edc -[NSAutounbinder
> dealloc] + 56
> 12  libobjc.A.dylib0x7fff7cb6c087 (anonymous
> namespace)::AutoreleasePoolPage::pop(void*) + 817
> 13  com.apple.CoreFoundation  0x7fff55ed55d6 _CFAutoreleasePoolPop
> + 22
> 14  com.apple.CoreFoundation  0x7fff55f169ec __CFRunLoopRun + 2620
> 15  com.apple.CoreFoundation  0x7fff55f15d23 CFRunLoopRunSpecific +
> 483
> 16  com.apple.HIToolbox0x7fff5522de26
> RunCurrentEventLoopInMode + 286
> 17  com.apple.HIToolbox0x7fff5522db96
> ReceiveNextEventCommon + 613
> 18  com.apple.HIToolbox0x7fff5522d914
> _BlockUntilNextEventMatchingListInModeWithFilter + 64
> 19  com.apple.AppKit  0x7fff534f8f5f _DPSNextEvent + 2085
> 20  com.apple.AppKit  0x7fff53c8eb4c
> -[NSApplication(NSEvent)
> _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 3044
> 21  com.apple.AppKit  0x7fff534edd6d -[NSApplication run] +
> 764
> 22  com.adobe.exo.framework0x00010b6b5f48
> exo::app::OS_AppBase::RunEventLoop() + 56
> 
> ==

Re: Draw an arc given 2 angles.

2018-01-25 Thread Saagar Jha

Saagar Jha

> On Jan 25, 2018, at 09:47, Eric E. Dolecki <edole...@gmail.com> wrote:
> 
> I've been googling without great success so far.
> 
> I would like to draw a 6px thick red arc (not wedge), 0º at the top of the
> screen, and from say 60° - 110º. Assume I have to create a UIBezierPath,
> and then create a CAShapeLayer with that bezier path? Then add the shape
> layer to a UIView that I have.
> 
> I'll be given the 2 angles to use via sliders - so I can update the arc
> (later). I just want to nail down an initial arc. Below doesn't work.
> 
> 1. How do I get things so 0º is at the top, rotate circle 90º
> counterclockwise?
> 2. How can I get the red arc?
> 
> Thanks!
> 
> // Circle is a UIView with a height and width of 300
> 
> let centre = CGPoint (x: circle.frame.size.width / 2, y: circle.frame.size.
> height / 2)
> 
> let startAngle: CGFloat = 70.0
> 
> let endAngle: CGFloat = 100
> 
> let a_path = UIBezierPath()
> 
> a_path.move(to: CGPoint(x: circle.frame.width / 2, y: circle.frame.height
> / 2))

It looks like you’re starting from the center of the arc. I don’t think your 
arc will show up if you do this since the “radius” of it is 0.

> 
> a_path.addArc(withCenter: centre, radius: 150, startAngle: CGFloat
> (startAngle).toRadians(), endAngle: CGFloat(endAngle).toRadians(),
> clockwise: true)
> 
> 
> // Want a red stroke on the arc, I get filled black wedge instead
> 
> let redColor = UIColor.red
> 
> redColor.setStroke()
> 
> a_path.lineWidth = 6
> 
> a_path.lineCapStyle = .round
> 
> a_path.stroke()
> 
> 
> 
> let a_shapeLayer = CAShapeLayer()
> 
> a_shapeLayer.path = a_path.cgPath
> 
> 
> circle.layer.sublayers?.forEach { $0.removeFromSuperlayer() }
> 
> circle.layer.addSublayer(a_shapeLayer)
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Size of compiled NIBs in Xcode 9 (10.13 SDK)

2018-01-24 Thread Saagar Jha
Have you tried assetutil? Run it with assetutil —info [Assets.car]

Saagar Jha

> On Jan 24, 2018, at 13:24, Alex Zavatone <z...@mac.com> wrote:
> 
> I think I may have asked this before, but is there a tool or command line 
> available to unpack these assets.car files so that we can inspect what’s 
> inside?
> 
> Thanks,
> Alex Zavatone
> 
>> On Jan 24, 2018, at 1:56 PM, Jeremy Hughes <moon.rab...@virginmedia.com 
>> <mailto:moon.rab...@virginmedia.com>> wrote:
>> 
>>> On 24 Jan 2018, at 19:46, Dragan Milić <mi...@mac.com> wrote:
>>> 
>>> BTW, in both cases (Xcode 9 - 10.13 SDK and Xcode 8 - 10.12 SDK) the 
>>> deployment target is macOS 10.11, so I don't think that setting matters.
>> 
>> Vince has explained why it does matter.
>> 
>> If you change the deployment target to 10.13 (which you probably don’t want 
>> to do) the application icons should no longer be duplicated. They’re 
>> currently being duplicated for backwards compatibility with old systems.
>> 
>> Jeremy
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com 
>> <https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com>
>> 
>> This email sent to z...@mac.com <mailto:z...@mac.com>
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
> <mailto:Cocoa-dev@lists.apple.com>)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com 
> <http://lists.apple.com/>
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com 
> <https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com>
> 
> This email sent to saa...@saagarjha.com <mailto:saa...@saagarjha.com>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Deciphering an error message on an iOS UITextField subclass.

2018-01-18 Thread Saagar Jha
So, I don’t see you trying [cell.dataField property] in your log below. Does 
this work?

Saagar Jha

> On Jan 17, 2018, at 20:27, Alex Zavatone <z...@mac.com> wrote:
> 
> 
>> On Jan 17, 2018, at 9:28 PM, Saagar Jha <saa...@saagarjha.com 
>> <mailto:saa...@saagarjha.com>> wrote:
>> 
>> 
>> Saagar Jha
>> 
>>> On Jan 17, 2018, at 18:52, Alex Zavatone <z...@mac.com 
>>> <mailto:z...@mac.com>> wrote:
>>> 
>>> Nope. That is what is causes the error.
>> 
>> So what is the error you’re getting? Seeing what it is can help us figure 
>> out why the debugger can’t find the property.
> 
> Since I was brief before, here is the debug info from the console:
> 
> (lldb) po [cell isKindOfClass:[UITableViewCell class]] 
> 0x000110ffb001
> 
> (lldb) po cell
>  UITableViewCell; frame = (0 28; 834 80); text = 'Title'; clipsToBounds = YES; 
> autoresize = W; layer = >
> 
> (lldb) po cell.dataField
>  97 34); text = ''; opaque = NO; autoresize = RM+BM; gestureRecognizers = 
> ; layer = >
> 
> (lldb) po [cell.dataField isKindOfClass:[UITextField class]]
> error: reference to 'UITextField' is ambiguous
> candidate found by name lookup is 'UITextField'
> candidate found by name lookup is 'UITextField'
> error: receiver type 'UITextField' is not an Objective-C class
> (lldb) po cell.dataField.keyboardType
> error: property 'keyboardType' not found on object of type 'InsetUITextField 
> *'
> (lldb) po cell.dataField.text
> error: property 'text' not found on object of type 'InsetUITextField *'
> (lldb) po cell.dataField.class
> error: property 'class' not found on object of type 'InsetUITextField *'
> (lldb) po [cell.dataField class]
> InsetUITextField
> 
> 
> 
> 
> And for Quincy’s request…
> 
> (lldb) print [cell.dataField isKindOfClass:[UITextField class]]
> error: reference to 'UITextField' is ambiguous
> candidate found by name lookup is 'UITextField'
> candidate found by name lookup is 'UITextField'
> error: receiver type 'UITextField' is not an Objective-C class
> 
> My first suspicion is that multiple includes are confusing the debugger and 
> that the error resides with the man behind the keyboard in that it is related 
> to my subclassing of UITextField.  Next, I’m going to check that it is 
> initialized properly.  
> 
> I’m going to test spitting out a brand new instance of InsetUITextField as 
> soon as
>   the view controller is instanced,
>   the inset field is tapped on
> 
> Thanks everyone.   
> 
> Alex Zavatone
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Deciphering an error message on an iOS UITextField subclass.

2018-01-17 Thread Saagar Jha
If you’re being lazy, just use the selector for the getter: [cell.dataField 
property]. It might not perform checking, but it will work if the selector is 
defined.

Saagar Jha

> On Jan 17, 2018, at 17:24, Alex Zavatone <z...@mac.com> wrote:
> 
> Xcode 9.2, iOS 11.2
> 
> In a UITableViewCell subclass, I have a subclass of UITextField, which insets 
> the text being entered by 10 pixels.
> 
> The InsetUITextField interface is below.  It clearly inherits from 
> UITextField:
> 
> @interface InsetUITextField : UITextField
> 
> In the UITableViewCell subclass, I import the InsetUITextField.h and have a 
> property called dataField.  It looks like this:
> 
> @property (strong, nonatomic) IBOutlet InsetUITextField *dataField;
> 
> The outlet is correctly wired up to the InsetUITextField within the expected 
> UITableViewCell subclass cell in one and only one scene in the storyboard.
> 
> The class of the custom cell and the InsetUITextField within the storyboard 
> scene are correct and the identifier on the cell is correct.
> 
> Naturally, this UITextField subclass exists to allow the user to enter text 
> within a UiTableViewCell subclass and it works.  
> 
> Right now, I have tapped on the field and the keyboard is displayed. In the 
> debugger, I can print the object.
> 
> po cell.dataField
>  97 34); text = ''; opaque = NO; autoresize = RM+BM; gestureRecognizers = 
> ; layer = >
> 
> But I can’t access any property of that object.
> 
> Here is the problem.  
> 
> po [cell.dataField isKindOfClass:[UITextField class]]
> error: reference to 'UITextField' is ambiguous
> candidate found by name lookup is 'UITextField'
> candidate found by name lookup is ‘UITextField'
> 
> Am I right in assuming that Xcode thinks that the subclass has 2 possible 
> UITextField parent classes?
> 
> Thanks.
> 
> Alex Zavatone
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: bare bones app crashing, is it a code signing issue?

2017-10-13 Thread Saagar Jha

Saagar Jha

> On Oct 12, 2017, at 20:55, Navneet Kumar <navnee...@me.com> wrote:
> 
> Hi,
> I have MacOS High Sierra and Xcode 9.
> When I start a new project without any development team, choosing Obj-c, and 
> adding nothing to the code, the app starts and shows the window.
> 
> Now I added my Apple ID in Xcode accounts preferences, a cert is created and 
> a personal team is created bearing my name.
> I am not part of Developer Program.
> 
> Now if I create a new project, this time choosing the personal team and 
> adding nothing to the code, the app crashes.
> The only warning when compiling is about unable to build chain to self signed 
> root.
> I have set the cert to “Always trust” for all in keychain access. 
> 
> Main Thread-> EXC_BAD_INSTRUCTION at instruction ud2.

This generally means your code is trapping at an abort somewhere. Do you have a 
stack trace so we can see which function this is in?

> 
> Same happens with other projects where I have coded and tried to code sign.
> 
> Please help.
> 
> Thanks,
> Navneet
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [webkit-dev] How to display new MIME types?

2017-07-21 Thread Saagar Jha
Sorry, I meant extension–the JavaScript (and Swift?)-based ones that Safari 
currently supports.

Saagar Jha

> On Jul 20, 2017, at 17:41, Daryle Walker <dary...@mac.com> wrote:
> 
> 
>> On Jul 20, 2017, at 7:38 PM, Saagar Jha <saa...@saagarjha.com> wrote:
>> 
>> I remember asking one of the WebKit engineers a similar question. Her 
>> response was that NPAPI was basically deprecated, and she suggested writing 
>> a plugin in that intercepted links and displayed its own UI when necessary.
> 
> What kind of plug-in? One still using NPAPI? Some other format?
> 
> — 
> Daryle Walker
> Mac, Internet, and Video Game Junkie
> darylew AT mac DOT com 
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [webkit-dev] How to display new MIME types?

2017-07-20 Thread Saagar Jha
I remember asking one of the WebKit engineers a similar question. Her response 
was that NPAPI was basically deprecated, and she suggested writing a plugin in 
that intercepted links and displayed its own UI when necessary.

Saagar Jha

> On Jul 20, 2017, at 15:50, Daryle Walker <dary...@mac.com> wrote:
> 
> [I originally had this on the WebKit development list first.]
> 
>> On Jul 18, 2017, at 3:31 PM, Daryle Walker <dary...@mac.com> wrote:
>> 
>> [I’m not sure this is the right forum.]
>> 
>> If I want Safari for Mac to display a new MIME type, how do I do it? I know 
>> there used to be an Apple-custom API for this, but it was deprecated for 
>> classic Netscape plug-ins long ago. However, those NPAPI plug-ins have been 
>> deprecated themselves across platforms for many years. There are the newest 
>> Safari extensions, which are versions of Apple’s app-extensions API, but 
>> those only do JavaScript modifications and such, and don’t cover new types 
>> (I think). Am I completely out of luck now? Can I still try NPAPI?
> 
> — 
> Daryle Walker
> Mac, Internet, and Video Game Junkie
> darylew AT mac DOT com 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Who owns a child view controller?

2017-07-14 Thread Saagar Jha
 Swift book says:
> >
> > "The examples above show how to use safe unowned references. Swift also
> provides unsafe unowned references for cases where you need to disable
> runtime safety checks—for example, for performance reasons. As with all
> unsafe operations, you take on the responsiblity for checking that code for
> safety.
> >
> > "You indicate an unsafe unowned reference by writing unowned(unsafe). If
> you try to access an unsafe unowned reference after the instance that it
> refers to is deallocated, your program will try to access the memory
> location where the instance used to be, which is an unsafe operation.”
> >
> > At this point I’m pretty confused about the difference between strong
> and safe unowned. I understand that strong retains its reference, but it
> seems to me that Dave Abrahams and Apple’s Swift book are saying or
> implying that (safe) unowned also retains its reference - so the
> consequence of using (safe) unowned incorrectly is that it will create a
> retain cycle, whereas using unowned(unsafe) incorrectly will crash. But if
> unowned(safe) retains its reference, how is it different from strong (apart
> from whether ARC is currently optimising for it)?
> >
> > 2. When to use weak or unowned in closure capture lists (rather than
> default to strong) is also pretty confusing! Presumably the default strong
> option is correct for some or most closures, but I don’t have a very clear
> idea of when it’s not correct.
> >
> > 3. Whether (and when) it’s necessary to avoid using functions or class
> variables whose name begins with new or copy. I don’t think this is
> discussed in Apple’s Swift book (or I haven’t found where it’s discussed),
> but I think it’s necessary for classes that interface with Objective C in
> some way (e.g. subclasses of Cocoa classes).
> >
> > My experience of memory management in Objective-C and Swift (after many
> years of experience with C and C++) is that it mostly “just works” (as
> Apple say in the Swift book) - but there are many cases where you need a
> deeper understanding and it’s hard to find clear explanations.
> >
> > Jeremy
> >
> >
> >
> >
> > ___
> >
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> > https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> >
> > This email sent to z...@mac.com
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
>
> This email sent to saa...@saagarjha.com
>
-- 
-Saagar Jha
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Auto Layout Question

2017-05-24 Thread Saagar Jha
Could you attach a screenshot? You got cut off in the middle, so it’s hard to 
fully understand how the sizes relate.

Saagar Jha

> On May 24, 2017, at 08:52, Dave <d...@looktowindward.com> wrote:
> 
> iOS Project.
> 
> Hi,
> 
> I’m trying to do something with auto layout and I can’t seem to get it right.
> 
> I want to create a View that holds a Text Field and a View. Call these LabelA 
> and ViewA. I want the Text to appear above the view and i want the View to 
> have the same aspect ratio (which is 1:1). I then want the same again, 
> e.g.another Text Field and View, positioned in the same manner.
> 
> In XCode/IB 8.3.2, here’s what I do:
> 
> I create a Label Field, and Set the Text to “Side A", set a custom font of 
> size 10, call it SideALabel. I create a UIView (call it SideAView) and set 
> its size to 35,35 and set the Background Colour to Red. I add an Aspect Ratio 
> constraint of 1:1 to SideAView  I then position and resize SideALabel so it 
> has a height of 10 and the width is 35 (same as the UIView). I set then an 
> Alignment Constraint Leading and Trailing Edges between SideALabel and 
> SideAView. I now embed the SideALabel and SideAView in a StackView, call this 
> SideAStackView. It now resizes/repositions the Stack and I move it where I 
> want it. When I switch to different iPhone’s in XCode/IB it rescales 
> accordingly. 
> 
> I actually want two of these Text/Views Combinations, so I duplicate the 
> Stack View (call it SideBStackView) and position it to the right of 
> SideAStackView). I change the Text to “Side B” and the background color the 
> View to Blue.
> 
>  Side A Side B
> +—+  +—+
> ||   |   |  
> |   Red  |   |  Blue  |  
> ||   |   |  
> +—+  +—+
> 
> The problem is that the StackViews resize so they are of different sizes.
> 
> I then embedded  SideAStackView and SideBStackView in another StackView - 
> call it SideSelectionStackView, I then set this new StackView’s distribution 
> to “Fill Equally” (I’ve also tried “Fill Proportionally” ) and set the 
> spacing so there is a gap between SideAStackView and SidebStackView. This 
> almost works, except the height of the Text and View Sizes are slightly 
> different. SideA has a higher text box/bigger font and the View is slightly 
> smaller. SideB Text is 
> 
> I’ve set the Left, Bottom, Right Constraints, so that basically it grows 
> upwards from the bottom of the Screen, but because of the aspect ratio it 
> can’t get too big. I have another View situated to the right of this and the 
> stack view is set to only extend so far from the left of this view.
> 
> I’ve tried everything I can think of to make this work but I’ve now run out 
> of ideas.
> 
> Am I missing something? Maybe I am going about this in the wrong way? 
> 
> Any help and suggestions on the best way of doing this would be greatly 
> appreciated.
> 
> I’m trying to prepare a demo for tomorrow afternoon and it would be really 
> great if I could show this displaying correctly.
> 
> All the Best
> Dave
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: scrolling woes

2017-05-20 Thread Saagar Jha
I haven’t seen your xib files, so this is just a guess, but here it goes:

Saagar Jha

> On May 20, 2017, at 06:00, J.E. Schotsman <jesc...@xs4all.nl> wrote:
> 
> Hello,
> 
> I had a text field within a tab view item whose text was getting too large.
> So I embedded it in a scroll view. No matter what I tried in the xib editor, 
> I couldn't get the scrolling to work.
> Does this have to be so hard?

Scroll views are dependent on the content size of their subviews. This can be 
done
by setting unambiguous constraints to the margins of the scroll view
by manually setting the contentSize of the scroll view.
If you don’t do either of these, the scroll view won’t work.

> 
> After a little googling I realised I could use a text view instead.

Yes, you probably should.

> So I dumbed down the text view to a text field with vertical scroll bar in 
> the xib.
> After setting the scroller enabled (why would you want a scroll bar that is 
> visible, yet not enabled?) it started to work.

Wait, what? How did you “dumb” down the text view? Did you start deleting 
components? In general, this isn’t what you want to do; you can control whether 
the scroll bars are shown through code or the inspector on the right side. What 
behavior are you trying to achieve?

> 
> This is a reasonable workaround except that now I have no placeholder value 
> (would have to code that myself) and I noticed a curious bug in the text 
> field (which would probably happen in an embedded text field as well):
> 
> Suppose I have three options for the text, one lets the scroll bar autohide, 
> the second text is too large, the third text barely fits if the scroll bar is 
> hidden. Now the look of the third text depends on the previous value: it can 
> show without the scroll bar being visible, or it can show with the scroll bar.
> 
> Jan E.
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: iOS TableView moving down

2017-04-28 Thread Saagar Jha

Saagar Jha

> On Apr 28, 2017, at 20:22, Gerriet M. Denkmann <gerri...@icloud.com> wrote:
> 
>> 
>> On 23 Apr 2017, at 14:45, Quincey Morris 
>> <quinceymor...@rivergatesoftware.com> wrote:
>> 
>> On Apr 22, 2017, at 23:55 , Gerriet M. Denkmann <gerri...@icloud.com> wrote:
>>> 
>>> But now I want to move the table view down 1 cm (leaving 1 cm unused space 
>>> at the top of the screen above the table view).
>>> Reason: top of the table view (which contains a SearchField) is rather hard 
>>> to reach.
>>> 
>>> But I cannot find a way to do this.
>> 
>> Since UITableView is a subclass of UIScrollView, you can just set the 
>> “contentOffset” property to move its contents away from the top of its 
>> container.
>> 
>> If you need to put a different view in the 1 cm of space above the table 
>> view, then I guess you need to change the structure. Instead of the the root 
>> view being or containing a table view, it would have two child views, or two 
>> container subviews with “embed” segues to child view controllers.
> 
> I failed using contentOffset.
> 
> So I changed the view controller of my scene from UITableViewController to 
> UIViewController and added a rectangle and a UITableView.
> 
> But using UISearchController proved to be impossible. Even in the old set up 
> (under UITableViewController) there were several bugs which needed 
> complicated work arounds.
> Now there were even more (without work arounds). So I gave up on 
> UISearchController.

Well, what were the bugs, exactly? How are you adding the search controller’s 
searchBar to the table view?

> 
> Now I have UIView, UISearchBar, UITableView (no more UISearchController) and 
> all seems to be working.
> 
> Gerriet.
> 
> P.S. Is there some official way to get the colour of the UISearchController 
> (like hue: 0.668062, saturation: 0.0255094, brightness: 0.80854) instead of 
> hardcoding these numbers?
> I need this for the backgroundColor of my UIView.
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Can't use +initialize, now what?

2017-03-30 Thread Saagar Jha
+1 to this idea as well. This works for cases where stuff like awakeFromNib and 
didFinishLaunching aren’t available, like plugins.

Saagar Jha

> On Mar 30, 2017, at 03:39, Jonathan Hull <jh...@gbis.com> wrote:
> 
> 
>> On Mar 29, 2017, at 4:24 PM, Charles Srstka <cocoa...@charlessoft.com> wrote:
>> 
>>> On Mar 29, 2017, at 3:41 PM, Greg Parker <gpar...@apple.com> wrote:
>>> 
>>>> On Mar 29, 2017, at 9:02 AM, Charles Srstka <cocoa...@charlessoft.com 
>>>> <mailto:cocoa...@charlessoft.com>> wrote:
>>>> 
>>>>> On Mar 29, 2017, at 10:51 AM, Jens Alfke <j...@mooseyard.com 
>>>>> <mailto:j...@mooseyard.com>> wrote:
>>>>> 
>>>>>> On Mar 29, 2017, at 6:57 AM, Daryle Walker <dary...@mac.com 
>>>>>> <mailto:dary...@mac.com> <mailto:dary...@mac.com 
>>>>>> <mailto:dary...@mac.com>>> wrote:
>>>>>> 
>>>>>> Now the new Xcode release notes say that “• Swift now warns when an 
>>>>>> NSObject subclass attempts to override the initialize class method, 
>>>>>> because Swift can't guarantee that the Objective-C method will be 
>>>>>> called. (28954946)”
>>>>> 
>>>>> Huh, I haven’t heard of that. And I’m confused by “the Objective-C 
>>>>> method” — what’s that? Not the +initialize method being compiled, because 
>>>>> that’s in Swift. The superclass method?
>>>>> 
>>>>> Guess I’ll follow that Radar link and read the bug report myself. Oh, 
>>>>> wait. :(
>>>> 
>>>> You actually can this time, since Swift’s bug reporter is actually open to 
>>>> the public. https://bugs.swift.org/browse/SR-3114 
>>>> <https://bugs.swift.org/browse/SR-3114><https://bugs.swift.org/browse/SR-3114
>>>>  <https://bugs.swift.org/browse/SR-3114>>
>>>> 
>>>> Basically, with Whole Module Optimization turned on, +initialize wasn’t 
>>>> getting called. Their solution was to just get rid of +initialize.
>>> 
>>> You don't even need WMO. Many arrangements of Swift code can bypass ObjC 
>>> +initialize.
>>> 
>>> Invocation of +initialize is a feature of objc_msgSend(). Swift code does 
>>> not always use objc_msgSend() when calling methods: some methods are 
>>> inlined, some are called via virtual table, some are called directly. None 
>>> of these paths will provoke +initialize. 
>>> 
>>> Changing Swift's generated code to guarantee +initialize would be 
>>> prohibitively expensive. Imagine an is-initialized check in front of every 
>>> inlined call. It would be more expensive than +initialize in ObjC because 
>>> +initialize checking is free once you pay the cost of objc_msgSend(). (The 
>>> ObjC runtime checks +initialize on uncached dispatch, and never caches 
>>> anything until +initialize completes. Most dispatches are cached so they 
>>> pay nothing for +initialize support.)
>>> 
>>> +initialize in Swift isn't safe and is too expensive to make safe, so we're 
>>> taking it away instead.
>> 
>> I wonder if an equivalent Swift-native feature could be added, something 
>> like a typeInit block? If the block weren’t there, nothing special would 
>> happen, and if the block were present, the compiler could basically generate 
>> the code in the example I gave, but add the static var access to the front 
>> of every initializer and static/class member. That shouldn’t impact 
>> performance too much, and wouldn’t impact at all in the case that there’s no 
>> type initializer.
> 
> I hope so as well.  My favorite candidate so far would be a reflection 
> capability to get a list of all classes/structs/enums adhering to a protocol. 
>  Then you could build your own initializable protocol fairly easily (and can 
> even build whatever facility you want to guarantee a particular ordering or 
> timing). The reason, I favor it over a specific method, is that it also 
> enables a bunch of other cool patterns like extensible factories, and easy 
> plug-ins.
> 
> 
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Official sidebar?

2017-03-26 Thread Saagar Jha
Yes, there is an API for them; it’s part of NSWindow 
<https://developer.apple.com/reference/appkit/nswindow>. The basic tabbing is 
done by default, but there is the option to turn it on/off, get a list of 
tabbed windows, and manually add one to the list.

Saagar Jha

> On Mar 25, 2017, at 23:53, Jens Alfke <j...@mooseyard.com> wrote:
> 
> 
>> On Mar 25, 2017, at 4:40 PM, Saagar Jha <saa...@saagarjha.com 
>> <mailto:saa...@saagarjha.com>> wrote:
>> 
>> Nothing, if I remember correctly. Cocoa should handle window tabs for you.
> 
> Isn’t there an API to manage them? 
> 
> For example, I use the tab bar in SourceTree to group multiple repositories 
> into a single window, but every time I relaunch the app, they reopen as 
> separate windows and I have to group them again. I was assuming there’s an 
> API apps could adopt to be more aware of the tabs and at least be able to 
> restore them.
> 
> —Jens

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Official sidebar?

2017-03-25 Thread Saagar Jha
Nothing, if I remember correctly. Cocoa should handle window tabs for you.

Saagar Jha

> On Mar 25, 2017, at 07:49, Daryle Walker <dary...@mac.com> wrote:
> 
> Testing out my app. Finally noticed the new "Show Tab Bar" View menu item. 
> The menu also handles the tool bar, full screen, and a sidebar. Never noticed 
> that last one before. What do I have to do in my storyboard and/or window 
> controller to support that?
> 
> (Of course, I don't need one right now. But I'm still curious.)
> 
> Sent from my iPhone
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: programmatically tell when spotlight/mds is indexing

2017-03-23 Thread Saagar Jha
I couldn’t find a public API, but Metadata.framework defines 
_MDConfigCopyStoreInformation(NSString *path). It returns an dictionary 
containing the key “CurrentlyScanning”, which you might find useful.

Saagar Jha

> On Mar 18, 2017, at 09:37, sqwarqDev <sqwarq...@icloud.com> wrote:
> 
> 
>> On 18 Mar 2017, at 23:05, Jerome Krinock <je...@ieee.org> wrote:
>> 
>> To generalize your question, you want to reverse-engineer some other app to 
>> reveal some status information. I’ve had to do this a couple times.
> 
> Thanks for the thought, but my question was really just a sanity check to 
> make sure that there isn’t an already existing public API I might have missed 
> that a developer could use to query the status of mds. 
> 
> Any kind of guesswork about what files may or may not be open when mds is 
> indexing would be a bit too hit and miss for what I need.
> 
> 
> Best
> 
> 
> Phil
> @sqwarq
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: UITextField width of UIAlertController -addTextFieldWithConfigurationHandler:

2017-03-21 Thread Saagar Jha
That should be lot easier; just set yourself as the text field’s delegate and 
override textFieldShouldBeginEditing.
Saagar Jha

> On Mar 21, 2017, at 12:24, Carl Hoefs <newsli...@autonomy.caltech.edu> wrote:
> 
> Alternately, is there a way to configure the alert to defer the launch of the 
> keyboard until/unless the user wants to edit the textfield (by touching it)? 
> Generally it won't need to be edited, maybe just the first time or so, thus 
> having the keyboard always coming up would be distracting.
> 
> - Carl
> 
>> On Mar 21, 2017, at 12:12 PM, Carl Hoefs <newsli...@autonomy.caltech.edu 
>> <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> Thanks for the hint. In the debugger I discovered that what looks to be a 
>> UITextField displayed across the bottom of the alert is actually implemented 
>> as a private object of class UIAlertControllerTextField.
>> 
>> So I can restrict the text to a portion of the textfield, but I can't find a 
>> way to shorten the textfield's displayed width. Setting UIBorderStyleNone 
>> also has no effect. I can change the font characteristics, but no 
>> layout/display characteristics of the "textfield" itself appear to be 
>> directly changeable. 
>> 
>> -Carl
>> 
>> 
>>> On Mar 20, 2017, at 10:05 PM, Saagar Jha <saa...@saagarjha.com> wrote:
>>> 
>>> I haven’t tested this, but have you tried calling [self layoutIfNeeded] in 
>>> the completion block of [self presentViewController:animated:completion]?
>>> 
>>> Saagar Jha
>>> 
>>>> On Mar 20, 2017, at 16:09, Carl Hoefs <newsli...@autonomy.caltech.edu 
>>>> <mailto:newsli...@autonomy.caltech.edu> 
>>>> <mailto:newsli...@autonomy.caltech.edu 
>>>> <mailto:newsli...@autonomy.caltech.edu>>> wrote:
>>>> 
>>>> iOS 10.2.1
>>>> 
>>>> I'm using UIAlertController -addTextFieldWithConfigurationHandler: to 
>>>> display an alert with a textfield. 
>>>> 
>>>> Is there any way to shorten the width of the displayed textfield? I've 
>>>> tried setting its frame/bounds, but it has no effect.
>>>> 
>>>> -Carl
>>>> 
>>>> ___
>>>> 
>>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
>>>> <mailto:Cocoa-dev@lists.apple.com> <mailto:Cocoa-dev@lists.apple.com 
>>>> <mailto:Cocoa-dev@lists.apple.com>>)
>>>> 
>>>> Please do not post admin requests or moderator comments to the list.
>>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com 
>>>> <http://lists.apple.com/> <http://lists.apple.com/ 
>>>> <http://lists.apple.com/>>
>>>> 
>>>> Help/Unsubscribe/Update your Subscription:
>>>> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com 
>>>> <https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com> 
>>>> <https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com 
>>>> <https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com>>
>>>> 
>>>> This email sent to saa...@saagarjha.com <mailto:saa...@saagarjha.com>
>>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
>> <mailto:Cocoa-dev@lists.apple.com>)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com 
>> <http://lists.apple.com/>
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
>>  
>> <https://lists.apple.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu>
>> 
>> This email sent to newsli...@autonomy.caltech.edu 
>> <mailto:newsli...@autonomy.caltech.edu>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: UITextField width of UIAlertController -addTextFieldWithConfigurationHandler:

2017-03-20 Thread Saagar Jha
I haven’t tested this, but have you tried calling [self layoutIfNeeded] in the 
completion block of [self presentViewController:animated:completion]?

Saagar Jha

> On Mar 20, 2017, at 16:09, Carl Hoefs <newsli...@autonomy.caltech.edu> wrote:
> 
> iOS 10.2.1
> 
> I'm using UIAlertController -addTextFieldWithConfigurationHandler: to display 
> an alert with a textfield. 
> 
> Is there any way to shorten the width of the displayed textfield? I've tried 
> setting its frame/bounds, but it has no effect.
> 
> -Carl
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: ncurses type wrapper for NStextview

2017-03-06 Thread Saagar Jha
NSTextView is a general purpose text rendering view; as such, since it works 
with non-proportional fonts, there is no API for drawing characters at a 
certain position. A solution may be to implement the text drawing manually 
using some of NSString’s methods, specifically draw(at:withAttributes:) 
<https://developer.apple.com/reference/foundation/nsstring/1533109-draw>.

Saagar Jha

> On Mar 6, 2017, at 13:43, Julie Porter <jpor...@delectra.com> wrote:
> 
> It has been a while since I asked anything here. Most of the scripting I do 
> is in PostScript using the ghostscript interpreter.
> 
> Occasionally I convert my postscript code to Objective C/Quartz. This works 
> really well for graphical output as Quarts drawing is just postscript 
> backward.
> 
> I now have an objective C application that is built on the Arduino Serial 
> Example code that was on the Arduino website.  This uses IOKit to open a 
> serial port.   I modified this code to create some button functions.  That 
> send text command strings to the Arduino. The Arduino returns data which gets 
> placed into a NSTextView object.  I want to parse and format this returned 
> data (which can contain abstract binary data.)
> 
> I have code in postscript which can take the captured data and display it by 
> using ANSI Escape codes in terminal.
> 
> I was surprised that there seems to be no wrapper class to NSTextView to do 
> simple character cursor positioning equivalent to the Unix nCurses library.
> 
> I spent the morning using a popular search engine with variations of the 
> following search terms. (note all the exclusions to avoid phone related hits.)
> 
> '"objective c" NStextview write text at row column position like ncurses move 
> -ios -iphone -NSTableView -UITableView -UITextView'
> 
> The best I could find was a full blown terminal editor program called iTerm2  
> I am looking for something much simpler along the lines of
> 
> textmoveto(3,4)
> displaytext(Hello World)
> 
> Most of the example form editors seem to be based on NSTableView which I find 
> overly complex.  The cursor positioning search hits relate to mouse pointers.
> 
> There are a number of command line examples that should run in terminal.  
> This makes it awkward as the drop down menu is  needed given that Ardino 
> serial devices show up in the /dev folder with unique serialize names.   It 
> is also convenient to have the user buttons that can send the command 
> shortcuts to the Arduino.
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Adding a watchOS complication to an existing project?

2017-03-04 Thread Saagar Jha
I remember doing this around a year ago, but IIRC there wasn’t an easy way to 
do this. I think I created a new extension with a complication and copy/pasted 
stuff from the new target.

Saagar Jha

> On Mar 3, 2017, at 07:08, Eric E. Dolecki <edole...@gmail.com> wrote:
> 
> Everything I've seen shows adding the complication on project creation. How
> does one go about adding it to a project later on? I have my watch app
> right where I want it, but I didn't think I would need a complication.
> Until today.
> 
> Thanks!
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Is it possible to set an NSTableView cell background color?

2017-02-22 Thread Saagar Jha
Well, assuming you have a NSTableCellView, you can set its background color 
using its layer. For example:

cell.layer.backgroundColor = NSColor.black.cgColor

Saagar Jha

> On Feb 22, 2017, at 16:14, David Delmonte <ddelmo...@mac.com> wrote:
> 
> Hi all, I have a table that has records by date. I want to color those 
> entries based on the decade.
> 
> I cannot seem to find a way to do this.
> 
> Any help would be appreciated.
> 
> David
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: No prompt for Location Services

2017-02-14 Thread Saagar Jha
You may have already done this, but you’ll need to call CLLocationManager’s 
requestAlwaysAuthorization() method for the prompt.

Saagar Jha

> On Feb 14, 2017, at 10:01 AM, Laurent Daudelin <laur...@nemesys-soft.com> 
> wrote:
> 
> Adding features to an app under iOS 10 that needs to access the location 
> services. So, I added the “NSLocationWhenInUseUsageDescription” with a 
> description. When checking Privacy -> Location Services, I see my app there 
> with 2 choices: “While using the app” and “Never”. But none is checked. I 
> deleted the app from the device, re-installed but I’m never prompted to allow 
> access to Location Services.
> 
> What am I missing?
> 
> -Laurent.
> -- 
> Laurent Daudelin  
> laur...@nemesys-soft.com <mailto:laur...@nemesys-soft.com>
> AIM/iChat/Skype:LaurentDaudelin   
> http://www.nemesys-soft.com/ <http://www.nemesys-soft.com/>
> Logiciels Nemesys Software
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Math question

2017-01-24 Thread Saagar Jha
Not completely sure if this is what you want, but I think your “scale” would be:

scale = (distance - minDistance) / (maxDistance - minDistance) * (maxScale - 
minScale) + minScale

In this case,

scale = (distance - 100) / 100 * 2 + 1

Saagar Jha

> On Jan 24, 2017, at 10:45 AM, Eric E. Dolecki <edole...@gmail.com> wrote:
> 
> I have a situation where the distance of an onTouchesBegan in iOS produces
> a scale for an object.
> 
> min distance of 100 = scale of 1.0
> max distance of 200 = scale of 3.0
> 
> So I am looking for a number between 100 and 200 which ends up being
> between 1.0 and 3.0. I can get the distance easily enough, but the scale
> factor eludes me at the moment. Coffee? Lack of this kind of math for over
> 20 years? Heh.
> 
> self.scaleCircle.transform = CGAffineTransform(scaleX: percentage, y:
> percentage)
> 
> What math would I apply to get that range?
> 
> Eric
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: making a video from still frames that don't change that often plus audio

2017-01-15 Thread Saagar Jha
The 8 minute limitation is for the time the user’s choice is remembered for the 
authorization prompt, is it not? Is there a limit for the actual recording as 
well?

Saagar Jha

> On Jan 15, 2017, at 9:22 AM, davel...@mac.com wrote:
> 
> I have an iOS presentation app 
> (https://itunes.apple.com/app/redraw/id1114820588?mt=8) that I currently make 
> videos from by AirPlaying it to my Mac and using Screenflow on the Mac to 
> show the iPad screen and record my audio from a microphone (and then edit). 
> I'd like to build this functionality into my app directly. I see ReplayKit 
> which would probably work (haven't checked if it can record the external 
> screen my app makes) but the 8 minute limitation is probably a deal breaker. 
> If that were 20 minutes, I would probably use it.
> 
> Basically what I want to do is to have the app record some audio (while the 
> user is interacting with the app) and make a video that includes this audio 
> and a series of sporadically updated images. For example, I have an image 
> that is being shown on the screen of the app and want that image to be in the 
> video until the user presses a button to change the image and then I want 
> that image to be the image that is shown in the video (as the audio 
> continues). Most of the time the same image might be shown for 10 or so 
> seconds at a time, but occasionally the image might be updated at 30 fps.
> 
> So basically I want to make a video from this audio and periodically I will 
> update the image that should be displayed and that frame should continue to 
> be shown in the movie until I tell it to use a new image for the subsequent 
> frames.
> 
> It looks like AVFoundation and specifically AVAssetWriter may be what I need? 
> Is that the correct approach? 
> 
> I found this that sort of looks like what I want:
> 
> http://stackoverflow.com/questions/3741323/how-do-i-export-uiimage-array-as-a-movie
> 
> Although in my case I don't have all the images saved ahead of time (and 
> don't want to save the images in memory while recording the audio because I 
> would likely run out of memory). I just want to write the move to the flash 
> storage as the audio is recorded.
> 
> My app is written in Swift although I wrote Objective-C code for 6 or so 
> years so pointers to example code written in Objective-C are fine also.
> 
> Thanks,
> Dave Reed
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: On NSIncrementalStore UUID Uniqueness

2017-01-10 Thread Saagar Jha
Small quibble: UUIDs are not guaranteed to be unique. It's just extremely 
likely they will be, and they be sufficient for almost all applications, 
including this one.

Saagar Jha



> On Jan 10, 2017, at 2:00 PM, Jean-Daniel <mail...@xenonium.com> wrote:
> 
> UUID means Universally unique identifier and it must be unique: 
> https://en.wikipedia.org/wiki/UUID <https://en.wikipedia.org/wiki/UUID>
> 
> To generate an UUID, use a standard system function (CFUUID, NSUUID, libuuid, 
> …)
> 
> 
>> Le 10 janv. 2017 à 11:36, Daryle Walker <dary...@mac.com> a écrit :
>> 
>> Been reading up on NSIncrementalStore, including its guide. I think I grok 
>> it more now. When initializing an instance, you're supposed to submit an 
>> UUID. Can a single value be used for all instances, or is it supposed to 
>> unique per instance?  If the latter, and the source data doesn't already 
>> have a UUID field, do you to take heroic measures to ensure uniqueness? Or 
>> is a casual effort enough?
>> 
>> Sent from my iPhone
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/mailing%40xenonium.com
>> 
>> This email sent to mail...@xenonium.com
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com