Re: Why so many public properties all up in my grizzle?

2012-03-21 Thread Sebastian Celis
On Mon, Mar 19, 2012 at 2:27 PM, Brian Lambert wrote:
> Is there a way to declare ivars in the .M file AND have them accessible
> from Objective-C Category files for the class?

I will tell you how we handle public, private, and protected ivars and
properties. The route we decided to take was influenced by a number of
overall design goals:

1) Embrace @properties. Properties are great. They make memory
management easier, they work with ARC, and they force us to document
our code and think about relationships between objects (weak vs
strong, atomic vs nonatomic). Exposing _ivars in header files is
gross. You never want people to access them directly, so don't make
those declarations public at all. Exposing _ivars without properties
in .m files is also gross, as it is not clear whether those
relationships are supposed to be strong or weak.
2) Technically, nothing is truly private in Objective-C, so let's stop
trying to completely prevent people from using private APIs. Let's
just adopt a convention that is clear and lets people know that if
they use private APIs they do so at their own risk.
3) Protected and private APIs (including ivars) should not
autocomplete most of the time in Xcode, so they should not be in the
public header file at all. We want the header file to be clear,
concise, and very readable.

Given those decisions, here is how we currently do things:

* Public ivars are always declared as properties in the class header
file. The _ivar should not be declared in the header file at all. Let
the synthesizers declare them in the .m file. _ivars needlessly
complicate the public header files for your classes, so keep them out.
* Don't be afraid to mark many of your public properties as readonly.
You can always override the property declaration as being readwrite in
a class extension in the .m file.
* Private ivars are declared as private @properties in the .m file.
Again, let the synthesizers actually declare the _ivar. Don't declare
the _ivars yourself, as it won't be immediately clear whether the
references are supposed to be strong or weak. Use properties!
* Protected methods and properties are tricky. We want subclasses to
be able to access these directly, but we don't want API consumers to
see them when autocompleting in Xcode or when looking at the public
header file. So, we decided to do what Apple does with
UIGestureRecognizerSubclass.h. We create a special header file that
defines all of the protected properties and methods of a class using a
category. Then, any subclass implementation files can import this file
to easily access those protected APIs. Yes, nothing is stopping a bad
developer from importing this header file and using protected APIs
when they shouldn't, but they are hidden in a different file and
appropriately documented so that developers don't accidentally use
them.

There are many ways to handle public, private, and protected APIs in
Objective-C. We have found this to be a clean approach that works for
us.

- Sebastian
___

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

Please do not post admin requests or moderator comments to the list.
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: Device/Resolution independent positioning of GUI items on iOS

2012-03-21 Thread Sebastian Celis
On Mon, Mar 19, 2012 at 2:59 PM, Alex Zavatone wrote:
> In the current project that I'm tasked to repair from the previous two 
> programmers, I've come across a load of UI elements that have been hardcoded 
> in place with the approach of: Just define the CGRect and we're all good.
>
> Nothing is laid out in an xib file and sometimes the views are hardcoded or 
> hardcoded relative to the rect/bounds of another view.

As Brian mentioned, this is really ok. We do a ton of layout in code
and we try to follow these conventions:

* Layout your views as much as possible in viewDidLoad or
viewDidLayoutSubviews (iOS-5-only).
* When you layout your subviews, do so given the current size of your
superview. Don't hardcode your view's width to be 320 just because you
are doing iPhone development and you know your subview takes up the
entire width of your screen. If you know that your view should be the
entire width of the superview, set the width to be the current width
of the superview.
* Always set appropriate autoresizing masks. In the previous example,
you would most certainly want to set the subview's autoresizing mask
to UIViewAutoresizingFlexibleWidth. If you also want that view to
"stick" to the top of the superview you would instead set it to
(UIViewAutoresizingFlexibleWidth |
UIViewAutoresizingFlexibleBottomMargin).

This is no different than what you would do in a XIB file, it is just
in code, instead.

- Sebastian
___

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

Please do not post admin requests or moderator comments to the list.
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


Installing & running Xcode

2012-03-21 Thread Bill Meng


I've downloaded Xcode 1.0 from Apple to run on OS 10.4. After  
installing Xcode and running it, clicking on New Project, selecting  
'Foundation Tool',  giving it a name and clicking Finish  I get the  
following message


Internal Error
Uncaught Exception:
*** -[PBXToolbar _notificationPostingEnabled]: selector not  
recognized [self = 0x17c42c20]


Stack Backtrace:
The stack backtrace has been logged to the console.

So after finding the created files, I double clicked on main.m which  
restarted Xcode. but when I select 'Build' from the menu, 'Build and  
Run' is grayed disabled.


What is going on here?
___

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

Please do not post admin requests or moderator comments to the list.
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


Delaying Between applicationWillResignActive and applicationDidEnterBackground

2012-03-21 Thread Brian Barnes
I'm facing a real puzzle that might have an easy answer.  I've ported my game 
development software dim3 to iOS.  Works fine, but I'm having a problem with 
the application moving to the background.  My problem is twice as complex 
because I'm trying to figure out what changes might be required in SDL to make 
this work properly.

My biggest problem is this:  My game runs in a tight loop.  When I get 
applicationWillResignActive (after the home button is pushed), I immediately 
put up a flag to stop the loop BUT the loop could be in ANY place.  In physics, 
in rendering, etc.  What I need to do is let the loop complete another complete 
revolution so it finishes everything it needs to do and then get held up at the 
flag that halts it.  Without this, I can't save, and the restart will happen at 
a random place.

The problem is applicationDidEnterBackground gets called immediately without 
any more time given to my application.  I can't save state because state might 
be in a strange place!

