Re: Auto layout in XCode 6.4

2015-08-25 Thread Alex Zavatone
It's not the most straightforward thing in existence.

I've found that watching several YouTube videos will do more good than most 
anything else.

Sadly, there is one 7 minute video that made things pretty clear but I can't 
find it (not Ray's).

This one is pretty good.

https://www.youtube.com/watch?v=vzyd33Pv9kg

On Aug 25, 2015, at 7:23 AM, Dave wrote:

> Hi All,
> 
> I’m trying to get my head around Auto Layout in XXCode, but can’t seem to 
> figure out some basic things.
> 
> I have a sample project with a View made up of two Controls, a Text Field and 
> a Button, like so:
> 
> | [TextView]   [Button] |
> 
> Where | = edge of the View.
> 
> It has the following constraints at the moment:
> 
> 1.Leading Alignment   First Item: Button.Leading
> Relation: Equal   Second Item: TextView.Leading   Constant: 8   Priority: 
> 1000   Multiplier: 1
> 2.Vertical Space  First Item: Superview.Bottom   
> Relation: Equal   Second Item: Button.BottomConstant: 5   Priority: 
> 1000   Multiplier: 1
> 3.Vertical Space First Item: Button.Top   
> Relation: Equal   Second Item: Superview.Top   Constant: 5   Priority: 
> 1000   Multiplier: 1
> 4.Baseline Alignment First Item: Button.Baseline   Relation: 
> Equal   Second Item: TextView.Baseline  Constant: 0   Priority: 1000   
> Multiplier: 1
> 5.Horizontal SpaceFirst Item: Superview.Trailing   
> Relation: Equal   Second Item: Button.Trailing   Constant: 5   Priority: 
> 1000   Multiplier: 1
> 
> I now, want to move the button so it’s before the text field, like so:
> 
> | [Button]   [TextView] |
> 
> If I just move the button to the left, it doesn’t work, so I’m guessing I 
> need to change the constraints or somehow get XCode to do it for me?
> 
> When I click on the Button in XCode, I see that it is hooked to the top, 
> bottom and right edge of the superview and the left edge of the TextView.
> 
> How do I change this so that it’s hooked to the top, bottom, and left edge of 
> the superview and the left edge of the TextView?
> 
> Is there a good doc that explains how to use XCode to do this? 
> 
> Not sure if this is a Cocoa or XCode question, so I’ve posted to both lists.
> 
> 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/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/archive%40mail-archive.com

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

Re: Is it possible to transfer data by using light

2015-09-17 Thread Alex Zavatone
Yes.  How do you think TV remotes work?

They use IR transmitters/receivers.

They are, however, PAINFULLY SLOW.

When we were making FiOS TV, we had to create an app called FiOS Mobile Remote 
for the iPhone that would control your FiOS set top box.

EVEN THOUGH the iPhone had to pipe its commands through a much much much longer 
chain to get to the STB, it was a night and day in terms of performance.  In 
fact, it was almost instant.

Back then when we were prototyping FiOS I took an IR receiver and hooked it up 
to a PC.  Then, using Director, we detected the signal that was being broadcast 
and mapped each signal to the appropriate keypress.

Then, we wrote a layer on top of that which created key events (press, release, 
hold and repeat), and that allowed us to have a library which would we could 
then use to issue commands based on the action being performed on the remote.

All being done by sending a signal over light.


At another company, we turned data into QR codes and the QR codes became data 
packets which we used to reimplement TCP/IP over a video capture transmission 
method.  Our implementation was to have an iPhone in video capture mode and 
flash a bunch of QR codes on another computer's screen.  

We then pulled each frame out of the video as it was captured, detected when 
the image representing the QR code changes and rebuilt the data on the device 
and decoded it. 

As I recall, we were testing driver's license detection software and used a 
kitten as the photo in the license.


So, yes, you can use light to transmit data.




On Sep 16, 2015, at 11:14 PM, ico wrote:

> First of all, please take a look at this video:
> https://www.youtube.com/watch?v=LPyLHhiGTHM
> 
> This toy can connect to the iphone's network by detecting the blinking
> screen of an iPhone. I wonder if it is possible that using this technique
> to transfer data.
> For instance,
> 1. you have some data, and transform it into a frequency of flash light
> 2. you control iPhone A to blink its screen or its flashlight according to
> this frequency
> 3. you control iPhone B to detect this frequency of light
> 4. you transform this message into some data which is the same as you have
> in the 1st step
> 
> Anyone can give a hint about achieving this?
> Sorry for my bad English.
> 
> Thank you!
> ___
> 
> 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/archive%40mail-archive.com

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

Re: Is it possible to transfer data by using light

2015-09-21 Thread Alex Zavatone

On Sep 21, 2015, at 11:54 AM, Sixten Otto wrote:

> On Sun, Sep 20, 2015 at 9:55 PM, Jens Alfke  wrote:
> 
>> But honestly, if you're going this route, it will be much faster to
>> transmit QR codes, since each code contains thousands of bits.
>> 
> 
> Especially given that recent versions of iOS can detect and decode QR codes
> automatically, much like face detection.
> 
> https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVMetadataMachineReadableCodeObject_Class/index.html
> 
> https://developer.apple.com/library/ios/documentation/QuartzCore/Reference/CIQRCodeFeature/

IIRC, we tested that over a year ago with great success under iOS.
___

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: Continue application processing with mouse down on a menu

2015-09-26 Thread Alex Zavatone

On Sep 26, 2015, at 10:23 AM, Scott Ribe wrote:

>> It has seem like a rule that has been in place forever that an application 
>> pauses processing when the mouse is down on a menu.

Why?  It's not like all the threads are locked in a repeat loop.

___

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 to install 10.11 ?

2015-10-01 Thread Alex Zavatone
If it's any consolation, I couldn't update my Retina MBP 15 either initially.  
When the installer was about to restart "An error occurred.  Please try again."

i had to reboot and install the OS again holding down some command key 
sequence.  Only after a 1 hour install and putting a fresh install of the 
current OS on back on my box was the 10.11 installer able to update the device.

Wonderful way to waste of a few hours, indeed.



On Oct 1, 2015, at 7:39 AM, Dave wrote:

> 
>> i’m sure it will work if your volume names aren’t rather unusual, it’s been 
>> tested for a while. “เม่น” looks like 3 characters, well it is 3 grapheme 
>> clusters but it’s 4 code points, one of which combines with the next one to 
>> form the single character. Given the one-character-off-the-end-of-the-string 
>> message that’s the first place I’d look.
> 
> A, that’s what you meant, no I don’t have any weird characters in my 
> Volume names, thanks a lot for the clarification.
> 
> Cheers
> 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/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/archive%40mail-archive.com

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

An off-topic question/post that may be worth a short read. (Sorry for the xpost)

2015-10-02 Thread Alex Zavatone
As much as I am probably known here for having no filter when I run into 
problems with Xcode or with my own shortcomings in understanding Cocoa and 
Xcode, I do this in the interest of getting to a solution and when the solution 
is found, sharing it.

A few years back, I was tasked with training .net and Dreamweaver programmers 
with understanding the basics of iOS development.  

Well, in two weeks, I'm taking that material and 4 Mac minis and teaching 2 
weeks of iOS programming basics in Africa.  Namibia, exactly.

Thanks for all the help you've all offered of the past few years and all the 
tolerance to my lack of patience.  Lots of what I've learned, I've learned here 
from all of you.  

That knowledge will be going into bringing development skills and the potential 
for employment to a place and people who can certainly use it.

But, I'll be using Xcode 6.4, since I can't get git working worth a damn on 
Xcode 7.0.1.

In any case, hope you all appreciate that what I've learned from your time and 
efforts to help each other (and me) out will be passed on to bring Objective-C 
skills into folks on the edge of the Kalahari.  
 
Thanks much.
- 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: Mac OSX 10.11 and XCode

2015-10-05 Thread Alex Zavatone
That's it.

Dave.  That's it.  

My Checkout window still has the nasty cell string overlap, but I can check in 
to Git from the app without causing a SIGSEV.

I disconnected my Thunderbolt display off of my 15" MBP and I was able to 
commit a file without crashing.

I tried 2 installs of 7.0.1 last week and each crashed identically, but that 
was with the Thunderbolt Display plugged in to the 15" MBP Retina with 10.11 on 
it.



On Oct 5, 2015, at 7:58 AM, Dave wrote:

>> 
>> Yes this was a window server crash. Filed bug report 22943597 with crash log.
>> 
>> --Richard Charles
>> 
> 
> This problem seems to be related to having > 1 Graphics Card installed, can 
> anyone verify this? It seems to crash quite often if I am moving from a 
> monitor connected to one card to a monitor connected to a different graphics 
> card.
> 
> I not 100% sure this is valid, but I lowed the Mouse Tracking Speed and it 
> *seems* to crash less often now.
> 
> 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/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/archive%40mail-archive.com

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

Re: Handling http:// URLs

2015-10-13 Thread Alex Zavatone
Yeah, they do.  

Just change your scheme to rickmann://myurlshallfollow and you register the 
scheme with the app.

Is that what you are referring to?

On Oct 13, 2015, at 8:20 PM, Rick Mann wrote:

> I thought iOS 8 (or 7?) introduced support for iOS apps to handle http URLs. 
> Specifically, I could register to be launched when the user taps on a URL in 
> Safari, say, that matches http://my.company.com/foo*.
> 
> But when I google for this, all I get is the old stuff about custom schemes. 
> Did this go away?
> 
> -- 
> Rick Mann
> rm...@latencyzero.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/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/archive%40mail-archive.com

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

Re: UILabel is maiming my Character

2015-10-14 Thread Alex Zavatone
NSAttributedText works really nice with these.

I'll send you some material on that.

On Oct 14, 2015, at 7:02 AM, Gerriet M. Denkmann wrote:

> I put into some iOS 9 app (Xcode 7.0)  4 UILabels.
> All have Clip Subviews = off, font size 96 with a coloured background, text 
> plain = “ฟี้กุฎุมพี”.
> 
> The difference is the font:
> 
> System: ok (but is too bold for my taste)
> Thonburi and Thonburi Light: bottom get cut off 
> System Light: bottom gets cut off rather much
> 
> System also uses Thonburi as font substitution.
> 
> With Clip Subviews = on the characters get clipped to the coloured 
> background, which is even worse.
> Note: some characters go well beyond the descender line (as specified by the 
> font) and also above the line height.
> 
> How can I get a UILabel which does not maim my characters?
> (Another question would be: how to get a background which covers all of the 
> characters. But this is not important to me right now)
> 
> These UILabels are ultimately meant to go into UITableViewCells (without 
> coloured background).
> 
> Gerriet.
> 
> 
> ___
> 
> 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/archive%40mail-archive.com

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

Re: UILabel is maiming my Character

2015-10-15 Thread Alex Zavatone
Gerriet, what I noticed at the time of writing those methods was that there was 
no predefined way to create superscripted text for NSAttributedText.

What my premise was to simulate/create superscripted text was to raise the 
baseline a % of the text's font size and reduce the font size used for the 
superscript by a fixed percentage.

What this lead to was declaring preset settings in the form of attribute 
dictionaries for the desired font styles I wished to achieve and then just 
applying those to ranges to create what we used to call style runs.

You'll notice that I started with method1, method2, etc and moved from the 
simplest approach to more structured approaches.

One nice little thing that I didn't know I pasted in there was a context 
sensitive currency formatter for US currency which superscripts the appropriate 
values if the amount is < 1 dollar or >= than 1 dollar.  It might seem trivial, 
but it handles superscripting the cents and the cent sign in cases less than a 
dollar and the $ in cases of one dollar or more.

Honestly, working with the formatting options in NSAttributedText and creating 
these text formatters was as much fun as I'd had coding since ye olde Director 
days.


Gerriet, I hate to tell you, but I forgot how I got the results.  I'll toss you 
the whole project so you can rip it apart and see if it helps you at all.

Cheers.


On Oct 15, 2015, at 2:28 AM, Gerriet M. Denkmann wrote:

> 
>> On 15 Oct 2015, at 00:03, David Duncan  wrote:
>> 
>> 
>>> On Oct 14, 2015, at 4:02 AM, Gerriet M. Denkmann  
>>> wrote:
>>> 
>>> I put into some iOS 9 app (Xcode 7.0)  4 UILabels.
>>> All have Clip Subviews = off, font size 96 with a coloured background, text 
>>> plain = “ฟี้กุฎุมพี”.
>>> 
>>> The difference is the font:
>>> 
>>> System: ok (but is too bold for my taste)
>>> Thonburi and Thonburi Light: bottom get cut off 
>>> System Light: bottom gets cut off rather much
>>> 
>>> System also uses Thonburi as font substitution.
>>> 
>>> With Clip Subviews = on the characters get clipped to the coloured 
>>> background, which is even worse.
>>> Note: some characters go well beyond the descender line (as specified by 
>>> the font) and also above the line height.
>>> 
>>> How can I get a UILabel which does not maim my characters?
>>> (Another question would be: how to get a background which covers all of the 
>>> characters. But this is not important to me right now)
>>> 
>>> These UILabels are ultimately meant to go into UITableViewCells (without 
>>> coloured background).
>> 
>> You will probably need to use an attributed string that specifies a taller 
>> line height than normal. This happens automatically when the system language 
>> is set to languages such as Thai, but not for other languages, as it would 
>> apply to all text strings.
> 
> Thanks for this hint.
> And thanks a lot to Alex for his very helpful code example!
> 
> Moving the baseLine up by about 8 % and increasing the LineHeight by 5 %  
> finally (after lots of fiddling) gives me an acceptable UILabel with 
> SystemFont Light.
> 
> CGFloat baseChangePercent = +8;   
> CGFloat lineChangePercent = +5;   
>   
> CGFloat baselineOffset = fontSize * baseChangePercent / 100 ;
> CGFloat lineHeightMultiple = 1 + lineChangePercent / 100;
> 
> NSMutableParagraphStyle *paragraph = [ [ NSMutableParagraphStyle alloc ] init 
> ];
> paragraph.lineHeightMultiple = lineHeightMultiple;
> 
> attributes =  @{  NSBaselineOffsetAttributeName:  @(baselineOffset),
>   NSFontAttributeName:
> font,
>   NSParagraphStyleAttributeName:  
> paragraph,
>};
> But of course these values are heavily dependent on the font (and maybe even 
> on fontSize).
> 
> How to compute these numbers directly (as opposed to trial and error)?
> 
> 
> Kind regards,
> 
> Gerriet.
> 


___

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: App Transport Security has blocked a cleartext HTTP for a local IP

2015-10-15 Thread Alex Zavatone
What happens if you only use this:

NSAllowsArbitraryLoads


??

On Oct 15, 2015, at 3:56 PM, Marek Hrušovský wrote:

> I read on some blogposts that ios9 GM did not support IP addresses for ATS.
> Do not know if this has changed.
> 
> On Thu, Oct 15, 2015 at 9:06 PM, Devarshi Kulshreshtha <
> devarshi.bluec...@gmail.com> wrote:
> 
>> Our webservices are hosted in some local IP, to bypass the App Transport
>> Security I added this as dictionary for NSAppTransportSecurity key in my
>> info.plist file:
>> 
>> 
>> 
>> NSAllowsArbitraryLoads
>> 
>> NSExceptionDomains
>> 
>> localhost
>> 
>> NSExceptionAllowsInsecureHTTPLoads
>> 
>> 
>> 10.32.27.12
>> 
>> NSExceptionAllowsInsecureHTTPLoads
>> 
>> 
>> 
>> 
>> 
>> but for some reasons I am still getting this error message:
>> 
>> App Transport Security has blocked a cleartext HTTP (http://) resource
>> load
>> since it is insecure. Temporary exceptions can be configured via your app's
>> Info.plist file
>> 
>> Any ideas?
>> 
>> --
>> 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/xhruso00%40gmail.com
>> 
>> This email sent to xhrus...@gmail.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/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/archive%40mail-archive.com

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

Just a little off topic update.

2015-10-23 Thread Alex Zavatone
Some of you guys might know I claimed to have gone to Namibia to teach 2 weeks 
of iOS.

Well, after the first week, we've got 24 new IT professionals, converts from 
.net and college students who are now able to make basic navigable apps with 
singletons, data classes, multiple types of view controller classes and so on, 
+ the knowledge on how to dive into the header files to find the answers to new 
areas themselves.

Also ran into one intern who has already published several robust Swift apps as 
well.

I happened to leave a few spare Macs at the lab and we're actually going to 
continue weekly lesson plans to keep the effort moving.

Coming up is a marathon weekend session and one more week of new students 
starting on Monday.

I'm a little spent, but this has been pretty highly rewarding experience and 
it's great to see the professional IT talent in southern Africa and just how 
fast they take to getting their heads around iOS.

This is really good.  

Hoping you all enjoy the off topic, yet still cocoa related diversion.  

All the best from Windhoek West, Namibia,
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

More of a dev tools question, so please advise if this is the wrong place to ask - automating the Network Link Conditioner

2015-11-03 Thread Alex Zavatone
Our little iOS apps are getting a little stronger testing with regards to 
reachability and connecting to out servers.

With that in mind, we've been stress testing the network access conditions 
recently and ran into some issues while traveling across the planet that 
justify it.

Has anyone set up the network link conditioner control panel and automated 
changing the settings on it a la AppleScript or another tool?

If this would be of use to anyone else, I'll happily share.

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: Multiple simultaneous UIAlertControllers

2015-11-05 Thread Alex Zavatone
Make a queue.

Sent from my iPhone

> On Nov 5, 2015, at 6:10 PM, Carl Hoefs  wrote:
> 
> I don't want more than 1 alert presented at a time, of course, but they get 
> generated asynchronously. I thought dispatch_get_main_queue() would nicely 
> serialize any that occur. Thus David's comment that I'm just getting the 
> requests issued in a serialized fashion. 
> 
> I'm not certain how to have alerts that are scattered all throughout the app 
> to wait until some other alert's completion block executes. Are you saying to 
> have it control a global flag or some such?
> -Carl
> 
>> On Nov 5, 2015, at 3:53 PM, Eric E Dolecki  wrote:
>> 
>> That's the way. You should never need more than one presented at a time. 
>> 
>> Sent from my iP6+
>> 
>>> On Nov 5, 2015, at 5:44 PM, Tomasz Muszyński  wrote:
>>> 
>>> You should present next UIAlertController when first one has been dismissed 
>>> (when UIAlertAction handler is called).
>>> 
>>> Tomek
>>> 
 Wiadomość napisana przez Carl Hoefs  w 
 dniu 05.11.2015, o godz. 23:37:
 
 iOS 9.1, iPhone 5S, ObjC
 
 I'm getting the following runtime warning due to multiple simultaneous 
 UIAlertControllers presenting at the same time:
 
 Warning: Attempt to present  on 
  which is already presenting 
 
 
 I know only one alert view controller can be presenting at a time, so the 
 way I thought to serialize execution of each -presentViewController:: is:
 
 dispatch_async( dispatch_get_main_queue(), ^{
 [ self presentViewController: alert 
 animated: YES 
   completion: nil ];
 });
 
 Why isn't dispatch_get_main_queue() enforcing serialized execution? Is 
 there another way to do this?
 -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/thom%40union.waw.pl
 
 This email sent to t...@union.waw.pl
>>> 
>>> 
>>> ___
>>> 
>>> 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/edolecki%40gmail.com
>>> 
>>> This email sent to edole...@gmail.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/newslists%40autonomy.caltech.edu
>> 
>> This email sent to 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/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/archive%40mail-archive.com

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

Re: Multiple simultaneous UIAlertControllers

2015-11-05 Thread Alex Zavatone
A queue of content to be in each alerts.

I think we've all had this issue.

If there is more than one alert, then have a little number within the alert so 
that you know it's alert #n of nn alerts.

And then each OK or Cancel button displays the next alert until they are gone.

Add the alert content to a dictionary and each button as well.  Add the 
selector for each button as properties.

As each alert is incremented, it just pages on to the next one until the alert 
is dismissed.

Create a little alert manager that is able to handle a queue of alerts and 
display them one at a time.



On Nov 5, 2015, at 6:42 PM, Carl Hoefs wrote:

> A queue of what? I would think that if only a single alert view can be
> presented at a time, then iOS would serialize them and present them when
> earlier ones complete. Is there no system-level solution to this?
> -Carl
> 
> 
>> Make a queue.
>> 
>> Sent from my iPhone
>> 
>>> On Nov 5, 2015, at 6:10 PM, Carl Hoefs 
>>> wrote:
>>> 
>>> I don't want more than 1 alert presented at a time, of course, but they
>>> get generated asynchronously. I thought dispatch_get_main_queue() would
>>> nicely serialize any that occur. Thus David's comment that I'm just
>>> getting the requests issued in a serialized fashion.
>>> 
>>> I'm not certain how to have alerts that are scattered all throughout the
>>> app to wait until some other alert's completion block executes. Are you
>>> saying to have it control a global flag or some such?
>>> -Carl
>>> 
 On Nov 5, 2015, at 3:53 PM, Eric E Dolecki  wrote:
 
 That's the way. You should never need more than one presented at a
 time.
 
 Sent from my iP6+
 
> On Nov 5, 2015, at 5:44 PM, Tomasz Muszyński 
> wrote:
> 
> You should present next UIAlertController when first one has been
> dismissed (when UIAlertAction handler is called).
> 
> Tomek
> 
>> Wiadomość napisana przez Carl Hoefs
>>  w dniu 05.11.2015, o godz. 23:37:
>> 
>> iOS 9.1, iPhone 5S, ObjC
>> 
>> I'm getting the following runtime warning due to multiple
>> simultaneous UIAlertControllers presenting at the same time:
>> 
>> Warning: Attempt to present  on
>>  which is already presenting
>> 
>> 
>> I know only one alert view controller can be presenting at a time, so
>> the way I thought to serialize execution of each
>> -presentViewController:: is:
>> 
>>dispatch_async( dispatch_get_main_queue(), ^{
>>[ self presentViewController: alert
>>animated: YES
>>  completion: nil ];
>>});
>> 
>> Why isn't dispatch_get_main_queue() enforcing serialized execution?
>> Is there another way to do this?
>> -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/thom%40union.waw.pl
>> 
>> This email sent to t...@union.waw.pl
> 
> 
> ___
> 
> 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/edolecki%40gmail.com
> 
> This email sent to edole...@gmail.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/newslists%40autonomy.caltech.edu
 
 This email sent to 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/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:/

runOnMainQueueWithoutDeadlocking and all its evils.

2015-11-06 Thread Alex Zavatone
Bearing in mind my experience dealing with code in the past that was chock full 
of runOnMainQueueWithoutDeadlocking calls, I can not fathom why someone who was 
not updating the UI would need to use this type of approach… everywhere.

Besides complete ineptitude, is there a rational reason that any one of you can 
think of why someone would be using this for GCD dispatches instead of just 
making and using their own GCD dispatch queue?

Before I start destroying the universe and changing this (in a fork), I'd like 
to hear the words of those much smarter than I on this subject.


But seriously, WHY?

Thank you.

- 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: Multiple simultaneous UIAlertControllers

2015-11-06 Thread Alex Zavatone

On Nov 5, 2015, at 6:58 PM, Carl Hoefs wrote:

> Thanks for the tip, I'll look into it.
> 
> (As a general thought, though, it would appear that UIAlertController
> should be a singleton app-wide, and it should manage its own serialized
> presentation. Any other solution seems like external plumbing to fix a
> design problem.)
> -Carl
> 
>> Pretty sure the WWDC 2015 video on NSOperations tackles a similar scenario
>> in a quite elegant way. That might be worth investigating.
>> 
>> Peter
>> 
>>> On Nov 5, 2015, at 6:42 PM, Carl Hoefs 
>>> wrote:
>>> 
>>> A queue of what? I would think that if only a single alert view can be
>>> presented at a time, then iOS would serialize them and present them when
>>> earlier ones complete. Is there no system-level solution to this?
>>> -Carl

Your own queue.  A queue of data you want to be displayed within alerts.  Cook 
up an alert manager that can handle more than one alert.  You could even make 
one that is paged to go from alert to alert and display the # of the alert is 
within the total # of alerts.  Change OK to OK and Next.

Honestly, I've got no idea if there is a system level one or not, but I'm on my 
second project in the same year where we needed something like this.

It seems to be a reoccurring need.


___

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: runOnMainQueueWithoutDeadlocking and all its evils.

2015-11-09 Thread Alex Zavatone

On Nov 7, 2015, at 5:20 PM, Mike Abdullah wrote:

> In my experience, the main issue is on OS X. If you ever display a modal 
> window, that runs the run loop in a special mode for the duration of the 
> window. The trouble is, that mode does not include dequeuing things from 
> GCD’s main queue, so anything you ask to be done that way doesn’t happen. 
> Faced with this myself, I’ve had to use performBlockOnMainThread:… instead to 
> get the work done.
> 
> Mike.

Thanks much, Mike.  Before I started to replace these, I wanted to see why 
these were being forced to the main queue and an alternative in case there some 
realities I didn't forsee.

It will be quite nice to reduce the 60+ cases of use of these.

Cheers

> 
> 
>> On 6 Nov 2015, at 18:23, David Duncan  wrote:
>> 
>>> 
>>> On Nov 6, 2015, at 8:36 AM, Alex Zavatone  wrote:
>>> 
>>> Bearing in mind my experience dealing with code in the past that was chock 
>>> full of runOnMainQueueWithoutDeadlocking calls, I can not fathom why 
>>> someone who was not updating the UI would need to use this type of 
>>> approach… everywhere.
>>> 
>>> Besides complete ineptitude, is there a rational reason that any one of you 
>>> can think of why someone would be using this for GCD dispatches instead of 
>>> just making and using their own GCD dispatch queue?
>>> 
>>> Before I start destroying the universe and changing this (in a fork), I'd 
>>> like to hear the words of those much smarter than I on this subject.
>>> 
>>> 
>>> But seriously, WHY?
>> 
>> Roughly this approach reads like a lock that uses the main queue as its 
>> locking point. Without understanding what is being protected, it is hard to 
>> tell why this is being done.
>> 
>> The usage of dispatch_sync() says that whomever wrote this expected to have 
>> the results available immediately. If not, then simply switching to 
>> dispatch_async() may be sufficient in many cases. Beyond that you will 
>> probably need to evaluate what work is being done in these cases.
>> 
>>> 
>>> Thank you.

___

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: runOnMainQueueWithoutDeadlocking and all its evils.

2015-11-09 Thread Alex Zavatone

On Nov 6, 2015, at 1:23 PM, David Duncan wrote:

> 
>> On Nov 6, 2015, at 8:36 AM, Alex Zavatone  wrote:
>> 
>> Bearing in mind my experience dealing with code in the past that was chock 
>> full of runOnMainQueueWithoutDeadlocking calls, I can not fathom why someone 
>> who was not updating the UI would need to use this type of approach… 
>> everywhere.
>> 
>> Besides complete ineptitude, is there a rational reason that any one of you 
>> can think of why someone would be using this for GCD dispatches instead of 
>> just making and using their own GCD dispatch queue?
>> 
>> Before I start destroying the universe and changing this (in a fork), I'd 
>> like to hear the words of those much smarter than I on this subject.
>> 
>> 
>> But seriously, WHY?
> 
> Roughly this approach reads like a lock that uses the main queue as its 
> locking point. Without understanding what is being protected, it is hard to 
> tell why this is being done.
> 
> The usage of dispatch_sync() says that whomever wrote this expected to have 
> the results available immediately. If not, then simply switching to 
> dispatch_async() may be sufficient in many cases. Beyond that you will 
> probably need to evaluate what work is being done in these cases.
> 

David, that's simply a perfect test.  Thanks much for that insight.  Here's 
hoping that it will be that simple to clean up.

Cheers
___

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

Instancetype and refactoring methods

2015-11-09 Thread Alex Zavatone
I'm enjoying the risks of refactoring some poorly named methods in Xcode 7.1 
and the refactorer is mentioning "Ambiguous Type: Message sent to id." for 
methods sent to a delegate.

Before I give it a shot, is this a case where using instancetype to return the 
instance of the object that holds the method a better choice than id?

It appears so, but just thought I'd ask the group.

Thanks in advance,
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: Instancetype and refactoring methods

2015-11-09 Thread Alex Zavatone
Thanks.  It appears that the instancetype didn't help, as I had already 
converted the init method to return the instancetype instead of id.

Yeah, oddly enough, the object that's conforming to the protocol is using 
delegate/protocol and calling a method in the delegate - which isn't even 
declared in the protocol.  I don't know how it worked in the first place.

Spooky code is spooky.

Thanks, Jens.  Always appreciated.

On Nov 9, 2015, at 2:20 PM, Jens Alfke wrote:

> 
>> On Nov 9, 2015, at 10:58 AM, Alex Zavatone  wrote:
>> 
>> Before I give it a shot, is this a case where using instancetype to return 
>> the instance of the object that holds the method a better choice than id?
> 
> It sounds like your delegate API is using the old “informal protocol” 
> mechanism where you declare the methods in a category on NSObject. Instead, 
> it’s best to define a protocol for the delegate type and always refer to the 
> delegate using that protocol. (You’ve probably seen that AppKit and 
> Foundation switched over to this a few years ago.)
> 
> —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

The joys of people using valueForKey to get objects out of a dictionary.

2015-11-10 Thread Alex Zavatone
It's been about 4 or 5 years since I made this mistake but I've just seen a 
massive swath of code where every access of a dictionary object is using 
valueForKey instead of objectForKey.

I've got a few examples of why this is a "really bad idea"™, and certainly 
might explain why lots of that code is wrapped in try/catch blocks.

Am I correct that using valueForKey will raise an exception if the key is 
missing?

Looking for reasons why I can explain "yeah, I know it works, but here's why 
it's a terrible idea to use to access a dictionary's objects".

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/archive%40mail-archive.com

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

Re: The joys of people using valueForKey to get objects out of a dictionary.

2015-11-10 Thread Alex Zavatone

On Nov 10, 2015, at 12:35 PM, Greg Weston wrote:

> 
> 
>> It's been about 4 or 5 years since I made this mistake but I've just seen a 
>> massive swath of code where every access of a dictionary object is using 
>> valueForKey instead of objectForKey.
>> 
>> I've got a few examples of why this is a "really bad idea"™, 
> 
> I would like to see these examples, because I can't think of any reason why 
> it should be a bad idea. Per the documentation, it's a wrapper around 
> objectForKey: with one special case.

I'm looking at a large chunk of code that uses all dictionary object access 
using valueForKey.  All of it is wrapped within @try/@catch blocks, implying 
that the original authors ran into lots of exceptions being raised and they 
didn't know why.

My main inclination for using objectForKey over valueForKey to access the 
object for a key within a dictionary is that objectForKey is actually a 
dictionary method while valueForKey is a method declared in the 
NSKeyValueCoding.h file.

I did find this example on SO yesterday, and this important issue with regards 
to missing keys.

http://stackoverflow.com/questions/1062183/difference-between-objectforkey-and-valueforkey


Here's a great reason to use objectForKey: wherever possible instead of 
valueForKey: - valueForKey: with an unknown key will throw 
NSUnknownKeyException saying "this class is not key value coding-compliant for 
the key ".

But according to Charles and Mike comment and my testing, it doesn't - in some 
cases.

Take this code on iOS 9:
NSDictionary *myStuff = [NSDictionary dictionaryWithObjectsAndKeys:@"a", @"A", 
nil];

po myStuff 
{
A = a;
}

po [myStuff valueForKey:@"a"];
 nil

// Just as Charles and Mike mentioned

po [myStuff objectForKey:@"a"];

 nil
// Just as we expect

But if we remove the @ (obviously unintended), valueForKey causes an 
EXC_BAD_ACCES while objectForKey reports "error: string literal must be 
prefixed by '@'".

And David does state that whether an exception is thrown or not is 
implementation dependent.  

From what Greg showed and in my testing, valueForKey will crater if you use an 
@ in your key name, something I haven't seen until I tested it.

If we're not using @ within our key names, I haven't seen much here that 
indicates why it's dangerous, nor why the code I'm looking at that uses 
valueForKey on dictionaries needs to be wrapped in @try/@catch statements.


For what we're doing on a daily basis, if we're not using @ within our keys, I 
still can't see anything concrete besides "objectForKey is an NSDictionary 
method" while "valueForKey is a KVO method".

Hmm.  

Thanks to all for their input on this.  

- 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/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/archive%40mail-archive.com

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

Re: The joys of people using valueForKey to get objects out of a dictionary.

2015-11-10 Thread Alex Zavatone

On Nov 10, 2015, at 2:15 PM, Jens Alfke wrote:

> 
>> On Nov 10, 2015, at 10:52 AM, Alex Zavatone  wrote:
>> 
>> Here's a great reason to use objectForKey: wherever possible instead of 
>> valueForKey: - valueForKey: with an unknown key will throw 
>> NSUnknownKeyException saying "this class is not key value coding-compliant 
>> for the key ".
> 
> Yes, but that’s a non-issue with NSDictionary because there are no unknown 
> keys. It handle any key (that doesn’t start with an @) by looking it up in 
> the dictionary.
> 
> I’m not saying you should use -valueForKey, just that you need to be clear on 
> its behavior on _arbitrary_ objects vs. its behavior with NSDictionary.
> 
>> But if we remove the @ (obviously unintended), valueForKey causes an 
>> EXC_BAD_ACCES while objectForKey reports "error: string literal must be 
>> prefixed by '@'".
> 
> Um … you’re doing that in lldb? The difference there seems like an lldb bug. 
> It shouldn’t be allowing you to pass a C string literal as an id, no matter 
> what method is being called.

Yeah.  Honestly, I'm looking for cases that would justify why all the 
dictionary object access blocks in this code that use valueForKey are wrapped 
with @try/@catch clauses.  I've never seen cases with objectForKey that would 
trying to catch exceptions accessing dictionary objects.


>> And David does state that whether an exception is thrown or not is 
>> implementation dependent.  
> 
> Yes, the implementation OF THE CLASS BEING CALLED. Which is NSDictionary. 
> Which, as we keep saying, handles any key by looking it up in the dictionary.

In any case, I don't wish to waste anyone else's time on this (unless you find 
it interesting).  

Thanks again for all the background info on this.

Cheers.

___

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: The joys of people using valueForKey to get objects out of a dictionary.

2015-11-10 Thread Alex Zavatone
And you guys have no idea how useful this discussion was to me today.

Even though the KVO valueForKey: method doesn't crater with an 
NSUnknownException with ease, it turns out that this wonderful code is also 
using the KVO method of setValue: forKey: on a dictionary.

And guess what?

*** Terminating app due to uncaught exception 'NSUnknosnKeyException', reason, 
[<__NSDictionaryI setValue:forUndefinedKey:]: this class is not key value 
coding-compliant for the key username.'
*** First throw call stack:


THANK YOU.  


___

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: Installing older OS X

2015-11-17 Thread Alex Zavatone
VM Ware?

I'm running 10.6.8 on this Mac, 10.5.whatever on another and keep a few 
external HDs around and spare Macs and install images for this purpose.



On Nov 17, 2015, at 8:02 PM, Graham Cox wrote:

> Yeah, Apple really make it hard to set up older OS installs for dev testing.
> 
> If you copy the old installer to the hard disk partition and set it as the 
> boot drive and reboot, does that work? The installers are (I believe) 
> designed to run with no OS at all.
> 
> —Graham
> 
> 
> 
> 
> 
> 
>> On 18 Nov 2015, at 11:50 AM, Quincey Morris 
>>  wrote:
>> 
>> I want to install 10.8.5 somewhere, to debug an app compatibility issue on 
>> that OS, but I can’t seem to figure out how.
>> 
>> I have an empty hard disk I can use, but there’s nothing installed on it. 
>> I’ve got the Mountain Lion installer app from the App Store, but it won’t 
>> run under El Capitan. (It’s “too old” to run.) So, without an older OS X to 
>> run it on, I can’t get an older OS to run it on. (The Yosemite installer 
>> won’t run either.)
>> 
>> What’s the right way to go about this?
>> 
>> ___
>> 
>> 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/graham.cox%40bigpond.com
>> 
>> This email sent to graham@bigpond.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/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/archive%40mail-archive.com

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

Re: Installing older OS X

2015-11-18 Thread Alex Zavatone
Hy, that's a nice little tip. Thanks, man.

Sent from my iPhone

On Nov 18, 2015, at 2:31 AM, Charles Srstka  wrote:

>> On Nov 18, 2015, at 1:22 AM, Quincey Morris 
>>  wrote:
>> 
>>> On Nov 17, 2015, at 23:13 , Charles Srstka >> > wrote:
>>> 
>>> Oh, sorry, I didn’t mean to insult with the “without the quotes” bit.
>> 
>> No, that wasn’t it. When I read your post, I fell over laughing at ‘Type 
>> ⌘-Shift-G, then “NameOfApp.app/Contents”’, because the chances of my 
>> remembering that are about zero.
>> 
>> (If you want to insult me, you’re going to have to try harder than that.)
> 
> Hehe, okay, just wanted to make sure. I wasn’t quite sure how to read that, 
> and didn’t want to offend.
> 
> The ⌘-Shift-G thing has been useful to me more than enough times to justify 
> the headspace. If it helps, it comes from the shortcut for the Finder’s “Go 
> to Folder…” menu item. There’s also the alternative of just hitting the ‘/‘ 
> key, which also brings up the sheet, but it also adds a slash into the text 
> field that you’ll have to delete before typing in the relative path.
> 
> An alternative way to do it is to right-click on the app in the Finder and 
> choose “Show Package Contents”, after which you can drag the Contents folder 
> into the Open dialog box and it will autonavigate there.
> 
> 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/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/archive%40mail-archive.com

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

Re: KVO question

2015-11-18 Thread Alex Zavatone
Are you implying that one KVO is blocking the others?

Sent from my iPhone

> On Nov 17, 2015, at 8:18 PM, Graham Cox  wrote:
> 
> I’m using KVO to observe a bunch of properties.
> 
> Most of these properties are split out into simple things that set a single 
> value, but internal to my object, some end up setting a common dictionary of 
> attributes, which is also a property.
> 
> I KVO observe both the simple properties and the common dictionary property. 
> Mostly this is working, but when code directly sets the dictionary property, 
> the other properties don’t trigger their observers, even though I’m 
> implementing the +keyPathsForValuesAffecting, which I believe 
> should cause the additional triggering. Have I understood that right?
> 
> Here’s the kind of code I have:
> 
> 
> @property (retain) id thingy;
> @property (retain) NSDicitonary* dictionaryOfThings;
> 
> @implementation
> 
> - (void)   setThingy:(is thing
> {
>NSMutableDictionary* temp = [self.dictionaryOfThings mutableCopy];
>[temp setObject:thing forKey:kThingKey];
>self.dictionaryOfThings = temp;
> }
> 
> - (id) thingy
> {
>return [self.dictionaryOfThings objectForKey:kThingKey];
> }
> 
> 
> + (NSSet*)  keyPathsForValuesAffectingThingy
> {
>return [NSSet setWithObject:@“dictionaryOfThings”];
> }
> 
> 
> So what I want (expect?) is that is code sets -dictionaryOfThings directly, 
> an observer of ‘thingy’ will be triggered. Is that right?
> 
> 
> —Graham
> 
> 
> 
> ___
> 
> 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/archive%40mail-archive.com

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

Re: [OT] Good XML Viewer App for Mac

2015-11-20 Thread Alex Zavatone
Would Textmate be recommended here?

Sent from my iPhone

> On Nov 20, 2015, at 8:47 AM, Charles Jenkins  wrote:
> 
> I don’t remember where I got the script, but I use TextWrangler in 
> conjunction with an XML formatter script to view XML documents.
> 
> -- 
> 
> Charles
> 
> On November 20, 2015 at 08:22:46, Dave (d...@looktowindward.com) wrote:
> 
> Hi All,
> 
> Could anyone recommend an XML Viewer for Mac? I just need to open XML text 
> files are have it format the text sensibly. I’ve tried a couple from the Mac 
> App Store but I couldn’t get then to work properly and requested a refund…..
> 
> 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/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/archive%40mail-archive.com

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

Re: dateFromString won't accept this string:

2015-11-23 Thread Alex Zavatone
Have you looked into The spec for date formatting?

It is seriously helpful. It's some ISO document.  

Specify the format at which the date is coming in and it should convert.

I will send you my crappy routines for this for iOS.

Sent from my iPhone

> On Nov 23, 2015, at 9:06 AM, Alex Hall  wrote:
> 
> 
>> On Nov 23, 2015, at 8:00 AM, Sandor Szatmari  
>> wrote:
>> 
>> Alex,
>> 
>> Have you tried looking at NSDataDetector. 
>> http://nshipster.com/nsdatadetector/ 
> Thanks for the suggestion. I don't think that would apply here, though; I 
> have some JSON data that includes a date as a string. I need to convert that 
> to an NSDate object so I can then display it however the user wants, or 
> compare it to now, and such. However, that's a really useful page (I love 
> NSHipster) and I'll save it for another project I'm thinking about where data 
> detectors will be useful.
>> 
>> Sandor
>> 
>>> On Nov 22, 2015, at 16:12, Alex Hall >> > wrote:
>>> 
>>> Hey list,
>>> I’m using NSDateFormatter.dateFromString() to make a date from the date 
>>> string in a tweet. However, it seems to be returning nil, and I’m not sure 
>>> why. Is there something else I have to do, like tell the formatter what 
>>> order to expect components to be in? The string is something like:
>>> 
>>> "Sun Nov 22 21:00:39 + 2015”
>>> 
>>> Thanks for any suggestions anyone has.
>>> ___
>>> 
>>> 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/admin.szatmari.net%40gmail.com
>>>  
>>> 
>>> 
>>> This email sent to admin.szatmari@gmail.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/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/archive%40mail-archive.com

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

Re: dateFromString won't accept this string:

2015-11-23 Thread Alex Zavatone
There is some ISO spec for date formatting that Apple’s docs mention IIRC.

Let me sniff around.

http://www.w3.org/TR/NOTE-datetime

Also, from Apple’s docs: 
“ The format string uses the format patterns from the Unicode Technical 
Standard #35”

Don’t go there.  It will hurt you.  I’ve added a great reference link later on.

From what I remember, it’s pretty important to pay attention to the  
character for certain types of time/date formatting and it isn’t easy to 
discover unless you dig pretty deep into the docs.

In any case, I tossed Alex Hall a bunch of samples.

What I had considered this morning was to come up with a few formatting 
approaches and just fail through the ones that return bogus values until you 
get a positive response.

Didn’t have time to dig into it though.

FYI, here are a few of the formatting strings that I’ve used that worked well 
for me.

// Notice the use of 3 or 4 Zs in the formatter.  It matters with respect to 
hours from GMT.
@"-MM-ddHH:mm:ssZZZ”
@"-MM-dd’T'HH:mm:ss” 

For Alex Hall’s date string, it looks like he’s got to add the date offset from 
GMT and a few space characters into the formatter.  That’s what the  stands 
for.

Should be pretty easy, once you see what each of the letters in the formatter 
represent.

Here’s a pretty good (really really good) reference:

http://waracle.net/iphone-nsdateformatter-date-formatting-table/

Cheers,
Alex Zavatone

On Nov 23, 2015, at 4:32 PM, Sandor Szatmari  
wrote:

> Alex,
> 
> What spec are you referring to?  Link?  I was playing around with 
> NSDataDetector for pulling dates out of strings in XML dumps of excel files 
> for an internal tool I was writing.  NSDataDetectors seemed powerful, but 
> failed when the dates weren't totally well formed (Tested on 10.8.5, SDK 
> 10.8); the dates were still totally recognizable by humans, just missing some 
> whitespace here or there.   It did handle differently formatted dates very 
> well though.  I ended up using regular expressions to 'parse' the dates as 
> there was just one format I was dealing with and the issue was just the 
> missing whitespace.  Maybe I didn't know how to configure it to be more 
> flexible or tolerant of the format deviations?
> 
> Sandor
> 
> On Nov 23, 2015, at 9:33 AM, Alex Zavatone  wrote:
> 
>> Have you looked into The spec for date formatting?
>> 
>> It is seriously helpful. It's some ISO document.  
>> 
>> Specify the format at which the date is coming in and it should convert.
>> 
>> I will send you my crappy routines for this for iOS.
>> 
>> Sent from my iPhone
>> 
>>> On Nov 23, 2015, at 9:06 AM, Alex Hall  wrote:
>>> 
>>> 
>>>> On Nov 23, 2015, at 8:00 AM, Sandor Szatmari 
>>>>  wrote:
>>>> 
>>>> Alex,
>>>> 
>>>> Have you tried looking at NSDataDetector. 
>>>> http://nshipster.com/nsdatadetector/ <http://nshipster.com/nsdatadetector/>
>>> Thanks for the suggestion. I don't think that would apply here, though; I 
>>> have some JSON data that includes a date as a string. I need to convert 
>>> that to an NSDate object so I can then display it however the user wants, 
>>> or compare it to now, and such. However, that's a really useful page (I 
>>> love NSHipster) and I'll save it for another project I'm thinking about 
>>> where data detectors will be useful.
>>>> 
>>>> Sandor
>>>> 
>>>>> On Nov 22, 2015, at 16:12, Alex Hall >>>> <mailto:mehg...@icloud.com>> wrote:
>>>>> 
>>>>> Hey list,
>>>>> I’m using NSDateFormatter.dateFromString() to make a date from the date 
>>>>> string in a tweet. However, it seems to be returning nil, and I’m not 
>>>>> sure why. Is there something else I have to do, like tell the formatter 
>>>>> what order to expect components to be in? The string is something like:
>>>>> 
>>>>> "Sun Nov 22 21:00:39 + 2015”
>>>>> 
>>>>> Thanks for any suggestions anyone has.
>>>>> ___
>>>>> 
>>>>> 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/U

Re: xcodebuild and PMD

2015-11-26 Thread Alex Zavatone
What’s PMD?

On Nov 26, 2015, at 3:16 PM, John Michael Zorko  wrote:

> 
> Hello, all …
> 
> I’m exploring how to plug our iOS builds into our existing PMD-based code 
> sniffing tool. We’re using Xcode 7.1.1. Is there a way that I can process 
> xcodebuild’s output (or hook into the Xcode analyzer output) into a PMD XML 
> file? I’m aware of OCLint, but we also have some Swift code (and there will 
> only be more of it as time goes on).
> 
> Any help would be quite appreciated!
> 
> Regards,
> 
> John
> 
> 
> 
> ___
> 
> 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/archive%40mail-archive.com

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

Re: iOS: Using AppDelegate as an app-wide singleton

2015-12-01 Thread Alex Zavatone
I'm more of a fan of special case singletons, or else you essentially create 
one big global al over again.

Also, the AppDelegate class has certain responsibilities.  For organizational 
purposes, I feel most comfortable in creating a singleton for the purpose of 
the task at hand.  

On Dec 1, 2015, at 3:58 PM, Carl Hoefs wrote:

> I was about to implement my own singleton class to act as an app-wide context 
> repository, but then I thought: wouldn't it be simpler just to use the 
> appDelegate for that purpose? It's a singleton already and available to all 
> classes via [[UIApplication sharedApplication] delegate]. All I need to do is 
> add my @properties to it and I'm done.
> Are there any drawbacks to this?
> -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/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/archive%40mail-archive.com

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