The easy solution is to block between the callbacks.  This blocking will be in 
the milliseconds.  But my application gets no additional time between the two 
calls (as far as I can tell, it's hard to debug these calls.)

Another good solution would be someway that when I get into 
applicationDidEnterBackground I can tell it to recall me and then return.

[Additional notes: I *suspect* I'm only getting applicationWillResignActive etc 
when events are pumped; the problem is SDL has a number of routines that 
auto-pump events which means I could receive this message at numerous places in 
the loop].

[>] Brian



___

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

Please do not post admin requests or moderator comments to the list.
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: Delaying Between applicationWillResignActive and applicationDidEnterBackground

2012-03-21 Thread Rhythmic Fistman
On 21 March 2012 05:25, Brian Barnes  wrote:
> I'm facing a real puzzle that might have an easy answer.  I've ported my game 
> development software dim3 to iOS.  Works fine, but I'm having a problem with 
> the application moving to the background.  My problem is twice as complex 
> because I'm trying to figure out what changes might be required in SDL to 
> make this work properly.
>
> My biggest problem is this:  My game runs in a tight loop.  When I get 
> applicationWillResignActive (after the home button is pushed), I immediately 
> put up a flag to stop the loop BUT the loop could be in ANY place.  In 
> physics, in rendering, etc.  What I need to do is let the loop complete 
> another complete revolution so it finishes everything it needs to do and then 
> get held up at the flag that halts it.  Without this, I can't save, and the 
> restart will happen at a random place.
>
> The problem is applicationDidEnterBackground gets called immediately without 
> any more time given to my application.  I can't save state because state 
> might be in a strange place!
>
> The easy solution is to block between the callbacks.  This blocking will be 
> in the milliseconds.  But my application gets no additional time between the 
> two calls (as far as I can tell, it's hard to debug these calls.)
>
> Another good solution would be someway that when I get into 
> applicationDidEnterBackground I can tell it to recall me and then return.
>
> [Additional notes: I *suspect* I'm only getting applicationWillResignActive 
> etc when events are pumped; the problem is SDL has a number of routines that 
> auto-pump events which means I could receive this message at numerous places 
> in the loop].

These kind of problems are never ending because SDL's model just
doesn't fit on the iPhone.
In the end I was only using the audio subsystem, touches wrapped up as
multiple mice & the GL wrapper which are easy to replace with
CoreAudio, [UIResponder touchesBegan:withEvent:] and an EAGLContext.

___

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

Please do not post admin requests or moderator comments to the list.
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: Odd initial save behavior with bundle based NSDocument

2012-03-21 Thread Mike Abdullah
It sounds to me like your writeToURL… method isn't writing out the entire 
document's contents. Can you show us some code? Note that for document 
packages, using NSFileWrapper often makes your implementation a lot easier.

Sent from my iPad

On 20 Mar 2012, at 07:53 PM, Neil Clayton  wrote:

> Hi All,
> 
> I'm seeing something a bit odd with NSDocument in 10.7.
> 
> We're writing large files to our own package, so as a result I've overridden:
> 
> - (BOOL) writeToURL:ofType:forSaveOperation:originalContentsURL:error:
> - (BOOL)readFromURL:ofType:error:
> 
> + (BOOL) autosavesInPlace - is fixed to return YES.
> 
> We have a single index file at the root of the bundle, plus a subfolder 
> called "assets", which while initially empty will get filled with files as we 
> "do stuff" with the document.  Note: the addition of files to this folder can 
> and does occur outside of specific calls to the document. 
> 
> Now, what I'm seeing is this:
> 
> 1) Make a new doc
> 2) Put some additional files within the assets folder of the doc
> 3) Save the new (presently Untitled) doc to the Desktop
> 4) Result: The saved doc *no longer contains the asset file*
> 
> What I understand (according to the NSDocument headers) is that 
> writeSafelyToURL:ofType:forSaveOperation:error: is supposed to do "a 
> bunch-o-stuff" (as outlined in the headers).  And, importantly, at the end
> 
> "4) Moves the just-written file to its final location, or deletes the old 
> on-disk revision of the document, and deletes any temporary directories, 
> depending on the same factors listed for step 1."
> 
> I can see our write call made, to the unsaved doc in ~/Library/Autosave 
> Information/.  If I open this bundle in Finder, the contents are saved just 
> fine, and there is a single asset in the assets folder. This is expected.
> 
> However; it doesn't get moved (point 4 above) correctly.
> When I open the moved document on the Desktop, it's got it's index file, and 
> an assets folder, but there are NO assets inside that folder. It's like the 
> move operation moved everything at level 1, and didn't take into account 
> subfolders.  
> 
> 
> Any ideas?
> 
> --
> Neil Clayton
> 
> 
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net

___

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

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

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

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

Re: Installing & running Xcode

2012-03-21 Thread Alex Zavatone
What's your goal in using 1.0?

Is there any way you can use a newer OS or Xcode?

On Mar 19, 2012, at 7:52 PM, Bill Meng wrote:

> 
> I've downloaded Xcode 1.0 from Apple to run on OS 10.4. After installing 
> Xcode and running it, clicking on New Project, selecting 'Foundation Tool',  
> giving it a name and clicking Finish  I get the following message
> 
> Internal Error
> Uncaught Exception:
> *** -[PBXToolbar _notificationPostingEnabled]: selector not recognized [self 
> = 0x17c42c20]
> 
> Stack Backtrace:
> The stack backtrace has been logged to the console.
> 
> So after finding the created files, I double clicked on main.m which 
> restarted Xcode. but when I select 'Build' from the menu, 'Build and Run' is 
> grayed disabled.
> 
> What is going on here?
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> 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

- 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: Installing & running Xcode

2012-03-21 Thread Nick Zitzmann

On Mar 19, 2012, at 5:52 PM, Bill Meng wrote:

> I've downloaded Xcode 1.0 from Apple to run on OS 10.4. After installing 
> Xcode and running it, clicking on New Project, selecting 'Foundation Tool',  
> giving it a name and clicking Finish  I get the following message

Stop right there; Xcode 1.0 was intended for Panther, not Tiger. If you're 
still using Tiger, then you need to use Xcode 2.x.

Nick Zitzmann



___

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

Please do not post admin requests or moderator comments to the list.
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: Missing header files/folders?

2012-03-21 Thread Jens Alfke

On Mar 20, 2012, at 11:15 PM, Shane Stanley wrote:

> Thanks, Jens. Seems odd that .bridgesupport files are now in one place and 
> headers are in another.

Hm, good point. I'm not an expert on the bridging architecture. You may want to 
ask on xcode-users to get a more authoritative answer about whether headers are 
supposed to exist in the system frameworks.

—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: Missing header files/folders?

2012-03-21 Thread Jens Alfke

On Mar 20, 2012, at 11:20 PM, Kyle Sluder wrote:

> It's my understanding that xcode-select isn't even supposed to exist anymore; 
> any copy you have might be left over from an older Xcode install.

If that's so, then how is a tool supposed to find the location of the Developer 
folder?
Hardcoding /Applications/Xcode.app/Contents/Developer doesn't seem like a good 
idea.

{Actually we should take this thread to the xcode-users list. CCing it and 
directing replies there.}

—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: NSDate interval formatting

2012-03-21 Thread Jens Alfke

On Mar 20, 2012, at 1:38 PM, Markus Spoettl wrote:

>  I'm looking for a way to determine how a locale would like to have date 
> intervals formatted.

I don't think there's anything built-in for this. When I've done something 
similar I've had to use my own localized string resources to define the 
formatting.

—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: Delaying Between applicationWillResignActive and applicationDidEnterBackground

2012-03-21 Thread Brian Barnes

On 3/21/2012 6:14 AM, Rhythmic Fistman wrote:

On 21 March 2012 05:25, Brian Barnes  wrote:

I'm facing a real puzzle that might have an easy answer.  I've ported my game 
development software dim3 to iOS.  Works fine, but I'm having a problem with 
the application moving to the background.  My problem is twice as complex 
because I'm trying to figure out what changes might be required in SDL to make 
this work properly.