Re: iOS: Using AppDelegate as an app-wide singleton

2015-12-01 Thread Alex Zavatone
What does Apple do on this?

I think their standard is to use shared in the name.


On Dec 1, 2015, at 7:33 PM, Quincey Morris 
 wrote:

> On Dec 1, 2015, at 16:20 , Carl Hoefs  wrote:
> 
>> The following seems to be working out for me.
>> 
>> #import "AppCommon.h"
>> @implementation AppCommon
>> + (AppCommon *)shared
>> {
>>static AppCommon *shared = nil;
>>static dispatch_once_t token;
>>dispatch_once(&token, ^{
>>shared = [[self alloc] init];
>>});
>>return shared;
>> }
> 
> Looks functionally perfect. 
> 
> PSA #1: I would encourage you avoid naming the method ‘shared’, indeed to 
> avoid naming anything with a brief name that doesn’t say what it is. Even the 
> argument that it’s easier to type isn’t good any more, since Xcode is going 
> to autocomplete almost every name for you.
> 
> PSA #2: I can’t help mentioning that you can write all of this in Swift as so:
> 
>   class AppCommon {
>   static let shared = AppCommon ()
>   }
> 
> Sometimes, Swift really is Obj-C-but-better. ;)
> 
> ___
> 
> 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/archive%40mail-archive.com

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

Re: iOS: Using AppDelegate as an app-wide singleton

2015-12-01 Thread Alex Zavatone

On Dec 2, 2015, at 12:24 AM, Luther Baker wrote:

> The conversation here is pretty loose ... and so everyone might be right in 
> what they are intending to convey... ;-) but I thought I'd just put in a vote 
> to stop using the term "Singleton" for this access pattern. It isn't a 
> Singleton (unless there is historical signficance that grandfathers this 
> incorrect term in) and I think that using the term loosely in this case 
> actually weakens the power of a pattern vocabulary a bit.
> 
> Unless you're doing something we can't see (which is possible), it is 
> unlikely you are actually creating a Singleton. It is more likely that you 
> are creating class methods that in some/many/most/all cases - are accessing 
> private static instances. Similar in form to ...
> 
> [NSUserDefaults standardUserDefaults]
> [NSNotificationCenter defaultCenter]
> 
> Neither NSApplication, NSUserDefaults nor NSNotificationCenter technically 
> adhere to the Singleton pattern -- although everyone labels this technique as 
> such.
> 
> https://en.wikipedia.org/wiki/Singleton_pattern

Yeah, but are the "effectively singletons"?
> 
> Alex, the API uses lots of different words to grab a-hold of the so-called 
> "standard", "default" or "shared" static instance. Unfortunately, I'm not 
> aware of any docs that specify when to use which adjective or if any one 
> particular adjective should be used when creating a real Singleton ... since 
> none of these are!

I just remember looking into Apple's implemented conventions on this last week 
in iOS and didn't have time to fully look this up.  It's just what I noticed 
they were doing in a few areas that escape me at the moment.  

Except for the application delegate, which does use sharedApplication as its 
accessor.

Cheers.
___

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

iOS - force app to be restarted in the background.

2015-12-21 Thread Alex Zavatone
Hi all.  I'm trying to debug an issue on iOS where it appears that our app 
isn't behaving properly after being put in Airplane Mode overnight and then 
taken off of it.

What I'm seeing in the crash logs are messages about BKUnsuspendLimit which 
leads me to think that the app is being restarted in the background and it's 
not reconfiguring itself properly or going through the normal startup process 
in that case.
BKUnsuspendLimit  exceeded 15 wakes in 300 sec


To test this, is there any way to tell the OS to relaunch the app in the 
background?

Thanks in advance.
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: Finder-like user interface?

2015-12-28 Thread Alex Zavatone
Uli, since you put this together, would you have any insight into finding a 
method to disable the cascade roll down and roll up animation that happens in 
today's Finder and within Xcode as well?

I find it very annoying (and visually distracting) that I have to wait for an 
animation to finish after clicking on a disclosure triangle in an NSOutlineView 
when in the old days, the contents would either display or hide instantly.

It would be awesome if there is a way to get the instant response that we used 
to get.  The less superfluous animations, the better.

Thanks,
Alex Zavatone

On Dec 28, 2015, at 3:38 AM, Uli Kusterer wrote:

> On 28 Dec 2015, at 01:15, Graham Cox  wrote:
>>> On 28 Dec 2015, at 9:45 AM, SevenBits  wrote:
>>> 
>>> For a new application I’m building I need to have a view showing a 
>>> grid-based layout of files, similar to the default view of the Finder. I’m 
>>> not sure how to implement this. NSCollectionView appears to suffice, and 
>>> I’ve used it before, but it simply isn’t performant as it doesn’t reuse 
>>> cells, and it doesn’t seem like it’s designed for this kind of thing. On 
>>> the other kind, NSBrowser seems to be built for representing the file 
>>> system, but based on example code I’ve found on ADC it only seems suitable 
>>> for building an interface out of Miller columns, which isn’t suitable for 
>>> me.
>>> 
>>> Is anyone aware of how to do something like this? I’m open to using 
>>> 3rd-party components and/or code if necessary.
>> 
>> I’ve used Uli Kusterer’s UKDistributedView for this, using a cell class of 
>> my own, and a few other mods. I’m not sure if Uli is still maintaining this, 
>> but it did the job.  
>> http://www.cocoabuilder.com/archive/cocoa/93982-ann-ukdistributedview-finder-icon-view.html
>> 
>> Uli reads this list, he may be able to tell you the latest news.
> 
> I'm using the version on my Github at 
> https://github.com/uliwitness/UKDistributedView in Stacksmith, so it still 
> compiles and runs. That said, the look of the included cell is not quite 
> in-line with today's Finder (I think it's more like 10.5's or so), and if I 
> was doing this class again today, I'd probably try to switch to using 
> CALayers instead of cells. Also, of course the IB plugin stuff in there is no 
> longer useful. But the main view and cell classes proper should be a decent 
> (and reasonably performant) starting point for your needs. Pull requests are 
> appreciated.
> 
> Cheers,
> -- Uli Kusterer
> "The Witnesses of TeachText are everywhere..."
> http://stacksmith.org
> 
> 
> 
> 
> 
> ___
> 
> 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/archive%40mail-archive.com

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

Re: got alert to fire but have two ok buttons

2015-12-28 Thread Alex Zavatone
How can we help you if we can't see the code you used to fire an alert?

Please supply the code that is causing this.

Thanks.

On Dec 28, 2015, at 1:04 PM, Scott Berry wrote:

> I have a bit of an inconvenience now.  I have two okay buttons for my alert.  
> I only need one after the alert.  Where do I begin looking for the error?
> ___
> 
> 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/archive%40mail-archive.com

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

Re: Strange app crash

2016-01-01 Thread Alex Zavatone
Mac OS or iOS?

You state there is a crash, but don't supply a crash log or tell us what type 
of a crash it is.

How do you expect us to help you?  Help us help you.

On Jan 1, 2016, at 9:14 PM, SevenBits wrote:

> Hi list,
> 
> Xcode has decided not to cooperate with me.
> 
> My latest app is crashing constantly when I launch it. It crashes 
> immediately, without showing any UI or starting the app delegate, so I know 
> that my code isn’t the cause. The app will be able to run 3 or 4 times before 
> this happens. This did not happen before I started accessing, and writing to, 
> my app’s Application Support directory.
> 
> The app is sandboxed, destined for the MAS, and is using ARC. Deleting my 
> app’s sandbox container fixes the problem, until it tries to write to the 
> Application Support directory and the cycle starts all over.
> 
> Does anyone have any pointers? Seen this before?
> 
> 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/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/archive%40mail-archive.com

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

Re: Strange app crash

2016-01-01 Thread Alex Zavatone
Am I correct in assuming that it's throwing an exception before it's drawn the 
first window?

If that is the case, check your window XIB.  It's possible that you have 
something mis-wired there.  If you replace your first XIB with a placeholder, 
does the problem go away?

On Jan 1, 2016, at 9:54 PM, SevenBits wrote:

> Okay, I reproduced the error. Setting an exception breakpoint didn’t help; 
> the app crashes anyway, leading me to believe that the problem either a) is 
> not an uncaught exception or b) it is an exception, but occurs before the 
> ObjC runtime is initialized.
> 
> I’ve run the app outside of Xcode and got the following crash report:
> 
> https://gist.github.com/SevenBits/dfff392c19f0332d81ef
> 
>> On Jan 1, 2016, at 9:31 PM, Roland King  wrote:
>> 
>> 
>>> On 2 Jan 2016, at 10:26, SevenBits  wrote:
>>> 
>>> OS X.
>>> 
>>> Sorry, it’s been a frustrating process.
>>> 
>>> I’m working on gathering the other info; in the meantime, here’s a 
>>> screenshot from Xcode at the moment that crash happens: 
>>> http://i.imgur.com/i7qsNOQ.png?1
>>> 
>> 
>> Looks more like an uncaught exception showing at the top level. Do you have 
>> the breakpoint for ‘All Exceptions’ set so you can see where it is?
>> 
>> Or temporarily wrap that call in a try/catch to catch it.
> 
> ___
> 
> 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/archive%40mail-archive.com

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

Re: Only assign value to variable if not nil.

2016-01-06 Thread Alex Zavatone
Bingo.  Ternary operators.

Thanks all.  

On Jan 6, 2016, at 5:45 PM, Alex Zavatone wrote:

> Hi all.  I was just extending some of my configuration file support on iOS to 
> add move from one config file to one master and then a product specific one.
> 
> So, in the master, i'll have the full set of changeable properties defined in 
> a pList and after reading this into a dictionary, I'll assign them to the 
> various properties one at a time.
> 
> Of course, the product specific config file will supply any values we'd wish 
> to overwrite, but not the whole set of options that are in the master.
> 
> In this, I'm currently assigning the property value based on the result 
> returned from calling objectForKey: on the config dictionary.
> 
> Without resorting to if/then/elsing the code to death, is there a way to 
> accomplish assigning a value to a variable only if the value is not nil?
> 
> Or am I thinking about this issue all bass ackwards.
> 
> Yeah, I could use placeholders before assigning, but I'm figuring there's 
> something I could learn here and one of you just might know what that is.
> 
> 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/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/archive%40mail-archive.com

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

Only assign value to variable if not nil.

2016-01-06 Thread Alex Zavatone
Hi all.  I was just extending some of my configuration file support on iOS to 
add move from one config file to one master and then a product specific one.

So, in the master, i'll have the full set of changeable properties defined in a 
pList and after reading this into a dictionary, I'll assign them to the various 
properties one at a time.

Of course, the product specific config file will supply any values we'd wish to 
overwrite, but not the whole set of options that are in the master.

In this, I'm currently assigning the property value based on the result 
returned from calling objectForKey: on the config dictionary.

Without resorting to if/then/elsing the code to death, is there a way to 
accomplish assigning a value to a variable only if the value is not nil?

Or am I thinking about this issue all bass ackwards.

Yeah, I could use placeholders before assigning, but I'm figuring there's 
something I could learn here and one of you just might know what that is.

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: Panes vs. Separate Windows

2016-01-10 Thread Alex Zavatone

On Jan 9, 2016, at 5:19 PM, Rick Mann wrote:

> In complex apps (e.g. CAD apps, IDEs) a given document has many auxiliary 
> windows. The trend in UI at Apple has been to consolidate these into panes in 
> a single window. I've always preferred separate windows (e.g. separate 
> toolbar window).

Same here. I strongly prefer separate windows that I have control over.
___

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: Panes vs. Separate Windows

2016-01-11 Thread Alex Zavatone

On Jan 11, 2016, at 2:17 AM, Britt Durbrow wrote:

> My preference would be multiple windows (one primary document window and 
> several utility panel windows) that can be snapped into place against each 
> other. This gives the freedom to use multiple monitors while also having the 
> screen-real-estate efficiency that a single-window approach would. (FWIW, I’m 
> typing this on a 27” 2560x1440 Acer LCD connected to a 13” Retina MBP; both 
> displays are active at the moment).
> 
> I find that as the problem space that the app is trying to solve becomes more 
> complex, the all-in-one approach that is being pushed by the 
> “full-screen-window” model gets too inflexible.

Back when Macromedia tried to do this what I noticed was that there never is a 
perfect fit when trying to force everything into one window.  There always is 
unused space or not enough space.

Xcode seems to do a pretty good job with this, in its layout but I always end 
up with as many windows as I want and just command ~ or command-shift ~ through 
them to get to the ones that I set up the way I want.

But the joy of setting up multiple inspectors or a shared inspector is 
restoring the shared inspector to what the user set it to and where they 
positioned it whenever the user changes the source of the inspector.  

It always ends up being quite annoying when you set up your inspector position, 
then switch to something else, resize the inspector and reposition it and then 
go back to your other source and find that the inspector doesn't remember the 
position you had put it in.

Lovely little details.



___

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: Panes vs. Separate Windows

2016-01-11 Thread Alex Zavatone
Way back in the mid '90s, there was some double click tool that simply felt 
like the holy grail to me.

You double clicked or option clicked on the title of a window and it would turn 
that window into the "floating windoid" title bar only.  We took this model and 
made it so that when you collapsed a window in that manner, it moved the tiny 
title bar up below the last one you collapsed. When restored, it resumed its 
previous position.  

This way, you could see all of of your windows and hide and retrieve them in an 
instant.  And they only took up a small and organized portion of the screen 
when collapsed.

I loved it.  I was simple, fast, organized and remembered how you positioned 
things previously.

On Jan 11, 2016, at 9:57 AM, Dave wrote:

> 
>> On 9 Jan 2016, at 22:19, Rick Mann  wrote:
>> 
>> In complex apps (e.g. CAD apps, IDEs) a given document has many auxiliary 
>> windows. The trend in UI at Apple has been to consolidate these into panes 
>> in a single window. I've always preferred separate windows (e.g. separate 
>> toolbar window).
> 
> Yes,  separate windows definitely much better IMO. I think the trend towards 
> one big window has been adopted on the Mac because of the iPad/iOS. This is 
> silly IMO because iPad’s only have one screen but on a Mac you can have lots 
> of screens - I have 4 on my main development machine and having one big 
> window is a real pain. I would have thought that for CAD/CAM and Photoshop 
> type apps, most people would be using multiple monitors these days, so I’d go 
> with the separate windows based on that assumption with maybe the option to 
> dock them……
> 
> Cheers
> 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/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/archive%40mail-archive.com

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

Re: enum as String

2016-01-11 Thread Alex Zavatone
I've got a few things set up in Objective-C for getting a string value from an 
enum but I'm sure it's different in Swift.

I can send the Objective-C ones if you think they would be helpful.


On Jan 11, 2016, at 10:37 AM, Eric E. Dolecki wrote:

> I have the following enum
> 
> *enum SomeMode: String {*
> *case ComputeRequired*
> *case Calculating*
> *case Normal*
> *case ComputeUnavailable*
> *}*
> 
> Works great if access like so:
> 
> *SomeMode.Calculating.rawValue*
> 
>   1. How can I get rid of that .rawValue? It works but not coder-friendly.
>   2. How can I set it up so that a shortcut would work in Xcode (i.e.
>   .Calculating)?
> 
> 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/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/archive%40mail-archive.com

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

Looking at moving part of our iOS app become an iOS framework to be used in other apps.

2016-01-15 Thread Alex Zavatone
And this framework would be utilized by other applications.

However, a good amount of app startup and config is triggered in the 
appDelegate, same as push notification, opening the app via URLs and other 
appDelegate related tasks would conflict with the appDelegate of the app using 
the framework.

Is there a set of standard operating practices that are available online to 
review for this type of app restructuring?

Thanks in advance.

- 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: Looking at moving part of our iOS app become an iOS framework to be used in other apps.

2016-01-15 Thread Alex Zavatone

On Jan 15, 2016, at 4:56 PM, Jens Alfke  wrote:

> 
>> On Jan 15, 2016, at 1:31 PM, Alex Zavatone  wrote:
>> 
>> However, a good amount of app startup and config is triggered in the 
>> appDelegate, same as push notification, opening the app via URLs and other 
>> appDelegate related tasks would conflict with the appDelegate of the app 
>> using the framework.
> 
> I think what you’re asking is how the framework can hook into the same calls 
> that the app delegate receives, even though it can’t provide an app delegate 
> of its own?
> 
> Many of the UIApplicationDelegate methods are also posted as equivalent 
> NSNotifications. For example, there’s an 
> UIApplicationDidFinishLaunchingNotification that’s posted at the same time as 
> -application:didFinishLaunchingWithOptions:. (Well, it’s going to be either 
> just before or just after, but you shouldn’t rely on any particular 
> ordering.) It’s easy to have your framework observe those notifications once 
> it’s initialized.
> 
> Some of them don’t have notifications because they need to return a response 
> or because it wouldn’t make sense to have more than one handler; for example 
> -application:openURL:options:. Here the only thing you can do (AFAIK) is to 
> define an equivalent method in your framework’s API, and have the actual app 
> delegate call that method in addition to whatever else it would normally do.
> 

Well, awesome.  That’s just what I’m going to try out and verify.  Thanks.

>> Is there a set of standard operating practices that are available online to 
>> review for this type of app restructuring?
> 
> Not that I know of.
> 
> —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: Best Way to Hold Array of CFRefType’s

2016-01-18 Thread Alex Zavatone
Can you create a simple case simulation where you try out both with a 
placeholder CFFRefType and see which works and which fails?


On Jan 18, 2016, at 8:44 AM, Dave  wrote:

> Hi,
> 
> I have need to keep an Array of CFRefType’s stored in an Object. What is the 
> best way to do this? I can’t use malloc to create a C Array buffer to store 
> them because I don’t know how many there will be to until after I have 
> received them and there are likely to be a lot of them so don’t want to 
> allocate a big buffer unless its needed. The Refs are created using CFCopy so 
> are retained, I release them in the Objects dealloc method.
> 
> I was thinking of using NSPointerArray but I’m not sure if this is 
> appropriate for CFRefTypes?  
> 
> Any suggestions greatly appreciated.
> 
> 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/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/archive%40mail-archive.com

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

Re: How to save a Dictionary Network to a plist file?

2016-01-21 Thread Alex Zavatone
You can use NSCoding to write the object out to disk and read it back.

If you want to convert it to a dictionary, you can save it as a pList

I’m spent right now, but if you’re interested I can send you my code for saving 
and restoring my lists of CLLocations using NSCoding.  It will have to wait for 
tomorrow though.

I’d google around for NSCoding examples if you need something before then.

There’s also a good link to state restoration in this post:

https://www.reddit.com/r/iOSProgramming/comments/41wnxs/ios_data_serialization_ipc_vs_android/

https://www.reddit.com/r/iOSProgramming/comments/41wnxs/ios_data_serialization_ipc_vs_android/cz5r0p3

In any case, let me know if you want to take a look at the stuff I’ve got and 
I’ll send when I’m conscious.

GL.

Alex Zavatone


On Jan 21, 2016, at 7:36 PM, dangerwillrobinsondan...@gmail.com wrote:

> I'm surprised nobody has mentioned JSON. 
> You might later look at it. 
> It can help sometimes by showing where a model is over engineered and can be 
> simpler and more flexible and reusable, but it also might not fit. 
> 
> Sent from my iPhone
> 
>> On Jan 22, 2016, at 2:05 AM, Dave  wrote:
>> 
>> Hi All,
>> 
>> I have Network of Dictionaries containing “LTWNodeInfo” Classes. LTWNodeInfo 
>> contains a Child Dictionary which in turn contains other LTWNodeInfo. The 
>> Key to these dictionaries is a Unique ID string called the NodeID.
>> 
>> @interface LTWNodeInfo
>> @property (copy)NSString*pNodeID;
>> @property (copy)NSString*pNodeType;
>> @property (copy)NSMutableDictionary*pNodeChildDict;
>> @property (copy)LTWNodeInfo*pNodeParentt;
>> 
>> @property (copy)NSString*pNodePayloadString1;
>> @property (copy)NSString*pNodePayloadString2;
>> @property (copy)NSString*pNodePayloadString3;
>> @end
>> 
>> 
>> This all works great and now I’d like to save this to a plist file and load 
>> it later on.
>> 
>> My question is, what is the best way to do this? I was thinking I could make 
>> a dictionary out of the LTWNodeInfo Object and then create a Parallel 
>> Network using the dictionary versions, (I’d just use the Property names as 
>> the Key), but I was wondering if there is an easier way to do this?
>> 
>> Any suggestions greatly appreciated.
>> 
>> 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/dangerwillrobinsondanger%40gmail.com
>> 
>> This email sent to dangerwillrobinsondan...@gmail.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/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/archive%40mail-archive.com

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

Re: How to record screen in iOS

2016-01-22 Thread Alex Zavatone
As somewhat of a cheesy hack, can't you capture the desired views or window 
content as bitmaps on schedule and queue them for processing to a file or set 
of files to be converted into a video?

If it's not your app that you want the client to record, couldn't you make an 
SDK for game vendors to adopt?

I realize I'm way out here in "speculation land™" with this gross assumption, 
but we certainly use the front and back cameras with AVFoundation at a decent 
FPS.  I wonder if you could redirect the screen buffer to take the place of one 
of the camera feeds.  



On Jan 22, 2016, at 12:50 PM, Clark S. Cox III wrote:

> Unfortunately, what you ask is not possible. There are ways for your app to 
> record *itself* (e.g. through ReplayKit), and there are ways for a connected 
> computer to record the screen of any running app (e.g. through QuickTime 
> Player). But there is no way for your app to record *another* app that you 
> didn't develop.
> 
>> On Jan 22, 2016, at 03:41, ico  wrote:
>> 
>> The reason that not to use ReplayKit is simple, if the user play a game
>> without ReplayKit feature then they can not record the video.
>> If I can implement an app for recording, then users can do it no matter
>> what game they play.
>> 
>> Actually I am not asking how to do this for a game I develop, I just want
>> to build a website that user can upload their video for playing game
>> (probably because users want to show how skilful they are) . The app is the
>> tool so they can make the video.
>> 
>> 
>> 
>> On Fri, 22 Jan 2016 at 13:55 David Brittain  wrote:
>> 
>>> If a 3rd party solution will meet your needs the take a look at
>>> https://lookback.io
>>> 
>>> Dave
>>> 
>>> On 21 January 2016 at 19:14, Alex Kac  wrote:
 Is there a reason you can’t use ReplayKit:
 
 
>>> https://developer.apple.com/library/ios/documentation/ReplayKit/Reference/RPScreenRecorder_Ref/index.html#//apple_ref/occ/cl/RPScreenRecorder
 
 I’ve been thinking of exploring this for support purposes (i.e let the
>>> user hit a button to record the screen and send us the video), but to be
>>> honest I haven’t even spent 2 seconds looking at ReplayKit beyond what I
>>> saw at WWDC…so not sure if that’s possible.
 
> On Jan 21, 2016, at 7:45 PM, ico  wrote:
> 
> Hi,
> I know I can do this with QuickTime, but the problem is you need a
>>> computer
> with you to do so, I want the users can do it whenever they want.
> ReplayKit maybe the choice, I will take a look.
> 
> For the sandboxing reason, I know it possibly not to get it done.
>>> However,
> what if there is some dark magic like private API, I use them to develop
> the app and not to upload it
> to app store, I just distribute the app to the users who want to use
>>> it, is
> there any chance?
> 
> Thank you.
> 
> 
> On Thu, 21 Jan 2016 at 00:41 Hunter Hillegas 
> wrote:
> 
>> Building a general purpose iOS app to do this is not possible for
>> sandboxing/privacy reasons.
>> 
>> For your own apps, you can embed ReplayKit or you can connect to the
>>> Mac
>> and use QuickTime to record the screen.
>> 
>>> On Jan 20, 2016, at 1:21 AM, ico  wrote:
>>> 
>>> Hi All,
>>> Is it possible to develop an app that can run in the background and
>> record
>>> the user's device screen. For example, user can use this app to
>>> record a
>>> video how they play a game and post the video on the web etc.
>>> 
>>> Anyone can point me to the right direction to get it done?
>>> Thanks a lot.
>> 
>> 
>> ___
>> 
>> 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/jche128%40gmail.com
>> 
>> This email sent to jche...@gmail.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/alex%40webis.net
> 
> This email sent to a...@webis.net
 
 
 Alex Kac - El capitán
 
 
 ___
 
 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/websites%40paperetto.com
 

Re: How to record screen in iOS

2016-01-22 Thread Alex Zavatone

On Jan 22, 2016, at 1:03 PM, Hunter Hillegas wrote:

> You can (we have done this) but using the public API (even with the iOS 7 
> improvements to getting the screen), this doesn’t give you great FPS on 
> anything but the latest hardware.
> 

Ahhh, well, I remember like 2 years ago searching video feeds for people's 
heads and loading a 720p video on an olden iPad, I was able to get about 20 - 
24 FPS doing on the fly face detection using the iOS 7 libs and AVFoundation.  
Even when using the two cameras, we were able to get a good enough frame rate.

Didn't bother trying to handle audio as well.

I think that's the case though.  What's "good enough" for the frame rate?

Sounds like something fun to try, assuming the OP has vast amounts of spare 
time to try it out.

>> On Jan 22, 2016, at 9:59 AM, Alex Zavatone  wrote:
>> 
>> As somewhat of a cheesy hack, can't you capture the desired views or window 
>> content as bitmaps on schedule and queue them for processing to a file or 
>> set of files to be converted into a video?
>> 
>> If it's not your app that you want the client to record, couldn't you make 
>> an SDK for game vendors to adopt?
>> 
>> I realize I'm way out here in "speculation land™" with this gross 
>> assumption, but we certainly use the front and back cameras with 
>> AVFoundation at a decent FPS.  I wonder if you could redirect the screen 
>> buffer to take the place of one of the camera feeds.  
>> 
> 


___

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 frameworks to my project

2016-01-22 Thread Alex Zavatone
If you select your project from the navigator, you can add frameworks by 
selecting Build Settings in the center Editor window.

From there, there are 4 items that appear, "Target Dependencies", "Compile 
Sources", "Link Binary With Libraries" and "Copy Bundle Resources".

Select and expand "Link Binaries With Libraries" and there is a + sign that 
appears below it.  If you click on the +, you will be presented with a sheet 
that has a search field and a list of frameworks that you can add to your 
project.

I hope this gets you in the right direction.





On Jan 22, 2016, at 7:38 PM, Scott Berry  wrote:

> Hello there,
> 
> I am having trouble seeing the frameworks that come with Xcode.  I need to 
> add some to my project such as the maps and the sound and I need to see which 
> others are available.  I thought I would add those first before redoing my 
> code that way I am covered when I need to access them.  I tried following 
> tutorials on the web but that’s not helping.  I am a Voiceover user.  Thank 
> you for the help.
> 
> 
> 
> ___
> 
> 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/archive%40mail-archive.com

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

Re: adding frameworks to my project