My biggest problem is this:  My game runs in a tight loop.  When I get 
applicationWillResignActive (after the home button is pushed), I immediately 
put up a flag to stop the loop BUT the loop could be in ANY place.  In physics, 
in rendering, etc.  What I need to do is let the loop complete another complete 
revolution so it finishes everything it needs to do and then get held up at the 
flag that halts it.  Without this, I can't save, and the restart will happen at 
a random place.

The problem is applicationDidEnterBackground gets called immediately without 
any more time given to my application.  I can't save state because state might 
be in a strange place!

The easy solution is to block between the callbacks.  This blocking will be in 
the milliseconds.  But my application gets no additional time between the two 
calls (as far as I can tell, it's hard to debug these calls.)

Another good solution would be someway that when I get into 
applicationDidEnterBackground I can tell it to recall me and then return.

[Additional notes: I *suspect* I'm only getting applicationWillResignActive etc 
when events are pumped; the problem is SDL has a number of routines that 
auto-pump events which means I could receive this message at numerous places in 
the loop].


These kind of problems are never ending because SDL's model just
doesn't fit on the iPhone.
In the end I was only using the audio subsystem, touches wrapped up as
multiple mice&  the GL wrapper which are easy to replace with
CoreAudio, [UIResponder touchesBegan:withEvent:] and an EAGLContext.


The goal here is to SDL up to snuff when I figure out exactly what the 
problems are.  dim3 runs on OS X, windows, and now iOS with all the same 
files, and I'd like to keep it that way.


I guess one important question will help: when is it possible for 
applicationWillResignActive callback to hit the delegate?  Anytime?  Or 
just during an event pump (SDL is using: 
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, TRUE); to pump.)


If it is only during this pump (which I suspect is true as it's in the 
same thread), then the first solution is to remove all unnecessary 
pumping from SDL itself.  If it's not true, then my problem is outside 
of SDL.


[>] Brian
___

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

Please do not post admin requests or moderator comments to the list.
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 & running Xcode

2012-03-21 Thread Vyacheslav Karamov

Hi!

XCode 2x works pretty good with Panther. We have old PPC mac-mini with 
10.3.9 and XCode 2x (I' don't remember exact version) installed.


21.03.2012 18:11, Nick Zitzmann пишет:

On Mar 19, 2012, at 5:52 PM, Bill Meng wrote:


I've downloaded Xcode 1.0 from Apple to run on OS 10.4. After installing Xcode 
and running it, clicking on New Project, selecting 'Foundation Tool',  giving 
it a name and clicking Finish  I get the following message

Stop right there; Xcode 1.0 was intended for Panther, not Tiger. If you're 
still using Tiger, then you need to use Xcode 2.x.

Nick Zitzmann



___

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

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

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/ubuntulist%40yandex.ru

This email sent to ubuntul...@yandex.ru




___

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

Please do not post admin requests or moderator comments to the list.
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: NSDate interval formatting

2012-03-21 Thread Markus Spoettl

On 3/21/12 5:27 PM, Jens Alfke wrote:

I'm looking for a way to determine how a locale would like to have
date intervals formatted.


I don't think there's anything built-in for this. When I've done
something similar I've had to use my own localized string resources to
define the formatting.


Definitely not something I'd want to do. For this to work consistent 
with other regular dates we'd have to do it for all locales available on 
OS X, not just the locales we translate to.


Regards
Markus
--
__
Markus Spoettl
___

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

Please do not post admin requests or moderator comments to the list.
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 get max size of view according to constraints?

2012-03-21 Thread Per Bull Holmen
Den 01:13 21. mars 2012 skrev Charles Srstka
 følgende:
> On Mar 20, 2012, at 7:00 PM, Peter Ammon wrote:
>
>> 2. Establish another constraint that says the height of the document view 
>> equals the height of the scroll view. Give this constraint a priority lower 
>> than required. What its priority should be depends on how tightly you want 
>> the document view to fill the scroll view, i.e. which other constraints it 
>> should be allowed to break.
>
> This sounds great in concept, but the height I want (if the constraints will 
> allow it) is the scroll view’s documentVisibleRect, not its frame, since the 
> latter includes the size of the scroll bars if they’re visible, and I don’t 
> think that’s doable directly via constraints. However, watching the scroll 
> view’s NSViewFrameDidChangeNotification and manually adding non-required 
> constraints to the size I get from -documentVisibleRect (and clearing out 
> those constraints the next time) works like a champ. As you point out, the 
> mistake I was making before was calling setFrame: here instead of doing this 
> via constraints. Thanks!

I am old school and know nothing about constraints, but given your
descriptions, perhaps you can tie the document view size to the clip
view size (which is also called content view) instead of the scroll
view size?

Per

___

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

Please do not post admin requests or moderator comments to the list.
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

asynchronous nsurlconnection in nsoperation

2012-03-21 Thread Ariel Feinerman
Hi,

I wish to insert an asynchronous NSURLConnection into non-concurrent
NSOperation
the reason is to allow necessarily unarchive actions on the streaming date
so

- (void) connection: (NSURLConnection *) connection didReceiveData:
(NSData*) data {


 // Append the new data to receivedData.

 [_receivedData appendData: data];

 if ([_receivedData length] >= MAX_CHUNK) {

// unarchive

// write to file

// [receivedData setLength: 0];

}

 }

Is there a correct way to do ?



-- 
best regards
Ariel
___

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

Please do not post admin requests or moderator comments to the list.
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 & running Xcode

2012-03-21 Thread jonat...@mugginsoft.com
Take it to the Xcode list.

Regards

Jonathan Mitchell
Mugginsoft LLP

On 19 Mar 2012, at 23:52, Bill Meng wrote:

> 
> I've downloaded Xcode 1.0 from Apple to run on OS 10.4. After installing 
> Xcode and running it, clicking on New Project, selecting 'Foundation Tool',  
> giving it a name and clicking Finish  I get the following message
> 
> Internal Error
> Uncaught Exception:
> *** -[PBXToolbar _notificationPostingEnabled]: selector not recognized [self 
> = 0x17c42c20]
> 
> Stack Backtrace:
> The stack backtrace has been logged to the console.
> 
> So after finding the created files, I double clicked on main.m which 
> restarted Xcode. but when I select 'Build' from the menu, 'Build and Run' is 
> grayed disabled.
> 
> What is going on here?
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/jonathan%40mugginsoft.com
> 
> This email sent to jonat...@mugginsoft.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 get max size of view according to constraints?

2012-03-21 Thread Charles Srstka
On Mar 21, 2012, at 8:54 AM, Per Bull Holmen wrote:

> I am old school and know nothing about constraints, but given your
> descriptions, perhaps you can tie the document view size to the clip
> view size (which is also called content view) instead of the scroll
> view size?

Actually, what I’m doing currently is to tie it to the clipview’s 
-documentVisibleRect.size, which is working quite well.

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

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

RE: Delaying Between applicationWillResignActive andapplicationDidEnterBackground

2012-03-21 Thread Julius Oklamcak
Have you looked into using UIApplication's
-beginBackgroundTaskWithExpirationHandler: in the UIApplicationDelegate's
-applicationDidEnterBackground: to give you some background run time to
finish the loop? 

> My biggest problem is this:  My game runs in a tight loop.  When I get
applicationWillResignActive (after the home button is pushed), I immediately
put up a flag to stop the loop BUT the loop could be in ANY place.  In
physics, in rendering, etc.  What I need to do is let the loop complete
another complete revolution so it finishes everything it needs to do and
then get held up at the flag that halts it.  Without this, I can't save, and
the restart will happen at a random place.
>
> The problem is applicationDidEnterBackground gets called immediately
without any more time given to my application.  I can't save state because
state might be in a strange place!
>
> The easy solution is to block between the callbacks.  This blocking will
be in the milliseconds.  But my application gets no additional time between
the two calls (as far as I can tell, it's hard to debug these calls.)
>
> Another good solution would be someway that when I get into
applicationDidEnterBackground I can tell it to recall me and then return.

___

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

Please do not post admin requests or moderator comments to the list.
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 get max size of view according to constraints?

2012-03-21 Thread Per Bull Holmen
Den 18:09 21. mars 2012 skrev Charles Srstka
 følgende:
> On Mar 21, 2012, at 8:54 AM, Per Bull Holmen wrote:
>
> I am old school and know nothing about constraints, but given your
> descriptions, perhaps you can tie the document view size to the clip
> view size (which is also called content view) instead of the scroll
> view size?
>
>
> Actually, what I’m doing currently is to tie it to the clipview’s
> -documentVisibleRect.size, which is working quite well.
>
> Charles

But from how I understand what you've written, you are constantly
listening for frame changes from the scroll view, and setting new
constraints each time. I don't know how the constraints system works,
but I understood it the way that you wouldn't have to do this if the
scroll view's size was equal to the visible proportion of the document
view. Therefore I was wondering how come you didn't set the
constraints to follow the clip view instead of the scroll view,
because I believe the clip view's frame will always have the same size
as the visible portion of the document view. I think that would be
much cleaner. I haven't done any programming with constraints, so I
don't know if this will work.

Per

___

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

Please do not post admin requests or moderator comments to the list.
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

makeObjectsPerformSelector on a sub class

2012-03-21 Thread Pascal Harris
I'm doing a little development on iOS (but hopefully this will apply equally to 
Mac OS X, so fingers crossed that someone will be able to help me out here), 
and I'm having a little bother with makeObjectsPerformSelector.

I've created a custom view (which will be a tile in my game) as follows:

@interface gameTile : UIView

And I've successfully drawn my tiles onto the iOS Simulator screen.

Now I want to scramble the state of each of the tiles.  In the game controller, 
I'm using the following code:

[[self.view subviews] makeObjectsPerformSelector:@selector(scrambleState)];

I've put a breakpoint in scrambleState - and it never gets called. I'm guessing 
that 'makeObjectsPerformSelector' fails to work because scrambleState is not a 
method in UIView. Question is, what do I need to do in order to ensure that 
this code gets called?

I'm hoping that you can help me out, and regards,

Pascal


___

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

Please do not post admin requests or moderator comments to the list.
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 & running Xcode

2012-03-21 Thread Bill Meng

I will try Version 3, 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: asynchronous nsurlconnection in nsoperation

2012-03-21 Thread Alex Zavatone
Is this for iOS or Mac OS?

I've used Grand Central Dispatch and [NSURLRequest requestWithURL:[NSURL 
URLWithString:urlString]]; 

The second example is synchronous.

There is also:
  NSData  *response_NSData   = [NSURLConnection 
sendSynchronousRequest:my_NSURLRequest  returningResponse:&my_NSURLResponse 
error:&my_NSError];
and

sendAsynchronousRequest:queue:completionHandler:
Loads the data for a URL request and executes a handler block on an operation 
queue when the request completes or fails.

+ (void)sendAsynchronousRequest:(NSURLRequest *)request queue:(NSOperationQueue 
*)queue completionHandler:(void (^)(NSURLResponse*, NSData*, NSError*))handler

Look up the above in the NSURLConnection Class Reference

And also this, but disregard the older stuff.

http://www.raywenderlich.com/4295/multithreading-and-grand-central-dispatch-on-ios-for-beginners-tutorial

Here is my GDC stuff.

- (void)viewDidLoad {
NSLog(@"In viewDidLoad");
[super viewDidLoad];
//NSString * const kRootURLString = @"http://10.6.2.137/";;
NSURL *wordsURL = [NSURL 
URLWithString:@"http://localhost/~zav/Offices.txt?";];

NSURL *myUrl = [NSURL URLWithString:URLstring];
// dispatch_async(kBgQueue, ^{ NSData* data = [NSData 
dataWithContentsOfURL: myUrl]; // THIS IS WHAT YOU WANT Ariel **
  dispatch_sync(kBgQueue, ^{ NSData* data = [NSData 
dataWithContentsOfURL: myUrl]; // doing a sync dispatch here - we want to wait 
for it to finish
  [self performSelectorOnMainThread:@selector(fetchedData:) 
withObject:data waitUntilDone:YES];
  });

// Uncomment the following line to display an Edit button in the navigation 
bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

...

- (void)fetchedData:(NSData *)responseData {
 
 NSLog(@"In fetchedData");
NSLog(@" ");

// log URL data
NSString* newStr = [[NSString alloc] initWithData:responseData 
encoding:NSUTF8StringEncoding];
NSLog(@"%@", newStr);   
}

Practice on a few simple cases until you find a method that you like.  Note 
that I haven't checked my code for any leaks.  This is old play code from 2 
weeks ago.

On Mar 21, 2012, at 11:59 AM, Ariel Feinerman wrote:

> Hi,
> 
> I wish to insert an asynchronous NSURLConnection into non-concurrent
> NSOperation
> the reason is to allow necessarily unarchive actions on the streaming date
> so
> 
> - (void) connection: (NSURLConnection *) connection didReceiveData:
> (NSData*) data {
> 
> 
> // Append the new data to receivedData.
> 
> [_receivedData appendData: data];
> 
> if ([_receivedData length] >= MAX_CHUNK) {
> 
> // unarchive
> 
> // write to file
> 
> // [receivedData setLength: 0];
> 
> }
> 
> }
> 
> Is there a correct way to do ?
> 
> 
> 
> -- 
> best regards
> Ariel
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> 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

- 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: How to get max size of view according to constraints?

2012-03-21 Thread Charles Srstka
On Mar 21, 2012, at 12:52 PM, Per Bull Holmen wrote:

> Den 18:09 21. mars 2012 skrev Charles Srstka
>  følgende:
>> On Mar 21, 2012, at 8:54 AM, Per Bull Holmen wrote:
>> 
>> I am old school and know nothing about constraints, but given your
>> descriptions, perhaps you can tie the document view size to the clip
>> view size (which is also called content view) instead of the scroll
>> view size?
>> 
>> 
>> Actually, what I’m doing currently is to tie it to the clipview’s
>> -documentVisibleRect.size, which is working quite well.
>> 
>> Charles
> 
> But from how I understand what you've written, you are constantly
> listening for frame changes from the scroll view, and setting new
> constraints each time. I don't know how the constraints system works,
> but I understood it the way that you wouldn't have to do this if the
> scroll view's size was equal to the visible proportion of the document
> view. Therefore I was wondering how come you didn't set the
> constraints to follow the clip view instead of the scroll view,
> because I believe the clip view's frame will always have the same size
> as the visible portion of the document view. I think that would be
> much cleaner. I haven't done any programming with constraints, so I
> don't know if this will work.

It seems to be the same in testing; however, is it guaranteed to be that way 
anywhere in the documentation? The fact that NSClipView actually has a separate 
property named -documentVisibleRect seems to imply that it isn’t.

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

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

Re: Missing header files/folders?

2012-03-21 Thread Eric Wing
xcode-select actually ships with the OS, not Xcode. However, Xcode 4.3
no longer automatically sets this path so it the path is left in an
uninitialized or prior Xcode  state.

For default locations, Xcode 4.3 needs to be
/Applications/Xcode.app/Contents/Developer
Prior versions need to be /Developer

I hope xcode-select is not going away. I remember the days when you
could only have one Xcode installation at a time. xcode-select was
part of that solution to allow multiple simultaneous versions.

I noticed many of the command line tools like xcodebuild and opendiff
depend on xcode-select being properly defined. And I think it is a
nuisance that Xcode is not updating this when you install Xcode 4.3.
(If I didn't have to authenticate when I first run Xcode 4.3 with the
Mobile Device frameworks imposed on me, I might not be so irritated.)
I did file a bug on this (#10901952).


As for BridgeSupport, it better ship with the OS or it is completely
useless. The whole idea is to allow final shipping apps that depend on
the information to run. It is not a developer-only thing. (You're
scaring me because I depend on BridgeSupport for some things.)


On 3/21/12, Jens Alfke  wrote:
>
> On Mar 20, 2012, at 11:20 PM, Kyle Sluder wrote:
>
>> It's my understanding that xcode-select isn't even supposed to exist
>> anymore; any copy you have might be left over from an older Xcode install.
>
> If that's so, then how is a tool supposed to find the location of the
> Developer folder?
> Hardcoding /Applications/Xcode.app/Contents/Developer doesn't seem like a
> good idea.
>
> {Actually we should take this thread to the xcode-users list. CCing it and
> directing replies there.}
>
> —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/ewmailing%40gmail.com
>
> This email sent to ewmail...@gmail.com


-- 
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/

___

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

Please do not post admin requests or moderator comments to the list.
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: makeObjectsPerformSelector on a sub class

2012-03-21 Thread Seth Willits
On Mar 21, 2012, at 7:56 AM, Pascal Harris wrote:

> Now I want to scramble the state of each of the tiles.  In the game 
> controller, I'm using the following code:
> 
> [[self.view subviews] makeObjectsPerformSelector:@selector(scrambleState)];
> 
> I've put a breakpoint in scrambleState - and it never gets called. I'm 
> guessing that 'makeObjectsPerformSelector' fails to work because 
> scrambleState is not a method in UIView.

That's definitely not the reason. Making a method call in that way doesn't care 
what class in the hierarchy, or even what category on any of those classes the 
method is implemented at. The method will always be called even if the object 
*doesn't* implement it.

The only reasons it wouldn't be called are:

0) self is nil
1) self.view is nil
2) self.view has no subviews.


--
Seth Willits


___

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

Please do not post admin requests or moderator comments to the list.
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: makeObjectsPerformSelector on a sub class

2012-03-21 Thread Jens Alfke

On Mar 21, 2012, at 7:56 AM, Pascal Harris wrote:

> [[self.view subviews] makeObjectsPerformSelector:@selector(scrambleState)];
> 
> I've put a breakpoint in scrambleState - and it never gets called. I'm 
> guessing that 'makeObjectsPerformSelector' fails to work because 
> scrambleState is not a method in UIView.

No, that isn’t an issue. It will be called correctly regardless of where the 
method was introduced.

Are you sure that the array [self.view subviews] actually contains your views? 
If it’s empty, nothing will happen. If it contains any views that aren’t of 
your subclass, you’ll get an exception raised. Try setting a breakpoint at the 
line you’ve shown, and enter “po [[self view] subviews]”.

—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: makeObjectsPerformSelector on a sub class

2012-03-21 Thread Nick Zitzmann

On Mar 21, 2012, at 8:56 AM, Pascal Harris wrote:

> I've put a breakpoint in scrambleState - and it never gets called. I'm 
> guessing that 'makeObjectsPerformSelector' fails to work because 
> scrambleState is not a method in UIView. Question is, what do I need to do in 
> order to ensure that this code gets called?

It's not a method of UIView; it's a method of various collection objects. And 
to ensure that it's being called, you must break on the 
-makeObjectsPerformSelector: line and ensure that:

1. The code is actually reaching that line.
2. self.view is not nil.
3. self.view.subviews is not nil.
4. self.view.subviews actually has objects in it & is therefore not empty.
5. The line is not throwing an exception.

For 2, 3, and 4 above, you can use the debugger console and the "po" debugger 
command to evaluate the code. Note that you will have to use bracket notation 
instead of dot notation with the po command or it will think you're trying to 
print the object's internals rather than the result of sending a message to an 
accessor.

For 5, you should turn on breaking on ObjC exceptions in the debugger. You can 
do that by clicking on the + button in the breakpoints view in Xcode and then 
choosing to break on exceptions.

Nick Zitzmann



___

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

Please do not post admin requests or moderator comments to the list.
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: asynchronous nsurlconnection in nsoperation

2012-03-21 Thread Sebastian Celis
On Wed, Mar 21, 2012 at 10:59 AM, Ariel Feinerman  wrote:
> I wish to insert an asynchronous NSURLConnection into non-concurrent
> NSOperation

Hi Ariel,

MBRequest does this. It is done by forcing the operation's runloop to
continue running while the network connection is in progress. I would
recommend looking though the source code. Specifically, take a look at
MBURLConnectionOperation.