2016-01-22 Thread Alex Zavatone
Yes, your project has 0 frameworks.  When you click the plus, a sheet slides 
down and contains a search field and below it a list of frameworks that you can 
select to add to your project.

At the bottom of that sheet, there should be buttons to allow you to add and 
cancel the frameworks you want to add.

On Jan 22, 2016, at 10:03 PM, Scott Berry wrote:

> Hello Alex and all,
> 
> Alex, I have found what your talking about but it’s showing 0 frame works.  I 
> did exactly as you said.  Would anyone know why this is?
> 
> 
>> On Jan 22, 2016, at 7:08 PM, Alex Zavatone  wrote:
>> 
>> If you select your project from the navigator, you can add frameworks by 
>> selecting Build Settings in the center Editor window.
>> 
>> From there, there are 4 items that appear, "Target Dependencies", "Compile 
>> Sources", "Link Binary With Libraries" and "Copy Bundle Resources".
>> 
>> Select and expand "Link Binaries With Libraries" and there is a + sign that 
>> appears below it.  If you click on the +, you will be presented with a sheet 
>> that has a search field and a list of frameworks that you can add to your 
>> project.
>> 
>> I hope this gets you in the right direction.
>> 
>> 
>> 
>> 
>> 
>> On Jan 22, 2016, at 7:38 PM, Scott Berry  wrote:
>> 
>>> Hello there,
>>> 
>>> I am having trouble seeing the frameworks that come with Xcode.  I need to 
>>> add some to my project such as the maps and the sound and I need to see 
>>> which others are available.  I thought I would add those first before 
>>> redoing my code that way I am covered when I need to access them.  I tried 
>>> following tutorials on the web but that’s not helping.  I am a Voiceover 
>>> user.  Thank you for the help.
>>> 
>>> 
>>> 
>>> ___
>>> 
>>> 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/archive%40mail-archive.com

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

Re: How to save a Dictionary Network to a plist file?

2016-01-24 Thread Alex Zavatone

On Jan 24, 2016, at 1:51 PM, Jens Alfke  wrote:

> 
>> On Jan 24, 2016, at 7:12 AM, Dave  wrote:
>> 
>> And it would synthesize the initWithCoder, encodeWithCoder and copyWithZone 
>> methods.
> 
> It would be nice, but the compiler doesn’t always have enough information to 
> do this:
> 
> * Some instance variables are transient and shouldn’t be archived.
> * Some aren’t an archivable type (e.g. a C struct, C++ class, or a pointer to 
> such) and need to be transformed before being archived (and after being 
> unarchived.)
> * Sometimes the object needs to do extra initialization after loading the 
> instance variables.
> 
> That said, it’d be neat to have a little tool that would read your class’s 
> source code and spit out some basic source code for those methods, which you 
> could then paste in and fix up.

Yeah, as long as it’s an NSObject type and it’s in the class, we should be able 
to automatically get the property type of class and automatically create the 
archiver and dearchiver.

Writing this stuff manually every time seems stupid for the base cases.


> —Jens (who’s written at least three object persistence systems in his career… 
> :)
> ___
> 
> 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/archive%40mail-archive.com

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

Re: Obj-C - your thoughts on hiding data members?

2016-01-24 Thread Alex Zavatone
In this effort, what visual convention would you add to the private properties' 
names to indicate to the viewer that these are not public properties?

A prefix of _ is already used by the compiler to indicate the internal ivar 
backing properties so, what convention should be used for private properties?

On Jan 24, 2016, at 8:05 PM, Quincey Morris wrote:

> On Jan 24, 2016, at 15:55 , Graham Cox  wrote:
>> 
>> Do you generally think this is worth doing?
> 
> I’m not sure its *worth* doing, if you’re looking for a big pay-off, but I 
> agree with Jens that I’d probably do it.
> 
> Sometimes it can be illuminating to see how small a public interface you need 
> to expose. In other cases, it can serve as a kind of code smell to realize 
> that the interface remains stubbornly large.
> 
> I’d also suggest that “modern” Obj-C code, private @interface () extensions 
> tend to disappear completely. You no longer need them for forward-declaring 
> file-local methods. You also — perhaps this might seem a bit controversial — 
> no longer need them for most default (@synthesize-able) private properties. 
> Since ARC and the non-fragile ABI, there’s really no reason to avoid instance 
> variables in favor of private synthesized properties, except when there’s 
> additional behavior that requires a getter or setter.
> 
> In most cases, the only @interface () extensions that remained in my classes 
> were for private readwrite overrides of public readonly properties. Almost 
> everything else just disappeared. It was a little eerie.
> 
> Note that ‘copy’ usually isn’t vital for private properties, because they’re 
> mostly NSString values, and even if you set them to a NSMutableString, you 
> rarely have any code that’s capable of mutating the string later.
> 
> You’d need a property for an 8-byte value that needs to be atomic, but those 
> are pretty rare.
> 
> 
> ___
> 
> 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/archive%40mail-archive.com

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

Re: delete stock apps

2016-01-25 Thread Alex Zavatone

On Jan 25, 2016, at 1:16 AM, Rick C. wrote:

> Does anyone know if there’s a way to delete stock apps on 10.11 without 
> disabling SIP and rebooting the machine?  Or, is there a way to disable SIP 
> without rebooting?  Thanks!
> ___

SIP?  SIP means the library behind internet telephony to me.  What is the 
extension to the SIP acronym that you're referring to?


___

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: Obj-C - your thoughts on hiding data members?

2016-01-25 Thread Alex Zavatone

On Jan 25, 2016, at 5:52 PM, Greg Parker  wrote:

> 
>> On Jan 24, 2016, at 3:55 PM, Graham Cox  wrote:
>> 
>> In Objective-C 2, data members can be moved into a @interface MyClass () 
>> section which lives in the .m file, rather than in the header file as in the 
>> classic case. This makes sense - those data members are typically part of 
>> the private implementation details of a class and not part of the public 
>> interface. 
> 
> Even better, you can move them to @implementation itself. No need for the 
> extra class extension if everything is used inside a single file.
> 
> 
>> But is it worth updating older code to follow this convention? I’ve updated 
>> a lot of older code to declare @properties instead of classic getters and 
>> setters, and that definitely improves readability. This is a further step 
>> I’m contemplating but the benefits are less clear. Do you generally think 
>> this is worth doing?
> 
> A performance gain. @public and @protected ivars each create an exported 
> symbol; @private and @package ivars do not. Reducing symbol exports can 
> improve launch time and stripped executable size. Ivars declared in 
> @implementation or a class extension @interface are @private by default. 
> Ivars in the primary @interface are @protected by default. Therefore you 
> should either move your ivars out of the primary @interface, or leave them in 
> @interface but explicitly declare them @private or @package.

Wow.  This is awesome.  

It also leads directly to the question I had previously, “what are the proper 
naming conventions for these?”

Since a lot of Cocoa relies on visually identifying if the word in question 
starts with a capital letter, a lowercase letter or an _ to communicate to the 
programmer the exact nature of the thing they are looking at, what are the 
proper conventions for these?

Yeah, the ivar for an @property called myThing is _myThing and we can know that 
by looking at it with our eyeballs.  How do we extend that type of visual 
exposure of information of the “thing” being inspected in a similar manner?

Do we have any standards for this?  

If not, should we create some?

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/archive%40mail-archive.com

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

Re: Obj-C - your thoughts on hiding data members?

2016-01-26 Thread Alex Zavatone

On Jan 26, 2016, at 5:47 AM, Dave wrote:

> Hi,
> 
>> Yeah, the ivar for an @property called myThing is _myThing and we can know 
>> that by looking at it with our eyeballs.  How do we extend that type of 
>> visual exposure of information of the “thing” being inspected in a similar 
>> manner?
>> 
>> Do we have any standards for this?  
>> 
>> If not, should we create some?
> 
> There are no standards AFAIK and you will never get everybody to agree a 
> “standard” naming convention, I have my own scheme though:
> 
> Entry Parameters to Methods are prefixed the “the”, local Variables are 
> prefixed “my”, properties are prefixed “p”, Ivar’s “m”, constants “k” and I 
> always try to give some clue as to the type of the data in the variables, 
> e.g. myNameDict, myAddresssAddress, etc.
> 
> Cheers
> Dave

I'm a big fan of using my in front of local variables as well.

Since we're all computery and programmy and stuff, couldn't we put together a 
little matrix of the type of variable and come up with several loose standards?

The reason I ask this (am pressing on this) is that a large amount of what 
communicates to the programmer is in the naming and casing convention of the 
words used. 

All too recently, I have had to deal with code where the programmers used 
completely arbitrary conventions to casing absolutely everything.  Methods, 
classes, properties, ivars, methods, functions, all of them were arbitrarily 
named and cased, making converting the code into something manageable a multi 
month lesson in pain.

One very nice thing about Objective-C/Cocoa is that we have naming conventions 
that communicate to the user what we are looking at.  

As we now have the opportunity to take advantage of these techniques that Greg, 
Graham, Quincy, Snej, et al. are bringing to our attention, it's the perfect 
time to at least try out some conventions that clearly tell the programmer what 
the thing is simply by looking at it.

I think it's a prime opportunity to at least start this.

Just my 2 cents on the matter adjusted for inflation.

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/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/archive%40mail-archive.com

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

Re: Array of Dictionaries as .userInfo

2016-01-26 Thread Alex Zavatone
Shouldn't the notification be as dumb as possible and let the notification 
receiver/processor handle any decisions on what to process or read from?


On Jan 26, 2016, at 10:37 AM, Clark Cox wrote:

> The notification’s userInfo *must* be a dictionary, trying to force it to be 
> something else is just asking for trouble. You could create a dictionary that 
> contains your array of dictionaries if you want to be able to pass it through 
> an NSNotification.
> 
> That said, IMHO, this use of notifications has a little bit of code smell. 
> Ideally, I would expect a notification to tell the control to 
> reload/refresh/relayout itself by asking an appropriate delegate or 
> controller for the data it needs (rather than getting the data out of the 
> notification itself). It helps to have a strictly defined path that your data 
> can follow; if it’s in an NSNotification, it could potentially have come from 
> *anywhere*
> 
> -- 
> Clark Smith Cox III
> clarkc...@gmail.com
> 
>> On Jan 26, 2016, at 07:12, Eric E. Dolecki  wrote:
>> 
>> I have a control which takes an array of dictionaries to construct it's UI
>> (as a distinct method).
>> 
>> Now I'd like to add a notification to supply the data as well. I'd like to
>> pass the data as userInfo.
>> 
>> When constructing the observer method, how do I constuct?
>> 
>> func weHaveData(notification:NSNoticiation){
>>  let dict = notification.userInfo as Array>
>>  control.loadData(dict)
>> }
>> 
>> *Can't convert value of type [NSObject:AnyObject]? to
>> Array> in coercion*
>> 
>> I've tried without the cast. Is there an easy work around?
>> ___
>> 
>> 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/clarkcox3%40gmail.com
>> 
>> This email sent to clarkc...@gmail.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/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/archive%40mail-archive.com

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

Re: Obj-C - your thoughts on hiding data members?

2016-01-26 Thread Alex Zavatone

On Jan 26, 2016, at 2:10 PM, Jens Alfke wrote:

> 
>> On Jan 26, 2016, at 6:32 AM, Alex Zavatone  wrote:
>> 
>> Since we're all computery and programmy and stuff, couldn't we put together 
>> a little matrix of the type of variable and come up with several loose 
>> standards?
>> The reason I ask this (am pressing on this) is that a large amount of what 
>> communicates to the programmer is in the naming and casing convention of the 
>> words used. 
> 
> There is a very longstanding convention in Objective-C — going back to the 
> NeXT days — to prefix instance variables with underscores. You’ll see that in 
> many of Apple’s headers (the ones that still list ivars in the @interface) 
> and in some Apple sample code.
> 

That's the exact first convention that I am aware of which I am referring to.  



> (There was a time when Apple was warning 3rd party developers not to do this 
> because of name collisions with inherited ivar names, but that’s a non-issue 
> with the modern Obj-C runtime.)
> 
> I would strongly urge that anyone prefixing ivars use this convention, for 
> consistency. Additionally, I find that the underscore adds less visual 
> clutter than a letter like “m”. Your brain doesn’t see it as a letter, so it 
> doesn’t get in the way of reading the variable name.

Additionally, when creating an @property, the compiler does this automatically, 
when it create the iVar, correct?

> Beyond that it’s a matter of preference. I prefix static variables with “s”, 
> a convention that dates back to MacApp (~1988!). I don’t see any reason to 
> prefix function parameters or locals in general, since they’re the default, 
> although I sometimes use an “out” prefix for a by-reference parameter like an 
> NSError**.
> 
> —Jens

So, as now as options, we also have:

s to prefix for a static
k for a constant or #define 
my to prefix locals 

With @public and @protected and @private sadly starting with the letter p this 
leaves us without obvious options to connote the style of the variable.

I'm going to step out on a limb and since Xcode has supported editing in UTF-8 
and 16, that we look into those character sets and pick some symbols that 
accurately represent public, protected and private.

These symbols should mean what they represent, and be visually distinct.

They could be put in a little template for copying and pasting when we use them.

The goal here is that when we eyeball our code, we want as much information to 
be presented to us as possible about the nature of each element that we are 
looking at, it's got to be easy to use and visually make sense.

Any ideas for valid characters to prefix @public and @protected and @private 
with?

Here are a few I just pulled up that should display well enough in Menlo 
Regular, but might not make it through email.

📢  public (megaphone - search the character panel for public)

⊖ ⊗ ⊘ ⊙ ⊞ ⨳ ☒ ⨷ ✖︎ private

℗ 🔒 ✔︎  protected (second item is the lock character, +1F512)




Reference
http://www.g8production.com/post/69593399838/private-protected-and-public-vars-in-objective-c

UTF-8 Character set
http://www.fileformat.info/info/charset/UTF-8/list.htm
___

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: Obj-C - your thoughts on hiding data members?

2016-01-26 Thread Alex Zavatone

On Jan 26, 2016, at 4:08 PM, Jens Alfke wrote:

> 
>> On Jan 26, 2016, at 12:43 PM, Alex Zavatone  wrote:
>> 
>> Additionally, when creating an @property, the compiler does this 
>> automatically, when it create the iVar, correct?
> 
> Only if you have auto-synthesis turned on. (Which it is, by default, but I 
> always turn it off because I think it’s a very bad idea: it means a typo in 
> an explicit accessor method’s name isn’t a build error, but causes weird 
> runtime bugs.)
> 
> You have to use `@synthesize foo=_foo`, which is a little annoying. If you 
> just say `@synthesize foo`, for some reason it names the ivar `foo` :-p
> 
>> With @public and @protected and @private sadly starting with the letter p 
>> this leaves us without obvious options to connote the style of the variable.
> 
> 
> I don’t see a need to distinguish ivar names by access level. For one thing, 
> it should be rare to have protected ivars, and extremely rare to have public 
> ones. And besides, it doesn’t seem like such an important distinction that it 
> has to be in your face whenever you use the variable. IMHO, it’s _scope_ 
> that’s the important thing to make clear in the name.
> 
>> I'm going to step out on a limb and since Xcode has supported editing in 
>> UTF-8 and 16, that we look into those character sets and pick some symbols 
>> that accurately represent public, protected and private.
> 
> Now you’re pulling our legs, right Alex?

Yeah, I know.  It's really non conventional, buuut… I've started using some of 
the characters such as the block and non breaking line to make better 
formatting for comments and logging.  Other people who are on the Swift side of 
things are even using smilies and emoticons in their code.  Or so they claim.  
That scares me.

I think of it this way, "people have been allowed to program in Xcode in 
Japanese, Chinese and Korean for a while now.  Why not take advantage of the 
graphics in extended character sets if it doesn't break the universe in all 
sorts of ways."

I am more than happy to be proven wrong and be told that this is an utterly 
horrible idea.

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

iOS app HTTPS handling differences on development vs. Ad-Hoc distributables

2016-01-27 Thread Alex Zavatone
I hope this is the correct place to post this question.

After fixing the code signing issue that plagued us yesterday, I just started 
testing the ad-hoc distributable of our iOS app.

This app uses push notifications and https communication to an internal web 
service end point and upon launch registers for APNS notifications.

Our web service https uses a self signed https cert.

Our app fails https communication with our web service, but only in the ad-hoc 
signed version of the app. (iOS7.x, 8.x, 9.1).  The version I run from Xcode 
has none of these errors on the target devices.

I've got transport security set to allow arbitrary downloads set to true.

We're getting this error on any HTTPS communication:

Jan 27 14:32:51 iPhone-5s [898] :  SecOSStatusWith error:[-25299] 
The operation couldn’t be completed. (OSStatus error -25299 - Remote error : 
The operation couldn’t be completed. (OSStatus error -25299 - duplicate item 
O,genp,A6A11086,L,ck,.,0,acct,svce,gena,v_Data,20160127193251.451476Z,F68AFBD6))

And then lots of:

Jan 27 14:15:44 Alex-Zs-iPhone-6 XX[2966] :  SecTrustEvaluate  [leaf 
AnchorTrusted]
Jan 27 14:15:44 Alex-Zs-iPhone-6 XX[2966] : 
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)



This never used to happen on the web server that we are using with Ad-Hoc 
signed build on the same server.  Is there any restriction that comes into play 
with an ad-hoc distributed iOS app and self signed SSL certs that I haven't 
covered?

Would this best be handled in setting up a challenge response reply?

Ideas are welcome.

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/archive%40mail-archive.com

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

Re: Obj-C - your thoughts on hiding data members?

2016-01-27 Thread Alex Zavatone

On Jan 27, 2016, at 6:38 AM, Dave wrote:

> 
>>> 
 I'm going to step out on a limb and since Xcode has supported editing in 
 UTF-8 and 16, that we look into those character sets and pick some symbols 
 that accurately represent public, protected and private.
>>> 
>>> Now you’re pulling our legs, right Alex?
>> 
>> Yeah, I know.  It's really non conventional, buuut… I've started using some 
>> of the characters such as the block and non breaking line to make better 
>> formatting for comments and logging.
> 
> Wow Man, you *do* like living on the wild-side. I hope it doesn’t come back 
> to bite you! 

Wise words.  

I base this attempt on a fair amount of crash test dummies who have risked this 
before me and constantly asking questions.  Is the character set supported by 
Xcode?  By Git?

The popups in the right side of Inspector Panel with a setting for Text 
Encoding and the amount of people who I've seen code in Japanese with the 
UTF-16 encoding justified me asking this.

But for those crazy Swift kids who are using smilies in variable names, I'm 
going to let them drive the crash test vehicle. 