https://github.com/mobiata/MBRequest
https://github.com/mobiata/MBRequest/blob/master/Classes/MBURLConnectionOperation.m

- Sebastian
___

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

Please do not post admin requests or moderator comments to the list.
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: makeObjectsPerformSelector on a sub class

2012-03-21 Thread Quincey Morris
On Mar 21, 2012, at 07:56 , Pascal Harris wrote:

> @interface gameTile : UIView
> 
> And I've successfully drawn my tiles onto the iOS Simulator screen.
> 
> Now I want to scramble the state of each of the tiles.  In the game 
> controller, I'm using the following code:
> 
> [[self.view subviews] makeObjectsPerformSelector:@selector(scrambleState)];
> 
> I've put a breakpoint in scrambleState - and it never gets called. I'm 
> guessing that 'makeObjectsPerformSelector' fails to work because 
> scrambleState is not a method in UIView. Question is, what do I need to do in 
> order to ensure that this code gets called?

Assuming that 'scrambleState' is a method of the 'gameTile' class, then it 
doesn't matter that it's not a UIView method -- it only matters that it's a 
method of the objects you send the selector to, i.e. the subviews.

One thing to check: if your 'scrambleState' actually has a parameter:

- (void) scrambleState: …

Then you need '@selector(scrambleState:)', not '@selector(scrambleState)'. It's 
an easy thing to overlook.


___

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

Please do not post admin requests or moderator comments to the list.
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: Delaying Between applicationWillResignActive and applicationDidEnterBackground

2012-03-21 Thread Brian Barnes

Julius Oklamcak wrote:

>Have you looked into using UIApplication's
>-beginBackgroundTaskWithExpirationHandler: in the 
>UIApplicationDelegate's-applicationDidEnterBackground: to give you 
>some background run time to finish the loop?


The problem is I need my loop to finish before didEnterBackground is 
called so I know the state is in a good place (i.e., not right in the 
middle of running physics.)  I have all the time I need to actually save 
the state.


I'm beginning to suspect I'm out of luck.  I'm going to have to do a lot 
of runs to see how and win I get the original message, I suspect there's 
something in SDL that makes it harder (i.e., some additional pump events 
in there.)


[>] Brian
___

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

Please do not post admin requests or moderator comments to the list.
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: makeObjectsPerformSelector on a sub class

2012-03-21 Thread Quincey Morris
On Mar 21, 2012, at 13:23 , Quincey Morris wrote:

> One thing to check: if your 'scrambleState' actually has a parameter:
> 
>   - (void) scrambleState: …
> 
> Then you need '@selector(scrambleState:)', not '@selector(scrambleState)'. 
> It's an easy thing to overlook.

Er, pretend you never saw that -- if there was a parameter you wouldn't be 
expecting to invoke 'performSelector…'. Listen to Jens instead.


___

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

Please do not post admin requests or moderator comments to the list.
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: makeObjectsPerformSelector on a sub class

2012-03-21 Thread Greg Parker
On Mar 21, 2012, at 1:23 PM, Quincey Morris 
 wrote:
> One thing to check: if your 'scrambleState' actually has a parameter:
> 
>   - (void) scrambleState: …
> 
> Then you need '@selector(scrambleState:)', not '@selector(scrambleState)'. 
> It's an easy thing to overlook.

Of course, if that were true then 
makeObjectsPerformSelector:@selector(scrambleState:) would do the wrong thing 
anyway, because -makeObjectsPerformSelector: would not pass any value for that 
parameter.


-- 
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: makeObjectsPerformSelector on a sub class

2012-03-21 Thread James Bucanek
Pascal Harris  wrote 
(Wednesday, March 21, 2012 7:56 AM -):



Now I want to scramble the state of each of the tiles.  In the game
controller, I'm using the following code:

[[self.view subviews] makeObjectsPerformSelector:@selector(scrambleState)];

I've put a breakpoint in scrambleState - and it never gets called. I'm
guessing that 'makeObjectsPerformSelector' fails to work because scrambleState
is not a method in UIView. Question is, what do I need to do in order to
ensure that this code gets called?


Others have made a lot of valid suggestions and points, but if 
it wasn't mentioned I have another reason this would fail:


You must ensure that *all* subview of self.view implement 
-scrambleState. The first object in the collection that doesn't 
implement this method will throw an exception and the iteration 
will stop.


Safer, although longer, would be:

// (warning: typed in mail)
UIView* subview;
for ( subview in self.view.subviews )
if ([subview respondsToSelector:@selector(scrambleState)])
[subview scrambleState];
--
James Bucanek


___

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

Please do not post admin requests or moderator comments to the list.
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: Odd initial save behavior with bundle based NSDocument

2012-03-21 Thread Neil Clayton
Hi Mike,

I was about to post code + screenshots showing I had checked all this (which I 
thought I had).
In doing so I found out of course that the autosave mechanism was in fact 
saving all over the show.  Given that we are managing the assets manually (they 
are large, possible GBs in size, hence not using a file wrapper), that was the 
issue.  New projects would be written - assets were not moved (because no 
previous autosave URL or project URL was available in this case), and we'd be 
left with a somewhat empty project.

So, I just made the write: move the assets appropriately if no original 
autosave location was found. Seems to work OK for new docs, saving existing, 
duplication.

Thanks for the question: you got me looking in the right place!

--
Neil

On 22/03/2012, at 12:30 AM, Mike Abdullah wrote:

> It sounds to me like your writeToURL… method isn't writing out the entire 
> document's contents. Can you show us some code? Note that for document 
> packages, using NSFileWrapper often makes your implementation a lot easier.
> 
> Sent from my iPad
> 
> On 20 Mar 2012, at 07:53 PM, Neil Clayton  wrote:
> 
>> Hi All,
>> 
>> I'm seeing something a bit odd with NSDocument in 10.7.
>> 
>> We're writing large files to our own package, so as a result I've overridden:
>> 
>> - (BOOL) writeToURL:ofType:forSaveOperation:originalContentsURL:error:
>> - (BOOL)readFromURL:ofType:error:
>> 
>> + (BOOL) autosavesInPlace - is fixed to return YES.
>> 
>> We have a single index file at the root of the bundle, plus a subfolder 
>> called "assets", which while initially empty will get filled with files as 
>> we "do stuff" with the document.  Note: the addition of files to this folder 
>> can and does occur outside of specific calls to the document. 
>> 
>> Now, what I'm seeing is this:
>> 
>> 1) Make a new doc
>> 2) Put some additional files within the assets folder of the doc
>> 3) Save the new (presently Untitled) doc to the Desktop
>> 4) Result: The saved doc *no longer contains the asset file*
>> 
>> What I understand (according to the NSDocument headers) is that 
>> writeSafelyToURL:ofType:forSaveOperation:error: is supposed to do "a 
>> bunch-o-stuff" (as outlined in the headers).  And, importantly, at the end
>> 
>> "4) Moves the just-written file to its final location, or deletes the 
>> old on-disk revision of the document, and deletes any temporary directories, 
>> depending on the same factors listed for step 1."
>> 
>> I can see our write call made, to the unsaved doc in ~/Library/Autosave 
>> Information/.  If I open this bundle in Finder, the contents are saved just 
>> fine, and there is a single asset in the assets folder. This is expected.
>> 
>> However; it doesn't get moved (point 4 above) correctly.
>> When I open the moved document on the Desktop, it's got it's index file, and 
>> an assets folder, but there are NO assets inside that folder. It's like the 
>> move operation moved everything at level 1, and didn't take into account 
>> subfolders.  
>> 
>> 
>> Any ideas?
>> 
>> --
>> Neil Clayton
>> 
>> 
>> 
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
>> 
>> This email sent to cocoa...@mikeabdullah.net

Neil Clayton
n...@cloudnine.net.nz





___

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

Please do not post admin requests or moderator comments to the list.
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: makeObjectsPerformSelector on a sub class

2012-03-21 Thread Gregory Weston
Pascal Harris wrote:

> Now I want to scramble the state of each of the tiles.  In the game 
> controller, I'm using the following code:
> 
> [[self.view subviews] makeObjectsPerformSelector:@selector(scrambleState)];
> 
> I've put a breakpoint in scrambleState - and it never gets called. I'm 
> guessing that 'makeObjectsPerformSelector' fails to work because 
> scrambleState is not a method in UIView.

That's not how Objective-C works. You can send any message to any object. It 
may not respond well, but there's nothing filtering the send.

My money is on: self.view is nil at the time this code executes.



___

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

Please do not post admin requests or moderator comments to the list.
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 get max size of view according to constraints?

2012-03-21 Thread Per Bull Holmen
Den 19:26 21. mars 2012 skrev Charles Srstka
 følgende:

> It seems to be the same in testing; however, is it guaranteed to be that way
> anywhere in the documentation? The fact that NSClipView actually has a
> separate property named -documentVisibleRect seems to imply that it isn’t.

The -documentVisibleRect property gives the visible portion of the
document in the document view's OWN coordinate system. The main
difference in most cases will be the origin, which will be different
from the frame of the clip view because of scrolling. If the document
view's bounds are set in such a way that the drawing is magnified,
that will also affect the size of -documentVisibleRect, because this
rect is given in the document view's own coordinate system, while a
view's frame is given in the super view's coordinate system. The whole
purpose of the clip view is to clip the document view to show only the
visible portion. Therefore, its size will always be equal to the
visible prtion of the document view. It serves no purpose outside that
area. It would be a strange decision if Apple should ever change that
in the future, to let it serve as an invisible layer above other
views, in addition to clipping the document view? I'd consider that
bizarre, but I don't know if it says so explicitly anywhere in the
docs.

Per

___

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

Please do not post admin requests or moderator comments to the list.
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

NSData, CFData maximum length question

2012-03-21 Thread Grandinetti Philip
I am confused about different behavior I'm seeing with CFData and NSData.If 
I create a new project in XCode 4.3.1 as a Core Foundation command line tool, 
and enter the code below...

#include 
int main(int argc, const char * argv[])
{
CFIndex length = (1ULL << 30);
fprintf(stderr, "length = %ld\n",length);
CFMutableDataRef data = CFDataCreateMutable(kCFAllocatorDefault, 0);
CFDataSetLength(data, length);
}


it crashes with the error message below:

length = 1073741824
test(2463) malloc: *** mmap(size=18446744071562067968) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
2012-03-21 20:55:35.292 test[2463:403] Attempt to allocate -2147483648 bytes 
for NS/CFData failed. Maximum size: 4398046511103

Whereas, if I create a new project as a Foundation command line tool, and enter 
the code below, it runs without errors.

#import 
int main(int argc, const char * argv[])
{
@autoreleasepool {
CFIndex length = (1ULL << 30);
fprintf(stderr, "length = %ld\n",length);
NSMutableData *data = [NSMutableData dataWithCapacity:0];
[data setLength:length];
}
return 0;
}


Both Xcode projects are created (the default) as 64 bit.   So, why does the 
Core Foundation CFDataSetLength get the wrong length?  
I've searched the 64 bit transition guides and can't find any answers.  Any 
suggestions would be greatly appreciated.

Thanks,

Philip




___

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

Please do not post admin requests or moderator comments to the list.
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 get max size of view according to constraints?

2012-03-21 Thread Per Bull Holmen
Den 01:35 22. mars 2012 skrev Per Bull Holmen  følgende:
> The whole
> purpose of the clip view is to clip the document view to show only the
> visible portion. Therefore, its size will always be equal to the
> visible prtion of the document view. It serves no purpose outside that
> area. It would be a strange decision if Apple should ever change that
> in the future, to let it serve as an invisible layer above other
> views, in addition to clipping the document view? I'd consider that
> bizarre, but I don't know if it says so explicitly anywhere in the
> docs.

Actually, I got curious about this, whether the Apple docs says so
explicitly. I didn't find anywhere it said so in my brief search, but
much of their own example code in their scroll view programming guide,
relies on the size of the content view always being equal to the size
of the visible portion of the document view.

Per

___

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

Please do not post admin requests or moderator comments to the list.
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: NSData, CFData maximum length question

2012-03-21 Thread Jens Alfke

On Mar 21, 2012, at 6:00 PM, Grandinetti Philip wrote:

> it crashes with the error message below:
> 
> length = 1073741824
> test(2463) malloc: *** mmap(size=18446744071562067968) failed (error code=12)

That is bizarre — it happens to me too.

18446744071562067968 = 0x8000 … so it’s as though something doubled 
the length parameter, then sign-extended it to 64 bits, before passing it to 
malloc. Why, I have no idea.

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

Please do not post admin requests or moderator comments to the list.
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: NSData, CFData maximum length question

2012-03-21 Thread Grandinetti Philip
Found something interesting.   If I simply set the capacity to "length" instead 
of 0, then it runs without crashing.   Could this be a bug in CFData?

int main(int argc, const char * argv[])
{
CFIndex length = (1ULL << 30);
fprintf(stderr, "length = %ld\n",length);
CFMutableDataRef data = CFDataCreateMutable(kCFAllocatorDefault, length);
CFDataSetLength(data, length);
}

- Philip


On Mar 21, 2012, at 10:26 PM, Jens Alfke wrote:

> 
> On Mar 21, 2012, at 6:00 PM, Grandinetti Philip wrote:
> 
>> it crashes with the error message below:
>> 
>> length = 1073741824
>> test(2463) malloc: *** mmap(size=18446744071562067968) failed (error code=12)
> 
> That is bizarre — it happens to me too.
> 
> 18446744071562067968 = 0x8000 … so it’s as though something 
> doubled the length parameter, then sign-extended it to 64 bits, before 
> passing it to malloc. Why, I have no idea.
> 
> —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: Missing header files/folders?