>> Other people who are on the Swift side of things are even using smilies and 
>> emoticons in their code.  Or so they claim.  That scares me.
> 
> I’m more of a if its not in the ASCII set it ain’t Source Code brigade! lol
> 
> 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/archive%40mail-archive.com

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

Re: App Transport Security exceptions App Store signed app

2016-01-27 Thread Alex Zavatone
Here’s another discussion on nscurl that might help from Quinn at Apple DTS 
with a little more info. Thanks for the tip, Gavin.

https://forums.developer.apple.com/thread/14816




On Jan 27, 2016, at 7:02 PM, Gavin Eadie  wrote:

>> On Jan 27, 2016, at 12:55 AM, Trygve Inda  wrote:
>> 
>> Calls to http on my domain (xericdesign.com) work. Calls via http to my
>> other domain (earthdeskcloudhost02.com) do not work.
> 
> .. you (and others) may find this option on the nscurl command 
> 
>nscurl --ats-diagnostics --verbose http://www.earthdeskcloudhost02.com
> 
>which will try all the Info.plist possibilities to see what works (and 
> doesn’t) .. I didn’t know about this till attending a very good CocoaHeads 
> presentation on the whole ATS topic.  One comment made in that presentation 
> is that this topic is not documented at all well by Apple.
> ___
> 
> 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/archive%40mail-archive.com

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

Re: Obj-C - your thoughts on hiding data members?

2016-01-27 Thread Alex Zavatone

On Jan 27, 2016, at 2:49 PM, Alex Zavatone  wrote:

> 
> On Jan 27, 2016, at 6:38 AM, Dave wrote:
> 
>> 
>>>> 
>>>>> I'm going to step out on a limb and since Xcode has supported editing in 
>>>>> UTF-8 and 16, that we look into those character sets and pick some 
>>>>> symbols that accurately represent public, protected and private.
>>>> 
>>>> Now you’re pulling our legs, right Alex?
>>> 
>>> Yeah, I know.  It's really non conventional, buuut… I've started using some 
>>> of the characters such as the block and non breaking line to make better 
>>> formatting for comments and logging.
>> 
>> Wow Man, you *do* like living on the wild-side. I hope it doesn’t come back 
>> to bite you! 
> 
> Wise words.  
> 
> I base this attempt on a fair amount of crash test dummies who have risked 
> this before me and constantly asking questions.  Is the character set 
> supported by Xcode?  By Git?
> 
> The popups in the right side of Inspector Panel with a setting for Text 
> Encoding and the amount of people who I've seen code in Japanese with the 
> UTF-16 encoding justified me asking this.
> 
> But for those crazy Swift kids who are using smilies in variable names, I'm 
> going to let them drive the crash test vehicle. 
> 
>>> Other people who are on the Swift side of things are even using smilies and 
>>> emoticons in their code.  Or so they claim.  That scares me.
>> 
>> I’m more of a if its not in the ASCII set it ain’t Source Code brigade! lol

Ahh, just a little testing shows that well, if it’s not ASCII, it’s not going 
to work, period.  

“Non-ASCII characters are not allowed outside of literals and identifiers"

They do work fine for logging and in comments though.

myConfigurableOption = @"███"; // 👈 ◄ ⬅︎

someSillyString = @"⎯⎯";


___

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: Trying to understand a permissions failure when writing to ~/Desktop

2016-01-27 Thread Alex Zavatone
According to the sandboxing docs, I recall that for sandboxing, there are a 
certain set of locations where you can save files to without requiring user 
permission.  Your ~/Documents folder is one of them. IIRC, all other locations 
require user confirmation to save the files.

Try saving to the docs folder and/or trying writing to the desktop with 
sandboxing disabled.

On Jan 27, 2016, at 8:42 PM, Graham Cox  wrote:

> I use -[NSData writeToURL:options:error] to write data to files in a location 
> generally chosen by the user. That works fine.
> 
> The default location is ~/Desktop, if the user fails to choose anything, or 
> if the bookmark of the previously chosen location fails to resolve. However, 
> when I try to write the file I get an error 513, ‘you don’t have permission’, 
> underlying error 1, operation not permitted’. If the user chooses the Desktop 
> themselves using the Open panel, it works fine.
> 
> The ~/Desktop permissions seem to be OK - I have readwrite permission on that 
> folder.
> 
> So something is weird about the URL for ~/Desktop when I create it 
> programatically as opposed to what NSOpenPanel returns. Note this isn’t a 
> sandboxed app, so that shouldn’t come into it.
> 
> I create the default URL thusly:
> 
>   NSURL* desktopURL = [[NSFileManager defaultManager] 
> URLForDirectory:NSDesktopDirectory inDomain:NSUserDomainMask 
> appropriateForURL:nil create:YES error:&error];
> 
> 
> I can’t see any obvious difference between the URL here and the one I get 
> from NSOpenPanel, but there must be one.
> 
> 
> Any ideas what the problem could be here?
> 
> —Graham
> 
> 
> 
> 
> 
> 
> ___
> 
> 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/archive%40mail-archive.com

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

Re: Trying to understand a permissions failure when writing to ~/Desktop

2016-01-27 Thread Alex Zavatone
Sorry man.  It’s been a long long day.

On Jan 27, 2016, at 9:54 PM, Roland King  wrote:

> From the original mail
> 
> "Note this isn’t a sandboxed app, so that shouldn’t come into it.”
> 
> 
>> On 28 Jan 2016, at 10:51, Alex Zavatone  wrote:
>> 
>> According to the sandboxing docs, I recall that for sandboxing, there are a 
>> certain set of locations where you can save files to without requiring user 
>> permission.  Your ~/Documents folder is one of them. IIRC, all other 
>> locations require user confirmation to save the files.
>> 
>> Try saving to the docs folder and/or trying writing to the desktop with 
>> sandboxing disabled.
>> 
>> On Jan 27, 2016, at 8:42 PM, Graham Cox  wrote:
>> 
>>> I use -[NSData writeToURL:options:error] to write data to files in a 
>>> location generally chosen by the user. That works fine.
>>> 
>>> The default location is ~/Desktop, if the user fails to choose anything, or 
>>> if the bookmark of the previously chosen location fails to resolve. 
>>> However, when I try to write the file I get an error 513, ‘you don’t have 
>>> permission’, underlying error 1, operation not permitted’. If the user 
>>> chooses the Desktop themselves using the Open panel, it works fine.
>>> 
>>> The ~/Desktop permissions seem to be OK - I have readwrite permission on 
>>> that folder.
>>> 
>>> So something is weird about the URL for ~/Desktop when I create it 
>>> programatically as opposed to what NSOpenPanel returns. Note this isn’t a 
>>> sandboxed app, so that shouldn’t come into it.
>>> 
>>> I create the default URL thusly:
>>> 
>>> NSURL* desktopURL = [[NSFileManager defaultManager] 
>>> URLForDirectory:NSDesktopDirectory inDomain:NSUserDomainMask 
>>> appropriateForURL:nil create:YES error:&error];
>>> 
>>> 
>>> I can’t see any obvious difference between the URL here and the one I get 
>>> from NSOpenPanel, but there must be one.
>>> 
>>> 
>>> Any ideas what the problem could be here?
>>> 
>>> —Graham
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> ___
>>> 
>>> 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/rols%40rols.org
>> 
>> This email sent to r...@rols.org
> 

___

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: Obj-C - your thoughts on hiding data members?

2016-01-28 Thread Alex Zavatone
Apparently you can't in obj-c, but there appear to be a few tricks on the Swift 
side of things that are interesting and worth checking out.  I saw examples of 
using option p as the pi character and using it in an assignment statement.  
But this is objective-c so you're 100% right.

Sent from my iPhone

> On Jan 28, 2016, at 6:14 AM, Dave  wrote:
> 
> 
>> On 28 Jan 2016, at 00:34, Alex Zavatone  wrote:
>> 
>> Ahh, just a little testing shows that well, if it’s not ASCII, it’s not 
>> going to work, period.  
> 
> See? If it ain’t ASCII it ain’t Source Code! lol
> 
> 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/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/archive%40mail-archive.com

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

Re: Trying to understand a permissions failure when writing to ~/Desktop

2016-01-28 Thread Alex Zavatone

On Jan 28, 2016, at 1:08 AM, Graham Cox wrote:

> 
>> On 28 Jan 2016, at 4:36 PM, Graham Cox  wrote:
>> 
>> Why would the OS think an app was sandboxed
> 
> 
> OK, I think I found the problem. In Build Settings->Code Signing, the “Code 
> Signing Entitlements” was set to a .entitlements file which is actually 
> nothing to do with this product. I don’t know where it got that setting from 
> (I’ve never set it), but it’s wrong. I deleted it and now my app seems to be 
> happy to write where it wants to and doesn’t create a container.
> 
> I’m supposing that the actual sandboxing entitlements are baked into the code 
> signature, not just read from a resource file, and that’s where the system 
> gets its info.
> 
> So Alex, you were right ;)

Happy to help.

Thinking about how we solved this issue, I admit that I'm bit more spent than 
normal this week and only glazed over your "it's not a sandboxed app" part of 
your email, so yeah, bad form on my part.

But…

When looking at the situation, this screamed to me "well, that's just what 
Apple tells us a sandboxed app would do".  

In this case, you reexamined what you assumed was true based on how the app was 
set up and well, damn.  It was an untentionally sandboxed app.

As a lot of the reasons why we are here are to solve problems we are having in 
our Cocoa projects, what I like about this is it shows how we need to revisit 
our assumptions about what we think is true.

I had to do the same thing with our iOS dev account's distribution cert earlier 
this week.  I had assumed that it was the most recent and therefore good.  
Since I do all the distribution here, I assumed they all were mine and 
therefore in my keychain with a private key.  Well, this one wasn't.

Knowing when to revisit our assumptions and double check what we assume to be 
true can sure save time in a bunch of cases.  

Now, back to making push notifications work in dev, adhoc and prod on multiple 
targets.  Multiple certificates for everyone!  Take 2, they're cheap.

> —Graham
> 
> 


___

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: UISearchBar covers status bar

2016-02-01 Thread Alex Zavatone

On Feb 1, 2016, at 5:42 PM, Rick Mann  wrote:

> I've got a UISearchController that I present (presentViewController) as a 
> result of the user tapping a button. When this hapens, the currently-display 
> UINavigationBar slides up off the top of the screen, and the UISearchBar 
> slides down, but it overlaps the status bar.
> 
> None of the answers on coming up in a google search seem to work or be the 
> right way (e.g. setting edgesForExtendedLayout to .None, or actually 
> adjusting the offset in the delegate; that seems terrible).
> 
> Is there a "correct" way (that also works)?
> 

iOS?  Mac OS?

What is the parent view of the UISearchBar?

How are you adding it to the parent view?   There are some obscure settings on 
iOS in the Navigation controller that seriously affect the offset of content if 
you’re displaying a nav bar.

I’ll look up my code when I had to deal with this 3 years ago, hopefully, it 
will still work.

Cheers.


___

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: UISearchBar covers status bar

2016-02-01 Thread Alex Zavatone
Check out how I did it where the search bar is within the scene’s view and the 
scene’s view is the top level view.  Hopefully, this will translate from iOS to 
OS X.

I don’t have the code with me at the moment, but on iOS, there were two a 
settings I had to change to make my other view not offset down an extra 44 
pixels.  I had to set the nav bar AND status bad to transparent or opaque and 
then set the “Layout Adjusts Scroll View Insets" for the view controller.  What 
I’m getting at is that if the direct options aren’t in your custom class in the 
storyboard, they may be in a containing class like a nav controller.  

Hoping that this translates over to Mac OS.


On Feb 1, 2016, at 7:36 PM, Rick Mann  wrote:

>> 
>> On Feb 1, 2016, at 16:06 , Alex Zavatone  wrote:
>> 
>> 
>> On Feb 1, 2016, at 5:42 PM, Rick Mann  wrote:
>> 
>>> I've got a UISearchController that I present (presentViewController) as a 
>>> result of the user tapping a button. When this hapens, the 
>>> currently-display UINavigationBar slides up off the top of the screen, and 
>>> the UISearchBar slides down, but it overlaps the status bar.
>>> 
>>> None of the answers on coming up in a google search seem to work or be the 
>>> right way (e.g. setting edgesForExtendedLayout to .None, or actually 
>>> adjusting the offset in the delegate; that seems terrible).
>>> 
>>> Is there a "correct" way (that also works)?
>>> 
>> 
>> iOS?  Mac OS?
> 
> I don't think UI... exist on OS X.
> 
>> What is the parent view of the UISearchBar?
> 
>> How are you adding it to the parent view?   There are some obscure settings 
>> on iOS in the Navigation controller that seriously affect the offset of 
>> content if you’re displaying a nav bar.
> 
> It is a UISearchController, presented modally. The UISearchController is 
> handling adding the search bar to the window, not sure how. Here's the code:
> 
>   http://pastebin.com/eYB7ba9f
> 
> Examining the view hierarchy after it presents shows a couple full-screen 
> views covering the UINavigationController views, and some bar views that are 
> not UINavigationBars (AFAICT). I don't *think* the nav controller has any 
> effect on this presentation.
> 
> Screenshot:
> 
>   
> http://cl.ly/2r3i1U1l2d3J/Simulator%20Screen%20Shot%20Feb%201,%202016,%2016.35.30%20.png
> 
> 
> -- 
> Rick Mann
> rm...@latencyzero.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: UISearchBar covers status bar

2016-02-01 Thread Alex Zavatone

On Feb 1, 2016, at 10:50 PM, Rick Mann  wrote:

> 
>> On Feb 1, 2016, at 19:47 , Alex Zavatone  wrote:
>> 
>> Check out how I did it where the search bar is within the scene’s view and 
>> the scene’s view is the top level view.  Hopefully, this will translate from 
>> iOS to OS X.
> 
> Not sure why you keep suggesting OS X. This is iOS.
> 
> The problem is the designers want it over the nav bar, not in the view.

Sorry, I misunderstood.  

Create a custom nav bar subclass and add it as a property to the nav bar.

Or do you mean status bar?

In this case, isn’t it easiest to hide the status bar or make it transparent?  
___

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: UISearchBar covers status bar

2016-02-02 Thread Alex Zavatone
Oh, it slides down another view.

It looks like it modally presents a view controller over the current view and 
slides down the view with the search bar and segmented controller.

Look at it.  If you tap on any element in the bottom bar, search immediately 
disappears up and the white background fades away to display the view behind it.

I'll bet this is a crafty use of a modal controller.  

And if I'm wrong, you could take the approach that alertViews take.  They 
present themselves in another window entirely and ride above all the content 
below.




On Feb 1, 2016, at 11:21 PM, Rick Mann wrote:

> 
>> On Feb 1, 2016, at 20:02 , Alex Zavatone  wrote:
>> 
>> 
>> On Feb 1, 2016, at 10:50 PM, Rick Mann  wrote:
>> 
>>> 
>>>> On Feb 1, 2016, at 19:47 , Alex Zavatone  wrote:
>>>> 
>>>> Check out how I did it where the search bar is within the scene’s view and 
>>>> the scene’s view is the top level view.  Hopefully, this will translate 
>>>> from iOS to OS X.
>>> 
>>> Not sure why you keep suggesting OS X. This is iOS.
>>> 
>>> The problem is the designers want it over the nav bar, not in the view.
>> 
>> Sorry, I misunderstood.  
>> 
>> Create a custom nav bar subclass and add it as a property to the nav bar.
>> 
>> Or do you mean status bar?
>> 
>> In this case, isn’t it easiest to hide the status bar or make it 
>> transparent?  
> 
> No, that moves too much stuff around. There's already a nav bar there, I just 
> want the search bar to come down over it.
> 
> The Apple Music player app does exactly this, and it does it without 
> presenting the search controller modally. I'm guessing it's not using 
> UISearchController, but I can't figure out how to do what it does precisely. 
> But it has the precise behavior I want.
> 
> 
> -- 
> Rick Mann
> rm...@latencyzero.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: Easier way to make NSView subclasses refresh on a property change?

2016-02-03 Thread Alex Zavatone
Set a key value observer for each that would call the refresh method.

If there's a way to cluster them all into a collective set of things that would 
change (I think there may) I'm interested in hearing about it too.

Would it be possible (or wise) to add them to an array or set and put the 
observer on that object?


On Feb 3, 2016, at 10:31 AM, Keary Suska wrote:

> 
>> On Feb 2, 2016, at 11:05 PM, Graham Cox  wrote:
>> 
>> Hi all,
>> 
>> Whenever I make a custom view class, it often has a bunch of properties that 
>> affect the content it renders. So, for each setter that does this, I have to 
>> override the setter, do whatever it normally does plus call 
>> -setNeedsDisplay:YES.
>> 
>> This gets tedious.
>> 
>> Is there a good way to automate this for a given set of properties? I 
>> considered overriding -didChangeValueForKey: and checking the key against a 
>> set of exported property names, and that would work, except all my custom 
>> views would then need to subclass this one special kind of view instead of 
>> NSView. Can it be done with a standard NSView? (MacOS)
>> 
>> A similar requirement applies to CALayer too.
> 
> I have had an analogous situation, and my solution, however kludgey, was to 
> have a single property, say a BOOL “refresh”, observe that property, and then 
> use +keyPathForValuesAffectingKey to notify the observer. In your case the 
> observer would call setNeedsDisplay: or whatever was needed.
> 
> HTH,
> 
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
> 
> 
> ___
> 
> 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/archive%40mail-archive.com

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

Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Alex Zavatone

On Feb 4, 2016, at 9:59 AM, Dave  wrote:

> XCode 7.2 (7C68).
> Mac OS X (not iOS).
> 
> Hi,
> 
> I sent the following message to the XCode List, but now I’m wondering if 
> there is a bug in my code that is causing this weird behaviour? What could 
> cause then Debugger to think that a regular object is an Array/Dictionary? 
> 
> The object in question is subclass from a custom base class. Apart from 
> being, NSCopying and NSCoding complaint there isn’t really anything strange 
> about it.
> 
> I’m trying to debug an App. I have a regular object that contains NSString's, 
> NSArray’s and NSDictionary’s.

First of all, they are NSStrings, NSArrays and NSDictionaries. You don’t use an 
apostrophe on a plural.  You’ll cause a fault in our brains’ English compilers.

> I have a method that does an alloc/init to get a new one, but after the init 
> call, the debugger shows the Object as LTWNodeInfo @“0 objects”  as if its an 
> array and if I try to inspect it, it won’t show be any of the properties. If 
> I print it to the log is says its the right class.
> 
> What could someone tell me why this is happening and how to fix it?
> 

Whenever the debugger appears to be barfing, I use a method I call autoDescribe 
that is a category on NSObject.

It goes through each object that you pass to it and walks into objects and 
dumps their properties, the name of the property and its value.