2012-03-21 Thread Joar Wingfors
Hi all,


On 21 mar 2012, at 12:04, Eric Wing wrote:

> xcode-select actually ships with the OS, not Xcode. However, Xcode 4.3
> no longer automatically sets this path so it the path is left in an
> uninitialized or prior Xcode state.


xcode-select is certainly still a key component of our tools package. As Eric 
points out, it now ships with OS X (as of 10.7.3).


> For default locations, Xcode 4.3 needs to be
> /Applications/Xcode.app/Contents/Developer
> Prior versions need to be /Developer


Correct. Note that when setting the path, you can get away with just pointing 
to the copy of Xcode that you'd like to bless:

sudo xcode-select -switch /Applications/Xcode.app


> I hope xcode-select is not going away. I remember the days when you
> could only have one Xcode installation at a time. xcode-select was
> part of that solution to allow multiple simultaneous versions.


We still want to allow you to have multiple copies of Xcode installed, and 
xcode-select is a cornerstone in making that possible.


Joar



___

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

Please do not post admin requests or moderator comments to the list.
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: NSData, CFData maximum length question

2012-03-21 Thread Seth Willits
On Mar 21, 2012, at 6:00 PM, Grandinetti Philip wrote:

> I am confused about different behavior I'm seeing with CFData and NSData.
> If I create a new project in XCode 4.3.1 as a Core Foundation command line 
> tool, and enter the code below…

You've triggered a bug!

And it took me a long time, but I found it. The bug is in 
__CFDataRoundUpCapacity, and has to do with a bad (1 << ….) which should be (1L 
<< …).


I'll file a report.


--
Seth Willits

___

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

Please do not post admin requests or moderator comments to the list.
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: NSData, CFData maximum length question

2012-03-21 Thread Seth Willits
On Mar 21, 2012, at 10:49 PM, Seth Willits wrote:

> On Mar 21, 2012, at 6:00 PM, Grandinetti Philip wrote:
> 
>> I am confused about different behavior I'm seeing with CFData and NSData.
>> If I create a new project in XCode 4.3.1 as a Core Foundation command line 
>> tool, and enter the code below…
> 
> You've triggered a bug!
> 
> And it took me a long time, but I found it. The bug is in 
> __CFDataRoundUpCapacity, and has to do with a bad (1 << ….) which should be 
> (1L << …).
> 
> 
> I'll file a report.


Filed as 11097403. And yeah, setting the length to anything > 0 when the data 
is created will avoid the bug because the CFData is not  "growable", and 
CFDataSetLength is handled a little different for growable CFDatas vs 
fixed-length mutable ones.

I'm not sure what [NSMutableData dataWithCapacity:0] does, but it's not a 
simple call to CFDataCreateMutable(kCFAllocatorDefault, 0) which is why it 
behaves differently as well. 


--
Seth Willits


___

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

Please do not post admin requests or moderator comments to the list.
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: NSData, CFData maximum length question

2012-03-21 Thread Wade Tregaskis
> I'm not sure what [NSMutableData dataWithCapacity:0] does, but it's not a 
> simple call to CFDataCreateMutable(kCFAllocatorDefault, 0) which is why it 
> behaves differently as well.

It probably ignores the specified capacity, for a start.  NSMutableDictionary 
does for its equivalent method, as does NSMutableArray IIRC.
___

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

Please do not post admin requests or moderator comments to the list.
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: NSData, CFData maximum length question

2012-03-21 Thread Ben Gollmer
On Mar 22, 2012, at 2:12 AM, Seth Willits wrote:

> On Mar 21, 2012, at 10:49 PM, Seth Willits wrote:
> 
>> On Mar 21, 2012, at 6:00 PM, Grandinetti Philip wrote:
>> 
>>> I am confused about different behavior I'm seeing with CFData and NSData.   
>>>  If I create a new project in XCode 4.3.1 as a Core Foundation command line 
>>> tool, and enter the code below…
>> 
>> You've triggered a bug!
>> 
>> And it took me a long time, but I found it. The bug is in 
>> __CFDataRoundUpCapacity, and has to do with a bad (1 << ….) which should be 
>> (1L << …).
>> 
>> I'll file a report.
> 
> Filed as 11097403. And yeah, setting the length to anything > 0 when the data 
> is created will avoid the bug because the CFData is not  "growable", and 
> CFDataSetLength is handled a little different for growable CFDatas vs 
> fixed-length mutable ones.
> 
> I'm not sure what [NSMutableData dataWithCapacity:0] does, but it's not a 
> simple call to CFDataCreateMutable(kCFAllocatorDefault, 0) which is why it 
> behaves differently as well. 


Calling CFDataSetLength() (or CFDataIncreaseLength(), which simply calls 
through to CFDataSetLength()) on a non-growable CFMutableData() short-circuits 
the problematic __CFDataGrow() -> __CFDataRoundUpCapacity() call chain, but 
there's an interesting side effect. Because CFAssert is #defined out on 
non-debug builds of CoreFoundation, the function exits the if loop, but still 
calls __CFDataSetLength() and __CFDataSetNumBytesUsed(). This can result in the 
length being larger than the capacity:

{length = 32, capacity = 16, bytes = 0x00 
... 00}

That means that this code:

CFMutableDataRef data = CFDataCreateMutable(kCFAllocatorDefault, 16);
CFDataSetLength(data, 1ULL << 30);
CFShow(data);

will not crash or complain on the CFDataSetLength() call, but it will segfault 
on the CFShow(), as __CFDataCopyDescription() goes tramping off the end of the 
buffer.

Checking CFDataGetLength() after a bad CFDataSetLength() would lead you to 
believe you had all the requested space available. Unfortunately, there doesn't 
seem to be any way to inspect the capacity of an existing CFMutableData object.

-- 
Ben

___

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

Please do not post admin requests or moderator comments to the list.
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 & running Xcode

2012-03-21 Thread Chris Hanson
Xcode 3.0 and 3.1 are for Mac OS X 10.5 Leopard.

For Mac OS X 10.4 Tiger, you want Xcode 2.0 through 2.5. I recommend Xcode 2.5 
in the strongest possible terms; it fully supports development for Mac OS X on 
both PowerPC- and Intel-based 32-bit Macs, and basic libSystem development for 
64-bit Macs. No released Xcode version earlier than Xcode 2.2 can target 
shipping Intel-based Macs.

  -- Chris

Sent from my iPad

On Mar 21, 2012, at 11:09 AM, Bill Meng  wrote:

> I will try Version 3, 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/cmh%40me.com
> 
> This email sent to c...@me.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