It’s not bulletproof and when an object contains a struct or some more 
foundation item, it might bail on you, but for all the objects that are build 
off of NSObject, it recurses through the object and spits out the items it 
finds.

If you have custom classes with properties that are NSStrings, it’s a stupid 
easy way to get a print out of the object’s internals.  

I’m not sure what the internal structure of your LTWNodeInfo is, but I’ll be 
happy to send this over if you think you’d find it useful.

There are other projects out there in the wild that appear to be called the 
same thing.  I’m not sure if they work better or worse than mine, but here’s 
one that looks useful and easy to try out.

https://github.com/neoneye/autodescribe

Good luck.

> I’m trying to get something finished for tomorrow and I can’t debug my code. 
> I’ve tried Cleaning the Build Folder, Cleaning the Project, Restarting XCode, 
> 
> Thanks in advance
> 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/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/archive%40mail-archive.com

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

Re: Weird Problem, is this an XCode Bug?

2016-02-04 Thread Alex Zavatone


On Feb 4, 2016, at 11:12 AM, Dave  wrote:

> Jeez, really? I need a broken debugger like a hole in the dead at the moment. 
> Any idea what causes it and how to get rid of it? Using “po” won’t help as 
> it’s a custom object, I need to look at the properties. Any ideas how I can 
> do this?

OK.  This is exactly what the autoDescribe category is meant for.

Sending it your way off line

In the debugger simply type this at a breakpoint:

po [myAwesomeObject autoDescribe]

And you’ll get something like this.

(lldb) po [indexPath autoDescribe]
2016-02-04 19:50:29.819 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) 
autoDescriptionForClassType:] [Line 90] length
2016-02-04 19:50:29.819 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) 
autoDescriptionForClassType:] [Line 90] row
2016-02-04 19:50:29.820 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) 
autoDescriptionForClassType:] [Line 90] section
2016-02-04 19:50:29.820 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) 
autoDescriptionForClassType:] [Line 90] item
2016-02-04 19:50:29.820 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) 
autoDescriptionForClassType:] [Line 90] ab_item
2016-02-04 19:50:29.822 SWNDirect[76380:29705304] -[NSObject(AutoDescribe) 
autoDescriptionForClassType:] [Line 90] ab_group
[NSIndexPath {length: Q = 2; 
row: q = 0; 
section: q = 2; 
item: q = 0; 
ab_item: q = 0; 
ab_group: q = 2; 
}]

Instead of something like this:

(lldb) po indexPath
 {length = 2, path = 2 - 0}


You can even use it in your log statements:

GeofenceControllerSingleton.m:1337:DLog(@"%@", [[_geofenceObjects 
objectForKey:myKey] autoDescribe]);


All in all, I find it a major lack of consideration on Apple’s end to not have 
something like this (and better written) in the Cocoa libs.  Apple and 
Objective-C tout object introspection, but Apple doesn’t hand you tools that 
let you spit out your object’s guts.  We shouldn’t have to write this stuff.  
Really.  It’s like selling a mechanic a car with no gauges.

Hope this helps.
___

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 Archives and Serialisations Programming Guide

2016-02-05 Thread Alex Zavatone
The first question is, “Do you have any circular references?”

On Feb 5, 2016, at 8:13 AM, Dave  wrote:

> Hi,
> 
> I’m having problems with Back Links when Archiving/Unarchiving an Object. I 
> found the text below at:
> 
> https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Archiving/Articles/archives.html
> 
> 
> Root Object
> 
> An object graph is not necessarily a simple tree structure. Two objects can 
> contain references to each other, for example, creating a cycle. If a coder 
> follows every link and blindly encodes each object it encounters, this 
> circular reference will generate an infinite loop in the coder. Also, a 
> single object can be referenced by several other objects. The coder must be 
> able to recognize and handle multiple and circular references so that it does 
> not encode more than one copy of each object, but still regenerate all the 
> references when decoding.
> To solve this problem, NSCoder introduces the concept of a root object. The 
> root object is the starting point of an object graph. To encode an object 
> graph, you invoke the NSCoder method encodeRootObject:, passing in the first 
> object to encode. Every object encoded within the context of this invocation 
> is tracked. If the coder is asked to encode an object more than once, the 
> coder encodes a reference to the first encoding instead of encoding the 
> object again.
> 
> NSCoder does not implement support for root objects; NSCoder’s implementation 
> of encodeRootObject: simply encodes the object by invoking encodeObject:. It 
> is the responsibility of its concrete subclasses to keep track of multiple 
> references to objects, thus preserving the structure of any object graphs.
> 
> The last paragraph seems pertinent to my problem, so do I need to do 
> something special for “weak”, back links in order to “keep track of multiple 
> references to objects”? If so could some please tell me how to do this? I’m 
> really struggling to get something out the door and was advised to use the 
> Keyed Archiver/Unarchiver as it would be the simplest implementation……
> 
> Is this any other documentation or sample code available? There are plenty of 
> trivial examples out there, no nothing I can find that works for weak back 
> links, although according to all the Apple Blurb I can find, it is possible, 
> they just don’t tell you how to do it that I can find!
> 
> Thanks in Advance for Any Help
> 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/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/archive%40mail-archive.com

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

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Alex Zavatone

On Feb 5, 2016, at 8:46 AM, Dave wrote:

> 
>> On 5 Feb 2016, at 13:34, Jean-Daniel Dupas  wrote:
>> 
>> And obviously, you also add - encodeWithCoder: and -initWithCoder: methods 
>> in your custom classes.
> 
> Yes, see my other thread, it decodes all the other fields but not the (weak) 
> back links get set to nil most of the time…….

Ahhh.

It would seem that the reference is being lost when the archiving happens.

Would something that is the opposite of strongify/weakify work here?  Sort of a 
strongify a weak reference when it comes to archiving and archive the strong 
reference?

That almost sounds crazy enough to work.

> ___
> 
> 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/archive%40mail-archive.com

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

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Alex Zavatone
Sure.  That would be nice.

I also recall some classes for archiving and dearchiving that use introspection 
that automatically handle the proper action in one line of code.

For simple cases with straightforward collection classes, this is a really 
really really nice approach and frees us from having to write special case code 
for each property.

Something like automaticInitWithCoder and automaticEncodeWithCoder.

It would be nice if the default operations were able to use Objective-C's 
introspection to achieve this, but well, they don't.

If anyone knows of these more automatic initers and encoders, I'd sure like a 
pointer to them.

Thanks and happy you got it working, Dave.

Alex Zavatone



On Feb 5, 2016, at 12:00 PM, Dave wrote:

> Hi Alex,
> 
> Found it! Well, Jean-Daniel did - Thanks again!
> 
> I was barking up the wrong tree thinking it was the back links that were the 
> problem. Using weak caused them to (correctly as it turned out) be set to nil 
> when the node it reference is released. The problem was in the initWithCoder 
> method, I was using:
> 
> self.pNetworkNodeChildArray = [[NSMutableArray alloc] initWithArray:myArray 
> copyItems:YES];
> 
> and that should be - copyItems:NO
> 
> I’m not sure where I got the YES from, I think it was from a very simple 
> example I found online. Anyway if you set it to NO, it works as expected.
> 
> Worth checking if you have this too when you shouldn’t. 
> 
> AFAIK, there are no working examples of using a back link like this, if 
> anyone wants to post my sample code to their web-site they are welcome to it, 
> just drop me a line.
> 
> All the Best
> Dave
> 
>> On 5 Feb 2016, at 16:37, Alex Zavatone  wrote:
>> 
>> 
>> On Feb 5, 2016, at 8:46 AM, Dave wrote:
>> 
>>> 
>>>> On 5 Feb 2016, at 13:34, Jean-Daniel Dupas  wrote:
>>>> 
>>>> And obviously, you also add - encodeWithCoder: and -initWithCoder: methods 
>>>> in your custom classes.
>>> 
>>> Yes, see my other thread, it decodes all the other fields but not the 
>>> (weak) back links get set to nil most of the time…….
>> 
>> Ahhh.
>> 
>> It would seem that the reference is being lost when the archiving happens.
>> 
>> Would something that is the opposite of strongify/weakify work here?  Sort 
>> of a strongify a weak reference when it comes to archiving and archive the 
>> strong reference?
>> 
>> That almost sounds crazy enough to work.
>> 
>>> ___
>>> 
>>> 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/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/archive%40mail-archive.com

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

Re: Question about Archives and Serialisations Programming Guide

2016-02-05 Thread Alex Zavatone

On Feb 5, 2016, at 12:01 PM, Dave wrote:

>> 
>> Would something that is the opposite of strongify/weakify work here?  Sort 
>> of a strongify a weak reference when it comes to archiving and archive the 
>> strong reference?
> 
> Sort of a Quantum reference! 
> 
>> That almost sounds crazy enough to work.
> 
> So do Quantum computers!

Next thing you know, this so called "Internet" thing will take off and people 
will be walking around with "iPhones" in their pockets.

That'll be the day.



___

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

Just a quick verification on a bad access cause.

2016-02-08 Thread Alex Zavatone
iOS 9.x, Xcode 7.1.

I'm sitting in the middle of the debugger, looking at some code I inherited and 
in a regular service, BLAM, EXC_BAD_ACCESS.

This code uses ivars that are named the same as the properties :/ and what I 
noticed, we have this statement where the bad access is appearing:

if ( [myIVar respondsToSelector:@selector(someMethod)] {

EXC_BAD_ACCESS (code=1, address=0x143545358)

I did a po on myiVar and I get an address or 0x00014f05ee00

I'd expect that the bad access would be of the iVar, yet the addresses are 
different.  Is this a red herring?



Also, I'd prefer to use the property not the iVar as I've found these much 
safer in the past for accessing internal objects without causing access issues. 
 

Am I correct here?


This is a wonderful race condition that is hard to reproduce.  I'd like to get 
some professional opinions on my assumptions and approach before I leave the 
debugger.  

Thanks in advance for any pointers, dereferenced or not (humor intended).

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

An API for Airplane mode on iOS?

2016-02-08 Thread Alex Zavatone
On iOS, we're running into particular issues with one user who puts his device 
in Airplane mode overnight.

I'm using reachability classes to determine if we can reach our web services IP 
and monitoring all reachability enums, but would be "really nice™" is if there 
is a published API to read the position of the Airplane Mode setting.

All my sniffing around tells me that there is no formal API for this.  Am I 
correct in assuming that this is true?

Thanks in advance.

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: An API for Airplane mode on iOS?

2016-02-09 Thread Alex Zavatone

On Feb 8, 2016, at 5:13 PM, Jens Alfke  wrote:

> 
>> On Feb 8, 2016, at 1:55 PM, Alex Zavatone  wrote:
>> 
>> I'm using reachability classes to determine if we can reach our web services 
>> IP and monitoring all reachability enums, but would be "really nice™" is if 
>> there is a published API to read the position of the Airplane Mode setting.
> 
> Do you need to treat airplane mode differently than just turning off WiFi 
> (and cellular, if the device has it), or simply being out of reach of a base 
> station?
> 
> Generally it’s enough to know that the host isn’t reachable, or that there 
> are no available network interfaces.
> 

Apparently, I do.  We have a client who puts his device in Airplane Mode 
overnight and he’s on the other side of the planet.

I’ve created multiple tests using reachability and it would be REALLY EASY if 
we could simply respond to changes in the Airplane Mode switch.

BUT, I know this isn’t everything.  I am well aware that the connection will 
often take time to negotiate, so I have several methods meant to test if our 
iOS app can “see” our web server once reachability has changed.

We have some ugly code underneath that doesn’t fail properly (does nothing on a 
fail) and I’m sure that’s related to the issue, but it’s scary in there and I 
don’t have the all the time this requires to address that.


___

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: Just a quick verification on a bad access cause.

2016-02-09 Thread Alex Zavatone

On Feb 8, 2016, at 5:10 PM, Jens Alfke wrote:

> 
>> On Feb 8, 2016, at 1:47 PM, Alex Zavatone  wrote:
>> 
>> if ( [myIVar respondsToSelector:@selector(someMethod)] {
>> EXC_BAD_ACCESS (code=1, address=0x143545358)
>> I did a po on myiVar and I get an address or 0x00014f05ee00
> 
> 0x143545358 is probably the (bogus) class-info pointer it got from the 
> object’s ‘isa’ pointer. So in this case the myIVar pointer itself isn’t 
> itself obviously bad, but it is pointing to garbage. Most likely it used to 
> be a valid object but was dealloced and the memory’s been reused for 
> something else.
> 
> NSZombieEnabled is the obvious thing to try here. And/or the address 
> sanitizer.
> 

Arrrgh.  This is not a trivial case to reproduce.  Thanks for the tips though.  

>> Also, I'd prefer to use the property not the iVar as I've found these much 
>> safer in the past for accessing internal objects without causing access 
>> issues.  
>> Am I correct here?
> 
> I always use ivars because it’s much more efficient in code size and clock 
> cycles. The only case where using ivars directly can bite you is if either 
> the ivar or the property will be modified on another thread, since ARC’s 
> inlined setter code isn't thread-safe.
> 
> But I always prefix ivars with an underscore to make it obvious that they 
> have different scope from locals.

Yeah, something that kills me here.  No camelcasing and identical ivar and 
property names.  : /

Thanks you, sir.  As always, your input is much appreciated.

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: An API for Airplane mode on iOS?

2016-02-09 Thread Alex Zavatone

On Feb 9, 2016, at 12:15 PM, Jens Alfke wrote:

> 
>> On Feb 9, 2016, at 4:17 AM, Alex Zavatone  wrote:
>> 
>> I’ve created multiple tests using reachability and it would be REALLY EASY 
>> if we could simply respond to changes in the Airplane Mode switch.
> 
> This triggers changes in network interfaces that you can detect using the 
> SystemConfiguration framework.
> It _should_ result in a reachability notification, but you’re implying it 
> doesn’t for some reason, right?
> There are lower-level SystemConfiguration APIs that can tell you about 
> network interfaces going up/down.

What is happening is that edge cases are coming back from the client and every 
edge case is another case to fix and test, which requires to much turnaround 
time.

I already removed a race condition where a "start a connection" message was 
sent out when the reachability of the network interfaces had changed to "I am 
not returning 0", but this did not guarantee that the internet connection has 
renegotiated its IP and could reach our target web services yet.

Simply put, if we can detect that this user is has turned off Airplane mode, we 
can respond in a more cautious manner.

The underlying code is wrapping several layers, each with its own "is the 
network available" internal ivar and/or property.

You've pointed me in the right direction, Jens.  If I have the time to fix it, 
that's another matter.

I do have an, "I don't care what changed, can this device reach this IP through 
any means?" method set up.  It's just the underlying layers of PTSD inducing 
fragile spaghetti code that simply aren't safe to try and change that lie 
underneath… waiting to bite the poor soul who thinks they can modify them.  

I'll take a look at the system configuration frameworks.  

Cheers and thanks again.

> 
> —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: An API for Airplane mode on iOS?

2016-02-09 Thread Alex Zavatone

On Feb 9, 2016, at 3:37 PM, Jens Alfke  wrote:

> 
>> On Feb 9, 2016, at 10:38 AM, Alex Zavatone  wrote:
>> 
>> Simply put, if we can detect that this user is has turned off Airplane mode, 
>> we can respond in a more cautious manner.
> 
> But you can run into the same behaviors if the user has turned WiFi and/or 
> cellular off and then back on.

Yup.

> The Airplane Mode switch is just a ‘macro’ that turns WiFi, cellular and 
> Bluetooth off (or back on) at once. You can also get race conditions if the 
> device has been away from WiFi and then comes in range of a network that 
> takes a little while to negotiate. (Usually if you’re listening for 
> reachability of a specific host, you won’t hit these in-between states, 
> though.)
> 
> The way we deal with this is to retry HTTP requests, if they fail with some 
> common transient IP-level errors like ‘no route to host’ or ‘connection reset 
> by peer’. The retry delay doubles after each failure, and most types of 
> requests give up after 3 failures, so the delays are like 1, 2, 4 seconds.

That’s what I would like to do.

However, we have a 4 deep nested set of classes (I didn’t write this and if I 
did, I should be shot), when the operation fails at the lowest level… nothing 
happens.

No return statement indicating an error and in all the classes above it, we 
have the same issue.

That’s what’s obvious.  

Obviously, this a problem, but possibly not the only problem.  

See where I am with this?  It could easily (wait, wait, it is) a snake pit.

(Caveat, yes, you’re right, but my boss will kill me until this gets 
higher priority to address.)

However, all is not lost.  A certain Hoerl type character pointed me to a 
pretty nice SO answer which references to some getIPAddress code from some so 
called “Jens” character for testing if Airplane Mode (or the equivalent) is on.

Well, as luck would have it, I’m already using it, just not in that manner.

SO, before I go digging into a “very bad world”, we can at least run a test by 
our client to see what his device is seeing - connectivitywise.


Then, we can determine if I should prepare to descend into the pit of darkness.

Hopefully, I’ll be able to gut and rebuild the monstrosity before that has to 
happen.  

Thanks again guys.  

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: OT? Xcode Question

2016-02-11 Thread Alex Zavatone
There is an Xcode mailing list that you might want to post this to.

Xcode-users Users 




On Feb 11, 2016, at 10:49 AM, Charles Jenkins wrote:

> I find that when working with an Assistant Editor, I’m typically doing things 
> like creating outlets and actions, where I’m dragging from IB on the left 
> into companion code on the right. Then I’m done with the left side and need 
> to start working on the right side.
> 
> So what I almost always want to do is close the file on the left side; but 
> XCode only offers a way to quickly get rid of the right side. It takes some 
> thought and clicking around to get back to the place I need to work.
> 
> Is there a keystroke I could use to SWAP the content of the left and right 
> panes? I’ve looked around in the menus to find it, but no luck so far.
> 
> With no close button on the left side to give me a one-click solution, it 
> would be mighty handy to find two quick keystrokes that would result in 
> leaving the right-side file open in the main editor.
> 
> -- 
> 
> 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/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/archive%40mail-archive.com

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

Re: Full-text indexing on iOS

2016-02-11 Thread Alex Zavatone
I'm sure you're already done this, but searching on your exact request gives 2 
URLs in Google.

The first is a link to your product unsurprisingly.

The second is a project from 2015 that claims to do what you might want.

I think a quick look at the second project might help to at least see if this 
guy went down the path you are plan to go.

Query:
http://www.google.com/search?client=safari&rls=en&q=ios+full+text+indexing&ie=UTF-8&oe=UTF-8

First link to some Couchbase project:
https://github.com/Blue-Rocket/BRFullTextSearch

Project from second link that claims iOS Full Text Search
https://github.com/Blue-Rocket/BRFullTextSearch


Wish I had a more useful answer.




On Feb 11, 2016, at 4:05 PM, Jens Alfke wrote:

> I’m looking into OS support for full-text indexing, for the database engine I 
> work on. On Mac OS, there’s SearchKit, which does exactly what I want. iOS 
> doesn’t have SearchKit for some reason, but it now has Core Spotlight, which 
> lets me index data. The intended use seems to be for device-wide searching in 
> the home screen’s search UI. Can I instead use it for my own queries?
> 
> iOS does have NSMetadataQuery, for querying Spotlight. Can I use this to 
> search only the data I’ve indexed, without results from other apps? And 
> conversely, is there a way to keep the data I’ve indexed from showing up in 
> the system-wide Spotlight results?
> 
> —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/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/archive%40mail-archive.com

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

Re: Two Problems

2016-02-12 Thread Alex Zavatone
1.  What are you setting the delegate to?  Self?  If so, have you made sure to 
"conform" to that delegate in your class?  Something like @interface 
CharlesViewController : UIViewController  ??

If you don't do that, then the method you need isn't accessible through self 
and BLAMMO!  Unrecognized selector sent to instance.


2. Are you including the asset lib in your bundle for the build?

Is the old name the same as the new name?  Change the name of the graphic and 
see if it's even in the new build.

GL Charles.

Alex Zavatone.

On Feb 12, 2016, at 8:59 AM, Charles Jenkins wrote:

> PROBLEM 1:
> 
> Is there anything new/tricky about the UISearchBar? I have placed one in my 
> view, and dragged an IBOutlet to the companion source file. The result is an 
> @IBOutlet weak var searchBar: UISearchBar!
> 
> I added UISearchBarDelegate to my ViewController and implemented one method: 
> func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String)
> 
> My app works beautifully if I do NOT set searchBar.delegate = self in 
> viewDidLoad(). But if I try to set that delegate to make search work, my app 
> crashes on launch with an unhandled exception saying that an unrecognized 
> selector was called.
> 
> UISearchDelegate’s methods are all marked “optional," I think, but I’m 
> wondering if in the latest version of iOS, one or more of them isn’t really 
> optional anymore…?
> 
> PROBLEM 2:
> 
> I made a change to my launch image graphic and dragged the new version into 
> the assets. The new image shows up there and in my LauchImage UI view, but 
> there seems to be nothing I can do to get it onto a device!
> 
> I performed these steps:
> Cleaned my project
> Cleaned my project build directory
> Quit Xcode
> Rebooted my computer
> Deleted the test app from my device—at this point, the old launch screen 
> should not exist ANYWHERE
> Restarted Xcode
> Reconnected my device
> Started a debug session, which should have rebuilt and reinstalled a fresh, 
> clean copy onto the device
> But somehow the old launch screen appears every time. Clearly there is a 
> cache somewhere that is not cleaned out with the project or its build 
> directory.
> 
> What’s the secret to really getting rid of Xcode’s memory of an old launch 
> image?
> 
> -- 
> 
> 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/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/archive%40mail-archive.com

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

Re: Two Problems

2016-02-12 Thread Alex Zavatone

On Feb 12, 2016, at 11:31 AM, Charles Jenkins wrote:

> Alex,
> 
> The suggestion of changing the graphic’s name is a terrific one. I’ll do that 
> tonight, and I expect it will work. I should’ve thought of that myself. 
> Thanks!

Yay.

> I’m using Swift, but whether my controller conforms or not is the nature of 
> my question. I wasn’t totally clear, but when I said I added 
> UISearchBarDelegate to my controller, I meant I added that protocol name to 
> the list of protocols implemented by the class. Then I added the one optional 
> protocol method I actually need (and I didn’t do something terribly stupid 
> like marking it static). But when I set the status bar’s delegate to self, I 
> crash anyway, as if I’m not really conforming. Since all the methods in the 
> protocol are marked as optional, I don’t know what I could be missing.

Ahh, I express my ignorance of Swifty matters.  Was thinking through this as if 
it was an Objective-C project.

> This is behaving as if my outlet were connected to the wrong kind of object. 
> I think tonight I’ll delete it an re-drag from IB again, just to make sure my 
> outlet really is getting set to an instance of UISearchBar.

AHA!

AHH HAH!

Do you possible have it wired to more than one outlet???  This has happened to 
me in the past.

Of course, we do have the case of an unrecognized selector is being sent to 
"something".  Well, what is that something?  That will tell you a lot.  Is it 
being sent to nil?  What is the class of the object that it is being sent to 
when the exception is triggered?

That will tell you a lot and help you track it down.  If the searchbar is wired 
correctly once and incorrectly on another outlet, then you DO have it working, 
but you also have it failing too.  It can be tricky.

Also, if you dropped into the debugger and issued the method call to self, does 
it also crash?  If so, then you thought you were conforming to the delegate, 
but you're not.

If you are conforming, make sure to then in code set the delegate to self so 
that your class not only confirms, but is actually hooked up to it and ready to 
not crash when it gets that selector sent to it.

Fingers crossed, but those are pretty much the general cases that would cause 
these issues that I've run in to.

I think it's not too hard to figure out if it falls into the above issues.

Lemmie know.  Cheers

Alex Zavatone

> -- 
> 
> Charles
> 
> On February 12, 2016 at 11:07:00, Alex Zavatone (z...@mac.com) wrote:
> 
>> 1. What are you setting the delegate to? Self? If so, have you made sure to 
>> "conform" to that delegate in your class? Something like @interface 
>> CharlesViewController : UIViewController  ?? 
>> 
>> If you don't do that, then the method you need isn't accessible through self 
>> and BLAMMO! Unrecognized selector sent to instance. 
>> 
>> 
>> 2. Are you including the asset lib in your bundle for the build? 
>> 
>> Is the old name the same as the new name? Change the name of the graphic and 
>> see if it's even in the new build. 
>> 
>> GL Charles. 
>> 
>> Alex Zavatone. 
>> 
>> On Feb 12, 2016, at 8:59 AM, Charles Jenkins wrote: 
>> 
>> > PROBLEM 1: 
>> > 
>> > Is there anything new/tricky about the UISearchBar? I have placed one in 
>> > my view, and dragged an IBOutlet to the companion source file. The result 
>> > is an @IBOutlet weak var searchBar: UISearchBar! 
>> > 
>> > I added UISearchBarDelegate to my ViewController and implemented one 
>> > method: func searchBar(_ searchBar: UISearchBar, textDidChange searchText: 
>> > String) 
>> > 
>> > My app works beautifully if I do NOT set searchBar.delegate = self in 
>> > viewDidLoad(). But if I try to set that delegate to make search work, my 
>> > app crashes on launch with an unhandled exception saying that an 
>> > unrecognized selector was called. 
>> > 
>> > UISearchDelegate’s methods are all marked “optional," I think, but I’m 
>> > wondering if in the latest version of iOS, one or more of them isn’t 
>> > really optional anymore…? 
>> > 
>> > PROBLEM 2: 
>> > 
>> > I made a change to my launch image graphic and dragged the new version 
>> > into the assets. The new image shows up there and in my LauchImage UI 
>> > view, but there seems to be nothing I can do to get it onto a device! 
>> > 
>> > I performed these steps: 
>> > Cleaned my project 
>> > Cleaned my project build directory 
>> > Quit Xcode 
>> > Rebooted my computer 
>> > Deleted the test app from 

Re: SOLVED: NSAttributedString: how to add an underline (dotted line) between tab stops?

2016-02-17 Thread Alex Zavatone
David, I put together some helper classes for building NSAttributed strings in 
specific formats on iOS.

One of the things it handles properly is superscripting.  The options for 
superscripting are to scale the superscripted text and shift above the baseline 
based on a percentage of the original font's size or to move it a fixed amount.

If you or anyone else would like, I'd be happy to share.

Email me offline if you'd like me to send.

Cheers,
Alex Zavatone

On Feb 17, 2016, at 9:37 AM, David Hoerl wrote:

> 
>>> Is there a mechanism to do this? Even a gray solid underline that visually 
>>> aligns the items works too (background image?)
>>> 
>> 
>> 
>> Serach the documentation for NSUnderlinePatternDot
>> 
>> —Graham
> 
> Thanks,
> 
> What I had wanted was to place the underline style in the white space between 
> two items that are tab separated.
> 
> I did find this past weekend that simply applying the style to the tab 
> character (the style you mention) resulted in the effect I was hoping for. In 
> hindsight I guess it seems quite rational now.
> 
> Note that patterns also require the specification of a line style (single, 
> double, etc) - so you must or them together.
> ___
> 
> 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/archive%40mail-archive.com

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

Re: Buttons don't work after custom transition presentation?

2016-02-22 Thread Alex Zavatone
How are they wired up.  Send me some screenshots offline and I'll see what I 
can do to help you.

I've got time if you want to work through this.


On Feb 22, 2016, at 6:50 PM, Rick Mann wrote:

> I have a fairly straightforward fade-in custom transition. But the buttons in 
> my destination view controller don't seem to send their messages. Looking at 
> the view hierarchy in Xcode, everything seems to be in the right place and 
> enabled, but my action never gets called.
> 
> Any ideas? Thanks,
> 
> -- 
> Rick Mann
> rm...@latencyzero.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/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/archive%40mail-archive.com

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

ARC code in a non ARC app. iOS

2016-02-23 Thread Alex Zavatone
Hi all.  I'm in the middle of looking at an interesting problem on the iOS side.

We have our code that is ARC and uses external compiled C libs that I'm being 
asked to plug into another iOS project that's significantly larger than ours.

The intent is to run as a little service that can be launched within the other 
iOS project.

The other project that we must fit within is not ARC. Converting it to ARC is 
not feasible, nor our responsibility.

I am successfully building the iOS app that doesn't use ARC with Xcode 7.1 and 
running on iOS 9.1.

Now, I'm familiar with the -fno-objc-arc build flags to disable compiling one 
file at a time, but is there any possibility to include iOS code that does use 
ARC within an app that doesn't?

Do I have a any options here or is this pretty much impossible?

Thanks in advance.

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: ARC code in a non ARC app. iOS

2016-02-23 Thread Alex Zavatone
Yeah, it does. I was thinking about it bassackwardsly.

Would it be recommended to package my ARC code with ARC turned off and package 
that in a framework and then link to that from the non ARC app that will need 
to load it?

Thank you, sir.  

AZ

Sent from my iPhone

> On Feb 23, 2016, at 6:16 PM, Greg Parker  wrote:
> 
> 
>> On Feb 23, 2016, at 1:30 PM, Alex Zavatone  wrote:
>> 
>> Hi all.  I'm in the middle of looking at an interesting problem on the iOS 
>> side.
>> 
>> We have our code that is ARC and uses external compiled C libs that I'm 
>> being asked to plug into another iOS project that's significantly larger 
>> than ours.
>> 
>> The intent is to run as a little service that can be launched within the 
>> other iOS project.
>> 
>> The other project that we must fit within is not ARC. Converting it to ARC 
>> is not feasible, nor our responsibility.
>> 
>> I am successfully building the iOS app that doesn't use ARC with Xcode 7.1 
>> and running on iOS 9.1.
>> 
>> Now, I'm familiar with the -fno-objc-arc build flags to disable compiling 
>> one file at a time, but is there any possibility to include iOS code that 
>> does use ARC within an app that doesn't?
> 
> Yes, -fno-objc-arc works on iOS too. Was that your question?
> 
> 
> -- 
> Greg Parker gpar...@apple.com Runtime Wrangler
> 
> 

___

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 code in a non ARC app. iOS

2016-02-23 Thread Alex Zavatone
Ok. Great. I knew there would be some scariness in there I'd need to know about.

Are there any tools in Instruments or approaches to make sure I'm not going to 
destroy the universe when calling my stuff?

I'm planning on starting by loading a placeholder one screen storyboard as an 
initial test tomorrow morn.

Is that well advised

TY Mr. Q.

Cheers, AZAVATON

Sent from my iPhone

> On Feb 23, 2016, at 6:19 PM, Quincey Morris 
>  wrote:
> 
>> On Feb 23, 2016, at 13:30 , Alex Zavatone  wrote:
>> 
>> Now, I'm familiar with the -fno-objc-arc build flags to disable compiling 
>> one file at a time, but is there any possibility to include iOS code that 
>> does use ARC within an app that doesn't?
> 
> You can mix-and-match ARC source with non-ARC (MMR) source. Just do it the 
> other way around — add -Fobj-arc to the source files that need it.
> 
> The only thing to be careful of is that pointers that cross the boundaries of 
> your ARC code must respect ARC conventions. That is, you might need to use 
> bridged retains and releases, or use casting to describe the memory 
> management characteristics of non-ARC-managed pointers.
> 
> 
___

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 code in a non ARC app. iOS

2016-02-23 Thread Alex Zavatone
Aha!

Awesome.  That will work nicely.

Now my concern is the compiled c lib that my code links to.  Do I also have to 
rebuild that with non ARC flags too?

Sent from my iPhone

> On Feb 23, 2016, at 6:33 PM, Greg Parker  wrote:
> 
> 
>> On Feb 23, 2016, at 3:25 PM, Alex Zavatone  wrote:
>> 
>> Would it be recommended to package my ARC code with ARC turned off and 
>> package that in a framework and then link to that from the non ARC app that 
>> will need to load it?
> 
> Building a separate dylib or static archive is not necessary, but it might be 
> the simplest way to get the project settings correct. Writing custom build 
> flags for each of your source files is likely to be error-prone.
> 
> You can add a check to your ARC source files that will cause a compiler error 
> if ARC is mistakenly off:
> 
>#if !__has_feature(objc_arc)
>#   error This file must be compiled with ARC enabled.
>#endif
> 
> 
> -- 
> Greg Parker gpar...@apple.com Runtime Wrangler
> 
> 

___

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 code in a non ARC app. iOS

2016-02-23 Thread Alex Zavatone
Ok time for me to establish base test cases in very simple cases first.

Sent from my iPhone

> On Feb 23, 2016, at 6:47 PM, Quincey Morris 
>  wrote:
> 
>> On Feb 23, 2016, at 15:25 , Alex Zavatone  wrote:
>> 
>> Would it be recommended to package my ARC code with ARC turned off and 
>> package that in a framework and then link to that from the non ARC app that 
>> will need to load it?
> 
> This would be a really bad idea. :) Your code has no retains and releases, so 
> it will cause crashes unless it is compiled with ARC turned on.
> 
> Think of it this way: ARC does the retains and releases for you. Either you 
> *compile* with ARC, or you *compile* with explicit retains and release. 
> Anything else will crash. Packaging the compiled code doesn’t affect this.
> 
>> On Feb 23, 2016, at 15:29 , Alex Zavatone  wrote:
>> 
>> Are there any tools in Instruments or approaches to make sure I'm not going 
>> to destroy the universe when calling my stuff?
> 
> I don’t think you’re in danger of destroying any universes, but I don’t know 
> that there’s anything automatic to help you.
> 
> The main problem is that your (ARC) code needs to know the memory management 
> of the other (MRR) code. That means that any headers it imports from the 
> other code must not promise things that aren’t true. That includes property 
> attributes such as ‘strong’, ‘unowned’, and assumptions that ARC makes about 
> memory management based on naming. (For example, an object obtained via 
> [[…alloc]init…] is generally assumed to be returned with a +1 ownership, but 
> an object obtained via a class method named ‘newXXX…’ is generally assumed to 
> be returned with +0 ownership.)
> 
> So it’s certainly possible that the other code’s header files may be 
> non-specific enough to cause headaches in your ARC code. You’re probably 
> pretty safe in the other direction, since ARC follows the memory management 
> conventions that well-written MRR code used to use.
> 
> Perhaps your other choice is to use copies of your code, and add the MRR 
> retains and releases back in.
>  
___

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: Getting displayName out of font file

2016-02-26 Thread Alex Zavatone
I've got this somewhere for iOS, I think.  Give me a sec and I'll dig it up.

On Feb 26, 2016, at 5:16 AM, Gerriet M. Denkmann wrote:

> I have a file “Some Font.ttf” and I want to know the displayName of this 
> font, which might be “Some-Font” or “Nice Font” or anything else.
> Or nil if this is not a well-formatted font file.
> I do NOT want to install the font nor do anything with it.
> 
> Short of reverse-engeneering the ttf format (which probably would be rather 
> too much): is there a way to get this?
> 
> Ideally I would line to do:
> NSFont *font = [ NSFont fontFromFilePath: @“/path/to/Some Font.ttf” ];
> NSString *displayName = font.displayName; //  font.fontName would 
> probably also do
> 
> but this seems not to exist.
> 
> Gerriet.
> 
> 
> ___
> 
> 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/archive%40mail-archive.com

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

Re: Getting displayName out of font file

2016-02-26 Thread Alex Zavatone
Hopefully, one of these will help.

#pragma mark - Font Util
//

- (void)dumpFonts {
for (NSString* family in [UIFont familyNames])   {
NSLog(@"Font Family = %@", family);
for (NSString* name in [UIFont fontNamesForFamilyName: family])   {
NSLog(@"Font Name = %@", name);
}
}
}

// Ye olde schoole codee
- (void)dumpFontsx {
// List all fonts on iPhone
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSArray *fontNames;
NSInteger indFamily, indFont;
for (indFamily=0; indFamily<[familyNames count]; ++indFamily)
{
NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]);
fontNames = [[NSArray alloc] initWithArray:
 [UIFont fontNamesForFamilyName:
  [familyNames objectAtIndex:indFamily]]];
for (indFont=0; indFont<[fontNames count]; ++indFont)
{
NSLog(@"Font name: %@", [fontNames objectAtIndex:indFont]);
    }
    }
}





On Feb 26, 2016, at 2:17 PM, Alex Zavatone wrote:

> I've got this somewhere for iOS, I think.  Give me a sec and I'll dig it up.
> 
> On Feb 26, 2016, at 5:16 AM, Gerriet M. Denkmann wrote:
> 
>> I have a file “Some Font.ttf” and I want to know the displayName of this 
>> font, which might be “Some-Font” or “Nice Font” or anything else.
>> Or nil if this is not a well-formatted font file.
>> I do NOT want to install the font nor do anything with it.
>> 
>> Short of reverse-engeneering the ttf format (which probably would be rather 
>> too much): is there a way to get this?
>> 
>> Ideally I would line to do:
>> NSFont *font = [ NSFont fontFromFilePath: @“/path/to/Some Font.ttf” ];
>> NSString *displayName = font.displayName;//  font.fontName would 
>> probably also do
>> 
>> but this seems not to exist.
>> 
>> Gerriet.
>> 
>> 
>> ___
>> 
>> 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/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/archive%40mail-archive.com

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

  1   2   3   4   5   6   7   8   9   10   >