Re: Core Data Multiuser

2012-07-15 Thread Alexander Spohr

Am 15.07.2012 um 08:12 schrieb Eli Bach2:

 On Jul 14, 2012, at 5:18 AM, Alexander Spohr wrote:
 
 Am 13.07.2012 um 21:38 schrieb Flavio Donadio:
 
 Use WebObjects and EOF (the big mature brother of CoreData) on the server!
 
 We feed multiple hundred thousand iOS devices daily with it - as does Apple 
 with iTunes and the Store.
 
 Um, what?  Apple may still be using it internally, but they are no longer 
 publicly updating it or providing support for it?


Support is here:
http://www.wocommunity.org/

We started our current project a year ago. WebObjects still does fine with 
heavy workloads.

atze


___

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

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

2012-07-14 Thread Alexander Spohr

Am 13.07.2012 um 21:38 schrieb Flavio Donadio:

 What do you guys think about it? Is it a bad idea? I've studied a lot of 
 alternatives (BaseTen, ODBC, Web Services), but I can't wrap my head around 
 them...

Use WebObjects and EOF (the big mature brother of CoreData) on the server!

We feed multiple hundred thousand iOS devices daily with it - as does Apple 
with iTunes and the Store.

atze


___

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

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

2012-06-04 Thread Alexander Spohr

Am 03.06.2012 um 13:24 schrieb John Tall:

 a user in Germany will get the entire apps in German even if
 the rest of the phone is configured to run in English.

This is not true as far as my iOS devices are concerned. I can switch it to any 
language and the next app start will show the app in that language (if the app 
is localized for it)


 An obvious scenario when this breaks would be an English speaking
 American moving to Germany. It is possible that he or she don't want
 to learn German and therefore keep using the apps in English.

Our apps are localized for 16 languages and always switch to the user’s 
preference - just using .lproj and NSLocalizedString.
So your English speaking American can move to Germany and keep all apps 
speaking EN-US. (But maybe he should then start learning German anyway)

atze



___

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

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

2012-02-28 Thread Alexander Spohr
Is ViewManager.h still in your projects file list?


Am 28.02.2012 um 10:45 schrieb H. Miersch:

 
 i just ran a little test: i went into my appcontroller.h and turned the 
 #import ViewManager.h line into a comment, then tried to build. result: 
 EXACTLY the same errors. it's like that line isn't even there. WTF?


___

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

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

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

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


Re: Why is a button in a window not redrawn when I change its state?

2011-07-04 Thread Alexander Spohr
Your Button has to draw itself after it called its action.
You try to change state while you are still in the action.

Did you try to performSelector after 0.0?



Am 04.07.2011 um 17:07 schrieb Ulf Dunkel:

 In my app's main window, I have a button which should kill a process from the 
 running system processes. (Guess what - it is helpd.)
 
 In -awakeFromNib:, a private app delegate method -checkHelpd: checks if some 
 other app has already launched helpd. If so, the button will be drawn as 
 enabled, else disabled.
 
 When I press the button, another private method -killHelpd: definitely kills 
 the process, then -checkHelpd: is used again to check whether the button's 
 state should be disabled or enabled. This triggers a redraw of the window - 
 or at least should do. But the button is not redrawn (with its new state) 
 until I toggle the active app from my app to say Xcode and back to my app.
 
 This is the method in my AppDelegate.m which should update the button:
 
 - (void)updateKillHelpdButton
 {
   [killHelpdButton setEnabled:[self checkHelpd]];
   [killHelpdButton setNeedsDisplay:YES];
 }
 
 Can someone please tell me what else I should do to force the redraw?
 
 Thank you in advance,
 ---Ulf Dunkel
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de
 
 This email sent to a...@freeport.de

___

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

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

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

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


Re: Memory Management for an Array

2011-06-13 Thread Alexander Spohr
The shown memory handling is wrong.

Am 13.06.2011 um 16:31 schrieb Bing Li:

 + (NSString *)read:(NSString *)xml Path:(NSString *)xPath

This methods signature should be read:path: with a lowercase p.


 {
// The Instruments indicated the following line got memory leaks.
 The amount of leaked memory was not large (about 400KB)

400 KB is a VERY large amount to leak.

NSXMLDocument *xmlDoc = [[NSXMLDocument alloc] initWithXMLString:xml
 options:NSXMLDocumentTidyXML error:NULL];
 
NSArray *nodes = [xmlDoc nodesForXPath:xPath error:NULL];

You hold a pointer to nodes but you do not retain them (usually no problem)

[xmlDoc release];

But here you release xmlDoc which was the only owner of nodes.
After this line nodes might be gone.
Use autorelease instead. That will keep xmlDoc alive long enough.

if ([nodes count]  0)

This might kill you.

{
return [[nodes objectAtIndex:0] stringValue];

This as well.

}
else
{
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: How to define allowed file extensions in Info.plist?

2011-05-25 Thread Alexander Spohr
Ulf, das ist ein Array, warum tust Du also nicht einfach alle Extensions da 
rein?
Oder habe ich Deine Frage nicht verstanden?

Gruß,
atze


Am 24.05.2011 um 22:38 schrieb Ulf Dunkel:

 Hi Kyle.
 
 On 24.05.2011 17:10, Kyle Sluder wrote:
 On Tue, May 24, 2011 at 7:05 AM, Ulf Dunkeldun...@calamus.net  wrote:
 Can someone please show me how to?
 
 Here is the relevant part of the Info.plist with the current settings for 
 just one file extension (.csv):
 
 keyCFBundleDocumentTypes/key
   array
   dict
   keyCFBundleTypeExtensions/key
   array
   stringCSV/string
   /array
   keyCFBundleTypeIconFile/key
   string/string
   keyCFBundleTypeName/key
   stringCSVDoc/string
   keyCFBundleTypeOSTypes/key
   array
   string/string
   /array
   keyCFBundleTypeRole/key
   stringEditor/string
   keyNSDocumentClass/key
   stringCSVDocument/string
   /dict
   /array
 
 I would like to have three file types set available automatically: .csv, 
 .txt, .dat.
 
 Any help is really appreciated.
 
 ---UlfDunkel
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de
 
 This email sent to a...@freeport.de

___

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

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

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

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


Re: How to define allowed file extensions in Info.plist?

2011-05-25 Thread Alexander Spohr
Sorry for replying in German. I wanted to reply off list only but hit 'reply to 
all'.

Translation:
That’s an array. Why don’t you just put all your extensions into it?



Am 25.05.2011 um 16:38 schrieb Alexander Spohr:

 Ulf, das ist ein Array, warum tust Du also nicht einfach alle Extensions da 
 rein?
 Oder habe ich Deine Frage nicht verstanden?
 
 Gruß,
   atze
 
 
 Am 24.05.2011 um 22:38 schrieb Ulf Dunkel:
 
 Hi Kyle.
 
 On 24.05.2011 17:10, Kyle Sluder wrote:
 On Tue, May 24, 2011 at 7:05 AM, Ulf Dunkeldun...@calamus.net  wrote:
 Can someone please show me how to?
 
 Here is the relevant part of the Info.plist with the current settings for 
 just one file extension (.csv):
 
 keyCFBundleDocumentTypes/key
  array
  dict
  keyCFBundleTypeExtensions/key
  array
  stringCSV/string
  /array
  keyCFBundleTypeIconFile/key
  string/string
  keyCFBundleTypeName/key
  stringCSVDoc/string
  keyCFBundleTypeOSTypes/key
  array
  string/string
  /array
  keyCFBundleTypeRole/key
  stringEditor/string
  keyNSDocumentClass/key
  stringCSVDocument/string
  /dict
  /array
 
 I would like to have three file types set available automatically: .csv, 
 .txt, .dat.
 
 Any help is really appreciated.
 
 ---UlfDunkel

___

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

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

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

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


Re: iOS nib weirdness...

2011-05-04 Thread Alexander Spohr
Is your viewController a subclass of UITableViewController?
Then your nib is not loaded.

UITableViewController is broken. It does not keep the contract of 
initWithNibName:bundle:

atze


Am 04.05.2011 um 16:00 schrieb Steve Christensen:

 I'm working on an app that uses a tab bar. I created a new nib to set up a 
 view+controller and added a new tab item to the main nib that references the 
 controller and the controller's nib, plus I filled in some basic 
 functionality in the view controller. Since it's relevant, the controller's 
 IBOutlets are
 
 IBOutlet MyTableView* _resultsTable;
 IBOutlet UIActivityIndicatorView* _searchActivityIndicator;
 IBOutlet UISearchBar* _searchBar;
 
 When I ran the app and used the new view's UI, I got an unexpected 
 unrecognized selector exception when trying to access a custom method in 
 _resultsTable. When I looked at their values in the debugger, I found that 
 _resultsTable was an instance of UITableView, not MyTableView; and 
 _searchActivityIndicator and _searchBar were both nil.
 
 I thought that there could be a missing class issue, but the MyTableView 
 class is implemented since creating a test MyTableView instance in code works 
 just fine. That still doesn't explain the other nil values since all three 
 views were wired up in IB: the view controller shows the views connected to 
 the outlets and the views show themselves as connected.
 
 Grasping at straws, I trashed the build results and did a clean build, and 
 even re-launched Xcode, with no difference in behavior. I could very well be 
 doing something dumb but I'm not exactly sure where to look since I've 
 (correctly) set up this same sort of thing before and it worked fine. BTW, 
 I'm using Xcode 3.2.6 + iOS SDK 4.3. Any ideas?
 
 steve
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de
 
 This email sent to a...@freeport.de

___

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

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

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

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


Re: Show UIActivityIndicatorView asynchronously

2011-04-28 Thread Alexander Spohr

Am 28.04.2011 um 12:26 schrieb Philip Vallone:

 Hi,
 
 I have a UIViewController that can take a few seconds to load. The view 
 searches an XML file and eventually displays the resuts.  I want to show a 
 UIActivityIndicatorView while the view loads. Unfortunately they are on the 
 same thread. How can I get the UIActivityIndicatorView to display befiore the 
 view loads?

You can not. The display will wait for the end of the runloop.

 With the below code, the UI freezes up (indicator never shows) until the 
 search is done.

Your UI would still freeze, even if you could get the indicator on screen.

 [self.activityIndicator startAnimating];   
 
 TitleSearchResultsViewController *controller = 
 [[TitleSearchResultsViewController alloc] 
 initWithNibName:@TitleSearchResultsViewController bundle:nil];
 [controller setTitle:@Search Results];

Your controller needs to to its work in another thread and signal the main 
thread if it is done.

atze


___

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

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

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

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


Re: Accessing NSWIndowController attribute from a subview in IB

2011-04-28 Thread Alexander Spohr

Am 28.04.2011 um 13:28 schrieb Ben Golding:

 I have a document-based app which loads a couple of NSWindowController 
 subclasses.  That's fine.  In one of the subclasses, I load a nib with a 
 NSView subclass.  It wants to access one of the instance vars in the window 
 controller subclass.  I thought no worries, I should be able to hook up a 
 connection in IB and it will be right.

You can not connect to an ivar/attribute of an object. You can just connect to 
an object.

 In my NSWindowController subclass (called Face), I have a method:
 
 - (id)initWithSundial:(Sundial *)sundial
 {
if ((self = [super initWithWindowNibName:@Face]) == nil)
return nil;
 
[self setSundial:sundial];
 
return self;
 }
 
 In the window that's loaded from Face.xib, there's a custom view 
 (SundialView) which needs to access the sundial instance variable in File's 
 Owner.  I just don't seem to be able to control-drag in some order to hook 
 them up and I think I should be able to.
 
 Am I doing this the wrong way or do I have some sort of misunderstanding 
 about how this works?

Either or both.

The view itself should not know anything about its controller or the 
controllers ivars. Wrong direction.
You should make your WindowController set SundialView's sundial when it has 
been loaded. Problem solved.

atze___

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

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

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

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


Re: How to simulate key press events

2011-04-20 Thread Alexander Spohr

Am 20.04.2011 um 08:59 schrieb Abhijeet Singh:

 I tried to simulate Esc key press

This should make you feel that you do something wrong.

 What i am trying to do now is when user try to click on some other row while 
 the current row is in edit mode I want to ask him that the current record is 
 not saved yet . do you want to save it?. If he says yes then i want to save 
 it. For that I need to simulate the Esc key press so that my routine on Esc 
 key press gets called.

Why? Just have a new save method. Call that from your Escape and when he says 
yes.

atze

___

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

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

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

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


Re: The dreaded UITableView won't refresh problem.

2010-10-13 Thread Alexander Spohr
Am 12.10.2010 um 23:55 schrieb G S:

 - (UITableViewCell*) tableView:(UITableView*)tableView
 cellForRowAtIndexPath:(NSIndexPath*)indexPath
 {
UITableViewCell* cell = [tableView
 dequeueReusableCellWithIdentifier:@MyIdentifier];
 
if (cell == nil)
   {
cell = [[UITableViewCell alloc]
 initWithStyle:UITableViewCellStyleSubtitle
 reuseIdentifier:@MyIdentifier];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
 
   if(indexPath.row  stashes.size())

This if is not needed.

   {
   Stash* pCurrStash = stashes.at(indexPath.row);

Is pCurrStash ever non-nil? Otherwise you get a list that looks empty.

   if(pCurrStash)
   {
   cell.textLabel.text = [NSString
 stringWithUTF8String:pCurrStash-getName().c_str()];
 
   //UIImage* theImage = [UIImage 
 imageWithContentsOfFile:path];
   //cell.imageView.image = theImage;
   }
   }
 
return cell;
 }
 
 I'm not supposed to call reloadData in that function, am I?

No. You would get an infinite loop.

atze


___

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

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

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

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


Re: The dreaded UITableView won't refresh problem.

2010-10-12 Thread Alexander Spohr

Am 12.10.2010 um 21:58 schrieb G S:

 Wow, nobody has seen this problem?  Lovely.

I only did when I did something wrong myself...

Show more code.

atze


___

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

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

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

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


Re: -[NSCFArray initWithObjects:count:]: nil object. Why no crash?

2010-09-27 Thread Alexander Spohr
init methods are instance methods.
You are trying to call a class method. there are no init methods in classes.

atze

Am 27.09.2010 um 02:51 schrieb Jerry Krinock:

 Yes, but to make a long story short, I was stymied by the rocket science of 
 class clusters and abstract classes.  The error says that 
 +initWithObjects:count: was sent to NSCFArray.  So first I reverse-engineered 
 from savannah.gnu.org what are the argument types.  They are id* (a C array 
 of ids), and an unsigned int.  Then I constructed an invocation using the 
 NSClassFromString(), @selector(), etc.  But upon invoking, the system told me 
 that +initWithObjects:count: is not implemented the *abstract* class 
 NSCFArray.  I don't know what the concrete subclass is :(
 
 Another thing I tried was to replace the method +[NSCFArray 
 initWithObjects:count:] using Method Replacement.  But it was never invoked, 
 probably for the same reason, although interestingly -[NSCFArray 
 objectAtIndex:] is invoked with great frequency.

___

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

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

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

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


Re: Animated mask for UIViews?

2010-09-21 Thread Alexander Spohr
What kind of masks?
Bitmaps? Then use UIImageView and transparency.
Vectors? UIBezierPath and CGBlendMode might help.

atze


Am 21.09.2010 um 17:22 schrieb Eric E. Dolecki:

 I have a SWF that was created where masks are being animated. Now I was
 asked to do the same thing for an iPhone application. Can one easily apply a
 mask to a UIView and animate it's dimensions? I have about 6 UIViews that
 stack on top of each other (staggered), and hopefully masks might be used to
 expose them in animated mask ways. Is this easily doable?
___

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

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

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

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


GKSession and WLAN

2010-07-05 Thread Alexander Spohr
Hi list,

Is GKSession capable of connecting local devices without bluetooth - just using 
WLAN?

The docs say no:
A GKSession object provides the ability to discover and connect to nearby 
iPhones using Bluetooth.
No word on WLAN.

I have two devices (iPod  iPhone) running iOS4 in my WLAN. I switched 
bluetooth OFF on both devices. If I run GKSession each device can see the other.
Why is that?

a) because I run them with a debug-build. Will not work in production
b) because GKSession does use WLAN, the docs are just wrong
c) it is a new iOS 4 feature, the docs just need an update

If GKSession is always capable of connecting either using bluetooth or WLAN 
that would be very nice, as I would be able to dump my WLAN-code. (I am talking 
only about local devices)

Can anyone please confirm or deny that?

atze

___

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

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

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

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


Re: Flushing NSOutputStream gotten from NSNetService

2010-07-04 Thread Alexander Spohr
Am 02.07.2010 um 19:43 schrieb Jens Alfke:
 On Jul 2, 2010, at 5:36 AM, Alexander Spohr wrote:
 
 I have some streams gotten from NSNetServices getInputStream:outputStream:. 
 I send very small chunks (from 1 to 1000 bytes) of data through them. I 
 would like to flush the stream after I wrote a chunk to get the data 
 immediately sent to the other side.
 Is that possible or does the NSOutputStream flush after every 
 write:maxLength: anyway?
 
 TCP has some finely-tuned algorithms to decide when to send the buffer. 
 Usually it’s best not to second-guess these, but there are some cases where 
 you do need to. Terminal protocols like telnet and ssh use setsockopt to set 
 a special immediate mode (I can’t remember the name of the option but it’s in 
 the man page.).

TCP_NODELAY is not in the man page. But your pointer made me remember the thing 
I needed:

int yes = 1;
setsockopt(CFSocketGetNative(aSocket), IPPROTO_TCP, TCP_NODELAY, (void *)yes, 
sizeof(yes));

Thanks a lot,

atze


___

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

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

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

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


Flushing NSOutputStream gotten from NSNetService

2010-07-02 Thread Alexander Spohr
Hi List,

i it possible to flush an NSOutputStream?

I have some streams gotten from NSNetServices getInputStream:outputStream:. I 
send very small chunks (from 1 to 1000 bytes) of data through them. I would 
like to flush the stream after I wrote a chunk to get the data immediately sent 
to the other side.

Is that possible or does the NSOutputStream flush after every write:maxLength: 
anyway?

Have a nice weekend,

atze

___

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

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

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

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


Re: Problems with UIButton still calling renamed method

2010-06-29 Thread Alexander Spohr
Then check the code. Does it call setTitle: on the outlet?
As a last resort open the xib in TextEdit and check for signIn:

atze


Am 29.06.2010 um 07:51 schrieb Laurent Daudelin:

 Already checked that. I did delete the entire build folder the last time 
 before building again. I tried to post a follow-up with screen shots but my 
 message is on hold because it's 55KB and is above the 25KB limit.
 
 The new button I put in my view didn't have any title. When I built and ran 
 my app, the button automagically had Sign in as its title!
 
 I'm pulling my hair now on that stupid problem.
 
 -Laurent.
 -- 
 Laurent Daudelin
 AIM/iChat/Skype:LaurentDaudelin   
 http://www.nemesys-soft.com/
 Logiciels Nemesys Software
 laur...@nemesys-soft.com
 
 On Jun 29, 2010, at 01:41, Alexander Spohr wrote:
 
 - Change the layout. Does it reflect in the simulator?
 - Check the .app for any old nibs.
 
  atze
 
 
 Am 29.06.2010 um 07:15 schrieb Laurent Daudelin:
 
 I'm not sure what's going on but I must be missing something big. I 
 initially had a round rect button sending a 'signIn:' message to my view 
 delegate. I decided to rename the 'signIn:' method to 'retailerSignIn:'. 
 Changed the action in IB and ran the program. Got an exception that 
 'signIn:' was sent to an object that doesn't respond to that method. 
 Double-checked everything and all seem fine. Tried again with same result. 
 Did a complete clean up then recompiled. Ran in the simulator and again the 
 same 'signIn:' message is sent to my controller!
 
 I removed the button and put a new one. Wired it to send 'retailerSignIn:'. 
 Ran in the simulator again and the button still sends a 'signIn:' message 
 to my controller!
 
 What am I missing?
 
 -Laurent.
 -- 
 Laurent Daudelin
 AIM/iChat/Skype:LaurentDaudelin 
 http://www.nemesys-soft.com/
 Logiciels Nemesys Software  
 laur...@nemesys-soft.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:
 http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de
 
 This email sent to a...@freeport.de
 
 

___

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

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

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

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


Re: Problems with UIButton still calling renamed method

2010-06-29 Thread Alexander Spohr
 - Change the layout. Does it reflect in the simulator?

 The new button I put in my view didn't have any title. When I built and ran 
 my app, the button automagically had Sign in as its title!

Did you actually move the button to some different location? Try that and 
report if it is at the new position in the simulator.
If not, you still have some old nib or even an old app around somewhere.

atze



Am 29.06.2010 um 07:51 schrieb Laurent Daudelin:

 Already checked that. I did delete the entire build folder the last time 
 before building again. I tried to post a follow-up with screen shots but my 
 message is on hold because it's 55KB and is above the 25KB limit.
 
 The new button I put in my view didn't have any title. When I built and ran 
 my app, the button automagically had Sign in as its title!
 
 I'm pulling my hair now on that stupid problem.
 
 -Laurent.
 -- 
 Laurent Daudelin
 AIM/iChat/Skype:LaurentDaudelin   
 http://www.nemesys-soft.com/
 Logiciels Nemesys Software
 laur...@nemesys-soft.com
 
 On Jun 29, 2010, at 01:41, Alexander Spohr wrote:
 
 - Change the layout. Does it reflect in the simulator?
 - Check the .app for any old nibs.
 
  atze
 
 
 Am 29.06.2010 um 07:15 schrieb Laurent Daudelin:
 
 I'm not sure what's going on but I must be missing something big. I 
 initially had a round rect button sending a 'signIn:' message to my view 
 delegate. I decided to rename the 'signIn:' method to 'retailerSignIn:'. 
 Changed the action in IB and ran the program. Got an exception that 
 'signIn:' was sent to an object that doesn't respond to that method. 
 Double-checked everything and all seem fine. Tried again with same result. 
 Did a complete clean up then recompiled. Ran in the simulator and again the 
 same 'signIn:' message is sent to my controller!
 
 I removed the button and put a new one. Wired it to send 'retailerSignIn:'. 
 Ran in the simulator again and the button still sends a 'signIn:' message 
 to my controller!
 
 What am I missing?
 
 -Laurent.
 -- 
 Laurent Daudelin
 AIM/iChat/Skype:LaurentDaudelin 
 http://www.nemesys-soft.com/
 Logiciels Nemesys Software  
 laur...@nemesys-soft.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:
 http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de
 
 This email sent to a...@freeport.de
 
 

___

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

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

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

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


Re: Problems with UIButton still calling renamed method

2010-06-29 Thread Alexander Spohr
Usually this happens when you localize an unlocalized version. Then you have 
the nib inside English.lproj and in the apps directory you still have the nib 
as a global resource because Xcode does not delete the now localized resources.

You said you deleted the build-directory - obviously you did not ;)

Delete your build-directory after you localized. Then build again. Will work.

atze



Am 29.06.2010 um 09:25 schrieb Laurent Daudelin:

 On Jun 29, 2010, at 02:32, Alexander Spohr wrote:
 
 - Change the layout. Does it reflect in the simulator?
 
 The new button I put in my view didn't have any title. When I built and ran 
 my app, the button automagically had Sign in as its title!
 
 Did you actually move the button to some different location? Try that and 
 report if it is at the new position in the simulator.
 If not, you still have some old nib or even an old app around somewhere.
 
 OK, it seems to be related with the localization. If I remove the 
 localization for my nib, then I see my changes. If I make the file localized 
 again, then all the future changes I do in Interface Builder don't appear in 
 the build. Of course, I close the document in IB each time I remove the 
 localization or add one. This is really strange as I can't find any other 
 copy of that xib file anywhere in my project. I just reproduced it. I did 
 quit IB, made the files localizable again, then opened one in IB, made a 
 visual change, saved, came back in Xcode, did a clean, build and run in the 
 simulator in debug mode and my change is not visible.
 
 Can anybody explain that?
 
 -Laurent.
 -- 
 Laurent Daudelin
 AIM/iChat/Skype:LaurentDaudelin   
 http://www.nemesys-soft.com/
 Logiciels Nemesys Software
 laur...@nemesys-soft.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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Tracking multiple NSURLConnections

2010-06-29 Thread Alexander Spohr
Not sure if I understood the problem. But why not just use the NSURLConnection 
objects themselves?
The delegate methods give you the corresponding NSURLConnection.

atze


Am 29.06.2010 um 18:00 schrieb lorenzo7...@gmail.com:

 I have and app that needs to send out multiple connection attempts. 
 NSURLConnection doesn't appear to allow one to distinguish between 
 connections. I found a couple of posts at cocoabuilder that provide some 
 guidance, but I wanted to ask about my approach. I'm writing for 10.6, so I'm 
 using a category on NSURLConnection combined with associative references. The 
 methods in the category are below, but basically I associate an integer with 
 a given connection and track the connections using that. So, short of 
 subclassing or following what I've found in the archives, does this make 
 sense? Am I missing any details that might cause this to fail?
 Thanks
 
 
 -(void)setTagValue:(NSNumber*)val{
 
 objc_setAssociatedObject(self, @selector(tagValue), val, 
 OBJC_ASSOCIATION_RETAIN);
 }
 
 -(NSNumber *) tagValue {
 
 return objc_getAssociatedObject(self, @selector(tagValue));
 }
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de
 
 This email sent to a...@freeport.de

___

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

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

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

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


Re: Problems with UIButton still calling renamed method

2010-06-28 Thread Alexander Spohr
- Change the layout. Does it reflect in the simulator?
- Check the .app for any old nibs.

atze


Am 29.06.2010 um 07:15 schrieb Laurent Daudelin:

 I'm not sure what's going on but I must be missing something big. I initially 
 had a round rect button sending a 'signIn:' message to my view delegate. I 
 decided to rename the 'signIn:' method to 'retailerSignIn:'. Changed the 
 action in IB and ran the program. Got an exception that 'signIn:' was sent to 
 an object that doesn't respond to that method. Double-checked everything and 
 all seem fine. Tried again with same result. Did a complete clean up then 
 recompiled. Ran in the simulator and again the same 'signIn:' message is sent 
 to my controller!
 
 I removed the button and put a new one. Wired it to send 'retailerSignIn:'. 
 Ran in the simulator again and the button still sends a 'signIn:' message to 
 my controller!
 
 What am I missing?
 
 -Laurent.
 -- 
 Laurent Daudelin
 AIM/iChat/Skype:LaurentDaudelin   
 http://www.nemesys-soft.com/
 Logiciels Nemesys Software
 laur...@nemesys-soft.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:
 http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de
 
 This email sent to a...@freeport.de

___

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

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

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

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


Re: NSLog and va_list

2010-06-17 Thread Alexander Spohr
What exactly so you want?

Either you have an va_list and want to give it to NSLog? Then use
void NSLogv(NSString *format, va_list args);

But I think you want to know what the va_list contains.
Then you just loop over it.
man stdarg will help.

Example:
   void foo(char *fmt, ...)
   {
   va_list ap;
   int d;
   char c, *p, *s;

   va_start(ap, fmt);
   while (*fmt)
   switch(*fmt++) {
   case 's':   /* string */
   s = va_arg(ap, char *);
   printf(string %s\n, s);
   break;
   case 'd':   /* int */
   d = va_arg(ap, int);
   printf(int %d\n, d);
   break;
   case 'c':   /* char */
   c = va_arg(ap, char);
   printf(char %c\n, c);
   break;
   }
   va_end(ap);
   }


Have a nice day,

atze



Am 17.06.2010 um 14:21 schrieb Matt James:

 Hi everyone,
 
 Can anyone tell me how to NSLog() a va_list variable so I can see what's in 
 it?
 
 Thanks for the help!
 
 -Matt___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de
 
 This email sent to a...@freeport.de

___

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

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

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

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


Re: [iPhone] NSManagedObjectContext save doesn't crash but breaks on objc_exception_throw

2010-06-08 Thread Alexander Spohr
Is there anything in the log?
What does save's error parameter return?

atze


Am 08.06.2010 um 17:53 schrieb Hank Heijink (Mailinglists):

 Dear all,
 
 I've run into the following problem, and I'm a bit stuck - I wonder if you 
 can shed some light on this. I have an iPhone app that uses Core Data, and 
 the problem occurs when the app terminates. I have an NSOperationQueue with 
 potentially several NSOperations that are cancelled in the 
 applicationWillTerminate: UIApplication delegate method.
 
 These NSOperations all have their own copy of an NSManagedObjectContext and 
 an NSManagedObject subclass (I pass them the persistent store coordinator and 
 an NSManagedObjectID that is permanent at that point).
 
 Canceling the NSOperation changes an attribute of the NSManagedObject 
 subclass and I save the NSManagedObjectContext on the background thread after 
 this change is made. This means that the NSManagedObjectContext on the main 
 thread is now in conflict, and since all this happens in 
 applicationWillTerminate:, it won't receive the 
 NSManagedObjectContextDidSaveNotification so it can deal with it.
 
 My solution to this is to set the merge policy to 
 NSMergeByPropertyStoreTrumpMergePolicy right before saving the main 
 NSManagedObjectContext to give precedence to the already-saved context(s). I 
 haven't been able to find any information about this scenario - the Core Data 
 Programming Guide (in Communicating Changes Between Contexts) seems to 
 suggest my approach (case 3b), although there in-memory changes are preferred 
 over store changes.
 
 I always have a break point set on objc_exception_throw, and it hits this 
 breakpoint in the call to save. This is the stack backtrace:
 
 #0  0x986d94e6 in objc_exception_throw ()
 #1  0x01dee37c in -[NSPersistentStoreCoordinator(_NSInternalMethods) 
 executeRequest:withContext:] ()
 #2  0x01e22afe in -[NSManagedObjectContext save:] ()
 #3  0x36b6 in -[MyAppDelegate applicationWillTerminate:]
 ...snip...
 
 However, if I remove the break point or hit continue, the application quits 
 with an exit code of 0. If I wrap my [NSManagedObjectContext save] call in a 
 @try @catch block, the @catch statements are never executed. So, is there an 
 exception or isn't there? Should I rethink my approach? I'm just not sure 
 what the issue is here.
 
 Any information is greatly appreciated!
 
 Thanks in advance,
 Hank___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de
 
 This email sent to a...@freeport.de

___

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

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

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

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


Re: Cross XIB references?

2010-06-06 Thread Alexander Spohr

Am 05.06.2010 um 23:14 schrieb Jean-François Brouillet:

 Consider the situation where I have a root ImageView in IB.
 I specify the actual image I want it to hold by just filling/
 selecting which of the existing images are already present in the
 project, using the Image input box of the Image View Attributes
 inspector.
 
 Then I can just set the titleView outlet of some navigationItem
 elsewhere in the same nib file, and voilà, my image is displayed
 at runtime exactly where I want I, when I want it.
 
 But now I create a second nib file for a second controller, and
 I really would like to display the same image in the same kind
 of setup.
 
 Problem is: I haven't figured out whether it is possible at all
 for nib file#2 to refer to any object inside nib file#1,

No it is not.

 hence
 I have to either pay the memory cost of a duplicate object in
 the second nib file,

Yes. as Ken told you, views can have only one superview.

 So, I've got the message, thank you, and I'm going to *programatically* share 
 that view either in the app delegate or the root view controller, whichever 
 way is cleanest.

This will break. See above. And because you will try it you make clear that you 
did not understand the answer given by Ken.

 or forget about nib files entirely and do
 the whole wiring by hand with code, which kind of defeats the
 purpose of separate nib files in the first place.

Why should you have to do that? You just need one titleView in every nib. A 
simple imageView takes up some bytes in memory. The image itself is shared 
anyway. You win nothing by trying to reuse that view.

 So ... is there a way to refer to NIB1.objA from NIB2.objB ?

No. And there never will be, as it is impossible (see Ken’s very good 
explanation).
It _is_ a beginners question and it was answered in detail.

 Bonus question: is it possible at all to refer to nib files
 (while staying within IB) outside of the main project directory?
 I tried variations on ./rsrc/mynib2 or rsrc/mynib2 in the NIB Name
 input field to no avail ...

They have to be anywhere in the project. Just use the name, as they will be 
copied to Resources.

 I plainly understand that I can spread my NIB files all over the
 place (almost :-) if I go the coding route, but I'd rather do
 everything I can in IB if that's possible ...

Yes, use nibs. Then just add that one image view and be done with it.

atze

___

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

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

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

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


Re: isKindofClass with NSData and NSKeyUnarchiver

2010-05-27 Thread Alexander Spohr

Am 27.05.2010 um 11:21 schrieb Philip Vallone:

 
 Hello,
 
 I am passing different types of data to NSData (NSString, NSArray, UIImage).  
 I am trying to find out what kind of data t is so I know how to handle the 
 NSData when I receive it.  The below code is an example of how I am trying to 
 do this but its always returning null. What am I doing wrong?
 
   NSString *somedata = [[NSString alloc] initWithString:@Some string];  
   NSData * set = [NSKeyedArchiver archivedDataWithRootObject:[somedata 
 dataUsingEncoding:NSASCIIStringEncoding]];
   NSData * unset = [NSKeyedUnarchiver unarchiveObjectWithData:set];

Unset is not a pointer to NSData, it is an id. Did you read the docs?

   NSLog(@Class Type %@, [unset isKindOfClass:[NSKeyedUnarchiver 
 class]]);

You ask if unset’s class is NSKeyedUnarchiver. That returns a BOOL (and always 
NO) but you tell NSLog to receive a pointer to an object. So you see a (null).

Try asking unset for its class...

atze


___

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

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

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

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


Re: Regarding MVC design pattern

2010-05-20 Thread Alexander Spohr

Am 19.05.2010 um 19:12 schrieb Kyle Sluder:

 On Wed, May 19, 2010 at 4:38 AM, Sherm Pendley sherm.pend...@gmail.com 
 wrote:
 If you synthesize your ivars, you can get at the ivar using the self- syntax.
 
  self-myFoo = [aFoo retain];
  [self-myFoo release];

Why not just using myFoo without the self-?
To make it visible that you talk to an ivar?

atze

___

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

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

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

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


Re: Regarding MVC design pattern

2010-05-18 Thread Alexander Spohr

Am 18.05.2010 um 12:40 schrieb Sai:

 Unfortunately, when I try to get value from that NSDictionary, I will get 
 exc_bad_access signal, and I follow gdb, the NSDictionary instance seems to
 be corrupted.

 So where does it go wrong? Hopefully I state things clearly this time. Thank
 you all.

Do you retain it?
Show the code.

atze

___

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

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

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

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


Re: program termination after releasing self defined NSXMLParser class

2010-04-18 Thread Alexander Spohr

Am 17.04.2010 um 18:44 schrieb Fritz Anderson:

 On 16 Apr 2010, at 11:34 AM, Alexander Spohr wrote:
 
 That means that -parse does not block. It runs in the event loop.
 
 I have not found this to be the case. In the context of the documents, and of 
 the customary terms for XML parsing, event-driven parsing, provided by 
 NSXMLParser, means that the parser yields elements one-by-one as it steps 
 through the source. You'll note from the paragraph after the one you quote 
 that -[NSXMLParser parse] returns YES if parsing is successful and NO in 
 there is an error or if the parsing operation is aborted. This is impossible 
 unless the parsing is done synchronously.

You are right. I confused NSXMLParser with another one I used recently.
Sorry for the noise.

atze

___

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

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

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

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


MKMapView crashes if released to early / in the wrong moment

2010-04-16 Thread Alexander Spohr
Hi list.

MKMapView is crashing on 3.x if you release it too early, when any of its 
animations are still in progress.
(rdar://7408284)

I had crashes in
#1  0x32d209c0 in -[MKDotBounceAnimation animationDidStop:finished:] ()
#1  0x0226f34e in typeinfo name for MKTileRequester ()
#1  0x314b986a in -[MKMapView overlayView:viewForAnnotation:] ()
#1  0x31509214 in -[MKUserLocationViewInternal 
userLocationViewAccuracyDidUpdate] ()

All of these are fired by timers:
#0  0x32668ec0 in objc_msgSend ()
#1  0x32d209c0 in -[MKDotBounceAnimation animationDidStop:finished:] ()
#2  0x33e99064 in run_animation_callbacks ()
#3  0x33e98e6c in CA::timer_callback ()
#4  0x32da44c2 in CFRunLoopRunSpecific ()
#5  0x32da3c1e in CFRunLoopRunInMode ()
#6  0x31bb9374 in GSEventRunModal ()
#7  0x30bf3c30 in -[UIApplication _run] ()
#8  0x30bf2230 in UIApplicationMain ()


#0  0x979abedb in objc_msgSend ()
#1  0x0226f34e in typeinfo name for MKTileRequester ()
#2  0x03b0581b in run_animation_callbacks ()
#3  0x03b055f5 in CA::timer_callback ()
#4  0x0246eac0 in CFRunLoopRunSpecific ()
#5  0x0246dc48 in CFRunLoopRunInMode ()
#6  0x02b34615 in GSEventRunModal ()
#7  0x02b346da in GSEventRun ()
#8  0x00497faf in UIApplicationMain ()

#0  0x33477700 in objc_msgSend ()
#1  0x314b986a in -[MKMapView overlayView:viewForAnnotation:] ()
#2  0x314dd9ae in -[MKOverlayView _addViewForAnnotation:] ()
#3  0x314da43a in -[MKOverlayView _addViewsForAnnotations:animated:] ()
#4  0x314d7410 in -[MKOverlayView showAddedAnnotationsAnimated:] ()
#5  0x314ba336 in -[MKMapView _showAddedAnnotationsAndRouteAnimated:] ()
#6  0x314c225c in -[MKMapView levelView:didLoadTile:] ()
#7  0x314b40e2 in -[MKMapLevelView updateTileAfterReceivingContentForTile:] ()
#8  0x314b3b6a in -[MKMapLevelView tileRequesterReceivedImage:forTile:] ()
#9  0x314b6836 in -[MKMapLevelView tileRequesterProgress:] ()
#10 0x314c886e in MKTileRequester::requestProgress ()
#11 0x313f50c6 in coalesceTimerFired ()
#12 0x3358abb2 in CFRunLoopRunSpecific ()
#13 0x3358a35c in CFRunLoopRunInMode ()
#14 0x3352bb32 in GSEventRunModal ()
#15 0x3352bbde in GSEventRun ()
#16 0x31c1976e in -[UIApplication _run] ()
#17 0x31c18472 in UIApplicationMain ()

#0  0x334776f6 in objc_msgSend ()
#1  0x31509214 in -[MKUserLocationViewInternal 
userLocationViewAccuracyDidUpdate] ()
#2  0x31505772 in -[MKUserLocationPositionAnimation animationDidStop:finished:] 
()
#3  0x30045a2c in run_animation_callbacks ()
#4  0x300458e2 in CA::timer_callback ()
#5  0x3358abb2 in CFRunLoopRunSpecific ()
#6  0x3358a35c in CFRunLoopRunInMode ()
#7  0x3352bb32 in GSEventRunModal ()
#8  0x3352bbde in GSEventRun ()
#9  0x31c1976e in -[UIApplication _run] ()
#10 0x31c18472 in UIApplicationMain ()

MKMapView seems to forget to stop all timers when it receives dealloc.

I use MKMapView in my detail controllers. When the user moves back to the 
parent controller at the wrong moment (while the map view still does some 
animations) and my detail controller gets dealloced (and therefore the map 
view) the app crashes.
Demo project at http://www.0as.de/stuff/MKMapBug7408284.zip
Crashes in simulator on 3 and 5 seconds. Crashes the phone as well.

Now I need a fix for 3.x. I could retain the map view for ever. Or keep it in 
memory for the next 20 seconds.
Maybe someone has a better fix?

atze


___

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

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

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

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


Re: program termination after releasing self defined NSXMLParser class

2010-04-16 Thread Alexander Spohr

Am 16.04.2010 um 00:43 schrieb Dominic Dauer:

 With the purpose to test these simple class I just did the following in the 
 controller class of one view:
 
 -(BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
 
   XMLParser *parser = [[XMLParser alloc] initWithContentsOfURL:[NSURL 
 URLWithString:@http://localhost/test/out.xml;]];
   [parser setDelegate:parser];
   [parser parse]; 
 
   [parser release];   
 
   return NO;
 }
 
 -
 
 Everything works fine until call the release method to the parser. In the 
 simulator the app is terminating without any message in the log.
 I guess I do a fundamental mistake.
 
 Any ideas?

Yes. The docs state:
-parse
Starts the event-driven parsing operation.

That means that -parse does not block. It runs in the event loop.
So the parser starts running and wants to talk to its delegate. But too bad - 
you released it right after it started to work.

You have to retain it as long as the parsing takes. That is what the delegate 
is for.

atze

___

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

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

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

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


Subclassing and Relationships - different xcdatamodels

2010-03-22 Thread Alexander Spohr
Hi list,

I used to create a base model in EOF and group some additional models around it 
having relationships into the base model. The base model was reusable, the 
others where project specific.

Now I would like to use such a setup with CoreData.
Is it possible to
1) create entity BSubclass in model B by subclassing entity ASuperclass in 
model A?
2) create a relationship from entity BSub to entity AOther?
3) create a relationship from entity AOther to entity BSub in code?

I could not find anything working for this in XCode. Did I look in the wrong 
place or is it just not possible?

atze


___

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

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

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

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


Re: Little HELP with a fetch Request in Core Data

2010-03-16 Thread Alexander Spohr
Try
toInvoices.toStatus.statusID = 1001
in your NSPredicate.

atze



Am 16.03.2010 um 14:02 schrieb Gustavo Pizano:

 Hello.
 
 Well this may be the simplest question ever, but somehow I can't find the 
 answer.
 
 I have an entity User, which has a relationShip to-many Invoices, and 
 Invoices have a relation to-Status, So I have a ManagedObject Im getting for 
 the selection of the NSArrayController, and I want to check all its invoices 
 that statusID (property in status entity) is 1001, for instance. 
 
 I have been looking but as far as I understand I make NSFetchRequest and then 
 assign an NSEntityDescritptor, and then the NSPredicate with the properties, 
 but this applies tho the whole enities User, for example. 
 
 I dunno what Im getting wrong, but I can't get this to work,
 
 I could do the simple get the NSSet that returns form the toInvoices, then 
 start counting on the toStatus relation, but that doesn't seem nice to do, 
 seems kinda odd.
 
 Thanks for the help
 
 Gustavo
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de
 
 This email sent to a...@freeport.de

___

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

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

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

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


Re: Private ivars, not marked as IBOutlet, visible in IB

2010-03-15 Thread Alexander Spohr

Am 15.03.2010 um 23:22 schrieb Jeff Laing:

 As I recall, sending variables of type idYourProtocol useful messages like 
 retain and release generate a compiler warning, whereas 
 NSObjectYourProtocol are fine.
 
 I could be wrong on this, but I definitely recall thinking it was a stupid 
 compiler behavior.

You can let your protocol include the NSObjects protocol and get rid of the 
warnings.

@protocol YourProtocol NSObject

atze

___

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

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

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

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


Re: #include CommonStrings.txt - 'no such file' error

2010-03-14 Thread Alexander Spohr
.txt looks wrong.
Why not create .h and .m and import the .h?
Usually you #import, not #include in ObjC.

.h
extern NSString *gLeftBracket;

.m
NSString *gLeftBracket  =@;

atze


Am 14.03.2010 um 06:47 schrieb Steve Cronin:

 Folks;
 
 I have a dozen or so strings that I use over and over in various classes.
 So here's what I've done
 
 I have a CommonStrings.txt file added to the project.   It looks like this:
 NSString *gLeftBracket=@;
 NSString *gRightBracket   =@;
 
 If I #include this file somewhere in the project then I can use 'extern' in 
 the classes/methods where I need one of these strings.
 benefits:
   one place for definition
   type-ahead works - more efficient code construction
 costs:
   global-ness violates object-oriented principles
   committed global overhead for entire project that doesn't benefit every 
 class   
   however there are only ~20 of these
   there is no inherent 'read-only' support (which is what I would prefer)
 
 On the whole I'm inclined to accept the costs for the benefits!
 
 Is there a better way to achieve the goal in ObjC2?
 
 But here's my real question:
 It appears that I cannot put the one and only #include CommonStrings.txt just 
 anywhere in the project.
 Some locations work fine others result in a 'CommonStrings.tx.' - no such 
 file error.
 I'm just cutting and pasting the #include statement - so I'm not munging the 
 statement.
 I cannot see any rhyme or reason on where it works and where it doesn't…
 Can someone clarify this for me?
 Kochan ObjC2 p209 clearly states, …variable must be defined someplace among 
 your source files…
 
 Thanks for your time,
 Steve___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de
 
 This email sent to a...@freeport.de

___

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

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

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

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


Re: Which iPhone Program?

2010-03-13 Thread Alexander Spohr
This is not really a Cocoa question...

- If you want your application in the store you need Company.
- If you want to distribute in a big company (1000 employees) without using the 
store you want the enterprise.

The account is for the whole company. But the one who pays owns the account.
So you own the account and are able to add more phones/pods and people.

Be aware that you can not change the owner easily.

atze

PS. I’d think all this info is on Apple’s site somewhere...



Am 12.03.2010 um 12:02 schrieb Don Quixote de la Mancha:

 Greetings, Earthlings, I just subscribed.
 
 I'm just about to sign up for the paid iPhone developer program, but
 I'm not able to tell from Apple's website which program I should join.
 
 Presently I am the only developer, but we have two QA testers who will
 need to build my code on their own Macs, as well as install onto their
 devices themselves rather than have me do it for them.  The reason is
 that the three of us are far apart geographically; I also want to
 ensure that someone else other than just myself can build my source.
 
 Both the iPhone Developer Program - Company and iPhone Developer
 Enterprise Program include the Ability to Create Developer Team.
 But nowhere can I find any information as to just what that means.
 
 I expect the we need licenses for three developer seats.  I'll join
 the Enterprise Program if I really have to, but due to my limited
 budget, I'd rather join the Company Program if that would suffice.
 
 I'd like to suggest to my friends at Apple that they add some more
 details to the web pages that describe the iPhone developer programs,
 so that everything which is included with each type of program is made
 completely explicit.
 
 Thank you for any insight you can give me,
 
 Don Quixote
 -- 
 Don Quixote de la Mancha
 quix...@dulcineatech.com
 http://www.dulcineatech.com
 
   Dulcinea Technologies Corporation: Software of Elegance and Beauty.
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de
 
 This email sent to a...@freeport.de

___

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

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

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

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


Re: Private ivars, not marked as IBOutlet, visible in IB

2010-03-13 Thread Alexander Spohr

Am 13.03.2010 um 10:32 schrieb Joanna Carter:

 All that is needed is to detect whether the ivar is @private and to respect 
 that visibility. If an ivar is private, it should not be visible in the IB 
 designer, regardless of whether it is of type id or not.

I’d say no to this.

If my class is files owner the whole nib is owned by it - hence the name. 
Therefore I absolutely want IB to be able to set even the private ivars. The 
nib is just another way of setting up my class’ objects.

atze

___

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

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

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

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


Re: Private ivars, not marked as IBOutlet, visible in IB

2010-03-13 Thread Alexander Spohr

Am 13.03.2010 um 16:25 schrieb Joanna Carter:

 My reason for using id is because I want to hold a delegate and call methods 
 on it without compiler warnings. Or have I got the wrong idea there?

Yes your idea is wrong.
You are free to specify NSObject YourProtocol *delegate;

atze

___

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

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

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

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


Re: Which iPhone Program?

2010-03-13 Thread Alexander Spohr

Am 13.03.2010 um 17:03 schrieb Thomas Davie:

 On 13 Mar 2010, at 11:59, Alexander Spohr wrote:
 
 This is not really a Cocoa question...
 
 - If you want your application in the store you need Company.
 
 This is not true, I currently have two applications in the store, and do not 
 have a company account.

The question here was if he needs company or enterprise.
Private was out of the question.

atze

___

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

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

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

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


Re: NSTimer never being deallocated

2010-03-13 Thread Alexander Spohr

Am 13.03.2010 um 17:41 schrieb Tobias Jordan:

 I want to know what's going on inside my app and I've got enough experience 
 in coding to know that just trusting the Apple docs (especially when it's 
 about memory management) is not reliable.

Please explain this.

If you stick to the memory rules you’re fine.

atze


___

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

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

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

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


Re: Private ivars, not marked as IBOutlet, visible in IB

2010-03-13 Thread Alexander Spohr
You are right, id YourProtocol is the standard.
But the question was how to get a delegate that is not visible in IB and does 
not produce compiler warnings.

atze


Am 13.03.2010 um 18:55 schrieb Kevin Cathey:

 Not necessarily true. While you are free to specify a delegate as NSObject 
 YourProtocol, it is not standard convention. The convention for delegates 
 is:  idYourProtocol.
 
 Kevin
 
 On 13 Mar 2010, at 07:39, Alexander Spohr wrote:
 
 
 Am 13.03.2010 um 16:25 schrieb Joanna Carter:
 
 My reason for using id is because I want to hold a delegate and call 
 methods on it without compiler warnings. Or have I got the wrong idea there?
 
 Yes your idea is wrong.
 You are free to specify NSObject YourProtocol *delegate;
 
  atze
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/cathey%40apple.com
 
 This email sent to cat...@apple.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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Private ivars, not marked as IBOutlet, visible in IB

2010-03-13 Thread Alexander Spohr

Am 13.03.2010 um 18:54 schrieb Joanna Carter:

 Actually this is how nibs were designed and intended to be used: to be
 fragments of the object graph loaded at runtime. It is a *very* recent
 trend to have them exist so independently of File's Owner, and to use
 the public API to hook up their connections.
 
 So I gather. Which was one of the main reasons I avoided Mac development 
 because, until recently (Objective-C 2.0 ?), I was not at all comfortable 
 with that way of working when compared with a much stricter interpretation of 
 the MVC design pattern.

To quote yourself:
If I may say so, to say this is to misunderstand MVC design. 

MVC has nothing to do with private ivars.
Cocoa is one of the cleanest MVC implementations - since 1989.

atze

___

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

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

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

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


Re: Use of KVC Array operators

2010-03-12 Thread Alexander Spohr

Am 12.03.2010 um 04:34 schrieb Eli Bach:

 The operators mentioned on this page, particularly @unionOfSets.
 
 http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/KeyValueCoding/Concepts/ArrayOperators.html
 
 I have the following Core Data object's setup
 
 ClassAClassB  ClassC
 relationA  --relationB -- relation C
 
 where each of the relations is a many to one [one class A, many class B, and 
 one class B, many class C].
 Not all ClassB's will have ClassC objects attached to them
 
 I have an instance of classA, and I want an NSArrayController with all the 
 ClassC objects for all the ClassB objects that are related to that specific 
 instance of ClassA, preferably in a way that uses KVO instead of 
 programmatically updating with fetches/predicates/etc.
 
 What would be the right way to bind the NSArrayController, assuming the nib 
 owner has an instance of classA:

How about Owner.instanceOfA.relationB.relationC ?
If you ask an array for a key path you get a new array containing the resulting 
objects.
You don’t need any operators.

atze

 
 ie:
 
 bind content set to
 
 File Owner.instanceOfA.?
 
 Thanks,
 
 Eli

___

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

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

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

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


Re: incorrect bitmap date from NSBitmapImageRep from NSDate

2010-03-12 Thread Alexander Spohr
Exactly what does not work?
The loading? Or the opengl command?

If the latter I suspect that your file is not in the needed format.
Does your image have alpha?

atze



Am 12.03.2010 um 13:09 schrieb Ariel Feinerman:

 // not work
 
 NSData *data = [NSData dataWithContentsOfFile: filename];
 
 NSBitmapImageRep *image = [[NSBitmapImageRep alloc] initWithData: data];
 
 
 as opposed to:
 
 // works fine
 
 NSImage *source = [[NSImage alloc] initWithContentsOfFile: filename];
 
 NSSize size = [source size];
 
 [source lockFocus];
 
 NSBitmapImageRep *image = [[NSBitmapImageRep alloc] initWithFocusedViewRect:
 NSMakeRect(0.0, 0.0, size.width, size.height)];
 
 [source unlockFocus];
 
 
 // OpenGL commands
 
 
 gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, [image pixelsWide], [image
 pixelsHigh], GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, [image bitmapData]);
 
 why?
 
 
 as opposed 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:
 http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de
 
 This email sent to a...@freeport.de

___

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

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

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

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


Re: Use of KVC Array operators

2010-03-12 Thread Alexander Spohr

Am 12.03.2010 um 17:32 schrieb Eli Bach:

 On Mar 12, 2010, at 5:37 AM, Alexander Spohr wrote:
 
 Am 12.03.2010 um 04:34 schrieb Eli Bach:
 
 The operators mentioned on this page, particularly @unionOfSets.
 
 http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/KeyValueCoding/Concepts/ArrayOperators.html
 
 I have the following Core Data object's setup
 
 ClassA  ClassB  ClassC
 relationA  --  relationB -- relation C
 
 where each of the relations is a many to one [one class A, many class B, 
 and one class B, many class C].
 Not all ClassB's will have ClassC objects attached to them
 
 I have an instance of classA, and I want an NSArrayController with all the 
 ClassC objects for all the ClassB objects that are related to that specific 
 instance of ClassA, preferably in a way that uses KVO instead of 
 programmatically updating with fetches/predicates/etc.
 
 What would be the right way to bind the NSArrayController, assuming the nib 
 owner has an instance of classA:
 
 How about Owner.instanceOfA.relationB.relationC ?
 If you ask an array for a key path you get a new array containing the 
 resulting objects.
 You don’t need any operators.
 
 I'll try this, but I don't expect it to work, because there can be 0 or more 
 relationB object's, and each of those object's can have 0 or more relationC 
 objects, and just 'plain' dot syntax won't produce a superset of relationC 
 objects

If you have 0 Bs, you’ll have an empty array
If you have Bs without Cs they just wont fill anything into the array.

*methinks* it might be that you get some NSNull in there for the empty Cs. 

But no, this should not happen because the relationship itself is an NSSet, not 
a pointer that can be nil.

From NSSet’s valueForKey:
Discussion
The returned set might not have the same number of members as the receiver. The 
returned set will not contain any elements corresponding to instances of 
valueForKey: returning nil (note that this is in contrast with NSArray’s 
implementation, which may put NSNull values in the arrays it returns).

valueForKeyPath: is just a recursive or iterative call:
Discussion
The default implementation gets the destination object for each relationship 
using valueForKey: and returns the result of a valueForKey: message to the 
final object.

atze

 (from my understanding of KVO and KVC).

what is your understanding of KVC?



___

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

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

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

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


Re: Use of KVC Array operators

2010-03-12 Thread Alexander Spohr

Am 12.03.2010 um 21:06 schrieb Eli Bach:

 On Mar 12, 2010, at 12:19 PM, Eli Bach wrote:
 
 And I did just try it, and got a binding error:
 
 Cocoa Bindings: Error setting value for bound property instanceOfA of object 
 controllerclass: 0x100675780: [_NSFaultingMutableSet 0x1006eab90 
 addObserver:forKeyPath:options:context:] is not supported. Key path: 
 relationC

This sounds like someone tries to SET the value. Not just to read it.
That might break.

 I figured it would be something like this, which is why I was looking at the 
 @unionOfSets operator in particular (as that's exactly what this is, a union 
 of all sets of relationC objects from a set of relationB objects.
 
 And to follow up, I tried both
 
 instanceo...@unionofsets.relationb.relationc
 
 and
 
 instanceofa.relatio...@unionofsets.relationc
 
 and as an NSArrayControllers array binding [as the documentation says that 
 @unionOfSets returns an array], and both resulted in a binding error at 
 runtime.

Maybe you can not bind that way. I have more experience using KVC than KVO. KVC 
should work that way.

Sorry to have bothered you,

atze


___

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

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

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

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


Re: [[Class alloc] init] preferable over [[Class instance] retain]?

2010-03-09 Thread Alexander Spohr

Am 09.03.2010 um 22:44 schrieb Luke the Hiesterman:

 
 On Mar 9, 2010, at 1:41 PM, Laurent Daudelin wrote:
 
 I've been running in that situation and I'm just wondering if there are any 
 advice for/against one or the other method.
 
 For example, is:
 
 NSMutableArray *anArray = [[NSMutableArray array] retain];
 
 There is no reason to use this when you mean
 
 
 NSMutableArray *anArray = [[NSMutableArray alloc] init];
 
 Both examples yield an NSMutableArray object with a retain count of 1. The 
 first example invokes an autorelease which is canceled out by a retain. The 
 first example could be rewritten as NSMutableArray alloc] init] 
 autorelease] retain]; When you compare that to the second example, it's easy 
 to see why there's no reason to use the first.


I’d use
NSMutableArray *anArray = [NSMutableArray new];
in this case ;)

atze

___

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

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

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

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


Re: UIView as opposed to UIViewController...

2010-03-07 Thread Alexander Spohr

Am 07.03.2010 um 03:57 schrieb Jon:

 I get indications from reading that you shouldn't really subclass UIView in 
 general or to do routine things,  and that any time you implement drawRect in 
 the subclass of a UIView,   you are taking a performance hit compared to 
 doing some drawing in other ways?

No. Where does it say that?

A view draws data (like an image) but should know nothing about any model (that 
is is an image of a person record).
A view controller feeds the data (image of person) to its views.

So, if you have a special drawing ou need to perform subclass a view and 
implement drawRect.

 is this true,  in the case of doing this in the ViewController,  is this 
 below more efficient?  or better?  or what?

Your example just adds a subview, nothing else. It make no sense for your 
question as you don’t draw anything.

 then drawing within an NStimer loop in this added subView inside the 
 viewController?  (the subview bounds are as big as the whole view)

NSTimer? What? Why? Please explain what you want to do.

 etc
 
 I guess i am not sure which way to go..  (do everything in a UIView subclass, 
  or do everything in a UIViewController subclass.)

Usually neither. You share the work between them.
Please read this:
http://developer.apple.com/iPhone/library/documentation/General/Conceptual/DevPedia-CocoaCore/MVC.html

 it doesn't seem like anything you do in the controller,  is easy to get to 
 draw in a UIView subclass,  and maybe equally hard to get stuff to translate 
 over to the controller if you do a lot of work in the UIView...

If your view has to do a lot of work something is wrong.
The view just draws information. It does not work on them.

 i'm just lost as to how an NSTimer and a looping set of code should be worked 
 into these two classes..   should it be in the UIView? or the Controller?  
 seems like it should be in the controller,  but then really all the work has 
 to be in the controller, since you can't even call the drawRect while in the 
 controller, so what would you do in the UIView?
 
 any of that make sense? 

No. Because you did not tell at all what you try to achieve with your timer and 
view.

atze


___

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

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

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

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


Re: Get my custom object from NSDictionary variable

2010-03-05 Thread Alexander Spohr

Am 05.03.2010 um 00:48 schrieb Daniel Káčer:

 [myDictionary setObject:[[ComplexObject alloc] initWithFrom:_tempFrom 
 pairTo:string] forKey:[NSString stringWithFormat:@%d, [myDictionary 
 count]]];

Why don’t you use an NSArray?

atze

___

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

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

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

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


Re: UITableView Won't Update; Crashes with EXC_BAD_ACCESS

2010-02-27 Thread Alexander Spohr

Am 27.02.2010 um 02:16 schrieb Jason Berlinsky:

 When I remove the NSLog(@%@,self.data), the application doesn't crash, but 
 the UITableView doesn't update. When I replace it with fast enumeration over 
 self.data, I get the crash again (crash log: http://pastebin.com/NDVKLsJC).
 
 Any ideas

Yes, you have a memory bug.

atze

___

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

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

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

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


Re: NSData as value in NSManagedObject

2010-02-20 Thread Alexander Spohr

Am 20.02.2010 um 16:29 schrieb Mikkel Eide Eriksen:

   NSData *xmlData = (NSData *)[[[treeController selectedObjects] 
 valueForKey:@xml] lastObject]; //HERE'S THE PROBLEM

Well, yes.

You ask your xml for lastObject. That won’t work.
What you want is this:
[[[treeController selectedObjects] lastObject] valueForKey:@xml] 

Ask the array for its lastObject, then get the xml out of it ;)

atze

___

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

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

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

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


Re: Core Data: Insert, Fetch, Re-Fetch. Same Object?

2010-02-11 Thread Alexander Spohr

Am 11.02.2010 um 04:07 schrieb Jerry Krinock:

 
 On 2010 Feb 10, at 18:05, Jens Alfke wrote:
 
 I've always wondered if I insert a managed object, then later fetch it 
 repeatedly from the same managed object context, do I get the same object 
 every time?
 
 Yes, basically. There is only going to be one in-memory object at a time 
 that represents the same managed object.
 
 It certainly seems to be sensible, but I just wish someone could find such 
 documentation.  I can't.

Every NSManagedObjectContext holds its own but unique copy of your object.


 In the last few minutes here, I improved my demo to test an sqlite store as 
 well as an in-memory store, and also I setStalenessInterval to 0 and threw in 
 some -refreshObject:mergeChanges:NO and more saves.  The only difference I 
 found was that, while the in-memory store fetches the same object that you 
 inserted, the sqlite store does not, although subsequent fetches return the 
 same object.

This is because the object in the sql-store needs a primary key. As long as it 
was not saved it has a temporary key only. When saved it gets a persistent key.
After that it is identifiable by this and therefore you get alwas the same 
object back.

I would have thought that your inserted object gets the persistent key set and 
will therefore be the same object as the fetched ones. But I did not check your 
code for a misconfiguration.

 Can anyone guarantee this?
 I would imagine that, even though it's not documented, Apple must realize 
 that if they were ever to change this behavior, it would probably break alot 
 of apps which have been relying on it without the designers realizing this.  
 Would Apple ever ever do anything like that?

No, you will always get the same object. Because this was why CoreData and EOF 
where made for. Exactly this.

atze

 Jerry
 
 
 REVISED CONSOLE OUTPUT:
 
 Using sqlite store at /Users/jk/Desktop/FooTest.sqlite
   Inserted: Foo 0x30022c0 name=Murphy ivar=BeenInserted
  First Fetched: Foo 0x3006120 name=Murphy ivar=BeenFetched
 Second Fetched: Foo 0x3006120 name=Murphy ivar=BeenFetched
  Delay Fetched: Foo 0x3006120 name=Murphy ivar=BeenFetched saved=1
  Delay Fetched: Foo 0x3006120 name=Murphy ivar=BeenFetched saved=1
 
 Using in-memory store
   Inserted: Foo 0x300c1a0 name=Murphy ivar=BeenFetched
  First Fetched: Foo 0x300c1a0 name=Murphy ivar=BeenFetched
 Second Fetched: Foo 0x300c1a0 name=Murphy ivar=BeenFetched
  Delay Fetched: Foo 0x300c1a0 name=Murphy ivar=BeenFetched saved=1
  Delay Fetched: Foo 0x300c1a0 name=Murphy ivar=BeenFetched saved=1
 
 
 REVISED DEMO PROJECT:
 
 #import Foundation/Foundation.h
 #import CoreData/CoreData.h
 
 @interface Foo : NSManagedObject
 {
NSString* m_ivar ;
 }
 
 @property (copy) NSString* ivar ;
 
 @end
 
 @implementation Foo
 
 @synthesize ivar = m_ivar ;
 
 - (void)dealloc {
[m_ivar release] ;
 
[super dealloc] ;
 }
 
 - (NSString*)description {
return [NSString stringWithFormat:
@Foo %p name=%@ ivar=%@,
self,
[self valueForKey:@name],
[self ivar]] ;
 }
 
 @end
 
 
 // Note: This function returns a retained, not autoreleased, instance.
 NSManagedObjectModel *getStaticManagedObjectModel() {
static NSManagedObjectModel *mom = nil;
 
if (mom != nil) {
return mom;
}
 
mom = [[NSManagedObjectModel alloc] init];
 
NSEntityDescription *fooEntity = [[NSEntityDescription alloc] init];
[fooEntity setName:@Foo];
[fooEntity setManagedObjectClassName:@Foo];
[mom setEntities:[NSArray arrayWithObject:fooEntity]];
 
NSMutableArray* properties = [[NSMutableArray alloc] init] ;
NSAttributeDescription *attributeDescription;
 
// Add an attribute.  (Copy this section to add more attributes.)
attributeDescription = [[NSAttributeDescription alloc] init];
[attributeDescription setName:@name];
[attributeDescription setAttributeType:NSStringAttributeType];
[attributeDescription setOptional:YES];
[properties addObject:attributeDescription] ;
[attributeDescription release] ;
 
[fooEntity setProperties:properties];
[properties release] ;
 
[fooEntity release] ;
 
return mom;
 }
 
 // Note: This function returns a retained, not autoreleased, instance.
 NSManagedObjectContext *getStaticManagedObjectContext() {
 
static NSManagedObjectContext *moc = nil;
 
if (moc != nil) {
return moc;
}
 
moc = [[NSManagedObjectContext alloc] init];
 
NSPersistentStoreCoordinator *coordinator =
[[NSPersistentStoreCoordinator alloc]
 initWithManagedObjectModel:getStaticManagedObjectModel()];
[moc setPersistentStoreCoordinator: coordinator];
[coordinator release] ;
 
NSError *error;
NSPersistentStore *newStore ;
 #if 0
NSLog(@Using in-memory store) ;
newStore = [coordinator addPersistentStoreWithType:NSInMemoryStoreType
 configuration:nil
  

Re: Synthesize NSMutableString retain count question

2010-02-03 Thread Alexander Spohr

 currentSection  = @Some value;
has nothing to do with
 [currentSection setString:@Some value];

The first sets currentSection to a string, the second sets the content of 
currentSection.

a) In the second line you just set the content but you never assigned an 
NSMutableString to currentSection before. Therefore the call is ignored and 
currentSection itself stays nil.

b) The first line should throw a warning as @Some value is not mutable. It is 
an error.

atze


Am 03.02.2010 um 12:55 schrieb Philip Vallone:

 Hi List,
 
 This is probably a very elementary question. I have a NSMutableString that I 
 Synthesize. When I assigned a value to it:
 
 currentSection  = @Some value;
 
 The retain count goes to 1
 
 However if I assign a value with
 
 [currentSection setString:@Some value];
 
 The retain count is still zero.
 
 Can someone explain the difference?
 
 Thanks,
 
 Phil
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de
 
 This email sent to a...@freeport.de

___

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

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

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

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


Re: Multithread communication

2010-02-03 Thread Alexander Spohr

Am 03.02.2010 um 17:30 schrieb McLaughlin, Michael P.:

 Could someone recommend the best (most robust) way to pass back data from
 threads to the main thread?  Is there a good way to probe crashes such as
 these?  Right now, I cannot even tell where the error is really occurring.

Try

- (void)performSelectorOnMainThread:(SEL)aSelector 
withObject:(id)argwaitUntilDone:(BOOL)wait

atze


___

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

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

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

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


Re: Why can't I use any object as a key in a dictionary?

2010-02-01 Thread Alexander Spohr

Am 01.02.2010 um 16:35 schrieb Charles Jenkins:

 On 2010-02-01 03:26, Roland King wrote:
 
 By the way, CALayer is a KVC compliant class so you can in fact just store a 
 reference to an arbitrary object in it with
 
 [ layer setValue:value forKey:@KeyForObjectAssociatedWithLayer ]; 
 
 Roland, I'm a noob and I'm not sure I've got a good handle on KVC yet... This 
 statement really looks interesting to me, because it seems to suggest that 
 with a KVC-compliant class, you can make arbitrary linkages by just making up 
 keys.

This is a wrong assumption.
Most classes are KVC compliant but you can not invent keys. You just use 
existing keys - properties and methods.

  (I checked the documentation, and haven't found any property named 
 objectAssociatedWithLayer, so I'm assuming that you were able to create this 
 key name yourself and name it whatever you liked.) Is this true or have I 
 totally misunderstood you?

Read Core Animation Extensions To Key-Value Coding to get some enlightenment 
;)

Both CALayer and CAAnimation are key-value coding compliant container classes, 
allowing you to set values for arbitrary keys. That is, while the key “foo” is 
not a declared property of the CALayer class, however you can still set a value 
for the key “foo” as follows:

The important thing is, that they are container classes. Like NSDictionary.
This is not true for all classes.

atze

___

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

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

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

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


Re: UIButton's Sender Control Events

2010-01-25 Thread Alexander Spohr
Please send code that would work. All broken examples are clearly not code you 
can use and therefore very bad examples for what you are trying to achieve.

Am 25.01.2010 um 00:22 schrieb Chunk 1978:

 i wanted to simplify the code (one button per method) by using the
 buttons UIControlEvents of touchDown and touchUpInside/touchUpOutside

Please explain that.
touchDown + touchUpInside  = lightOn?
touchDown + touchUpOutside = lightOff?
or what?

 and produce:
 
 - (IBAction)toggleLight
 {
 //toggle light
 }

What is wrong with Graham's example?

 - (IBAction) toggleSomething:(id) sender
 {
[self setState:![self state]];
 }

That's exactly how you implement a toggle action.

 i meant it's clear that it's not possible with UIControlEvents... or
 at least not simply so.

What is the second it's here if Graham's example is wrong?

atze

___

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

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

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

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


Re: UIButton's Sender Control Events

2010-01-24 Thread Alexander Spohr
If each event needs different action why not program different actions?
What is the benefit of having one method containing a big if-else-else 
construct?

atze


Am 24.01.2010 um 19:12 schrieb Chunk 1978:

 linking several control events to one method is what i'm trying to do,
 but i do not know how to decipher which control event is calling the
 method.
___

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

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

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

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


Re: [iphone] Release Navigation View Controller Question

2010-01-18 Thread Alexander Spohr

Am 18.01.2010 um 14:40 schrieb Philip Vallone:

 Hi this is a follow up question on memory management. In my class 
 BrowseViewController, I have a UITableView and 2 NSMutableArrays.
 
 @interface BrowseViewController : UIViewController UIActionSheetDelegate {
   IBOutlet UITableView *tableView;
   NSMutableArray *tableList;
   NSMutableArray *cfrTitleList; 
 }
 @property(nonatomic, retain) UITableView *tableView;
 
 @end
 
 Now the BrowseViewController has a few child Navigational controllers. This 
 allows the user to drill down. My question is, in the BrowseViewController.m 
 dealloc method, if I release the two NSMutableArrays, I receive the error 
 “EXC_BAD_ACCESS”.

Then you forgot to retain them when you should.
Show code where they are assigned if you can’t fix it.

 If I don't release the NSMutableArrays, does this mean the 
 navigationController takes ownership of the NSMutableArrays?

No, it does not even know they exist. How should it?

atze

___

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

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

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

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


Re: newbie question -views and MCV model

2010-01-15 Thread Alexander Spohr

Am 15.01.2010 um 05:57 schrieb Martin Beroiz:

 My problem is with the controller. I subclassed NSViewController (with the 
 name FilterBankViewController) and tried to bind the class with the file's 
 owner. But I noticed that in IB I cannot do that, actually the bind tab says 
 it's Not Applicable. 

You need to set the FilesOwner’s class to FilterBankViewController.
The FilesOwner is a placeholder for the object that becomes the owner of the 
nib-file :)

Then you alloc your FilterBankViewController and have it load the nib with 
itself as the owner.

See
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
of NSViewController.

atze

___

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

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

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

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


Re: NSWeekCalendarUnit and DIN 1355 / ISO 8601

2010-01-15 Thread Alexander Spohr
Filed a bug, Problem ID: 7545433


Am 13.01.2010 um 14:11 schrieb Alexander Spohr:

 Hi list,
 
 I just fell over NSWeekCalendarUnit. It delivers the week of a date.
 Sadly it seems to do so only for the US but not for e.g. Germany and all ISO 
 8601 countries (most of europe) - except UK.
 
 The current week is 3 in the US but 2 in Europe (except UK ;)
 
 For a list see:
 http://en.wikipedia.org/wiki/Seven-day_week#Week_numbering
 
 Currently we use something like this:
 
 [[[NSCalendar currentCalendar]
   components:NSWeekCalendarUnit fromDate:[NSDate date]]
   week];
 
 Is this a bug of NSCalendar or am I doing something wrong?
 
   atze

___

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

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

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

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


NSWeekCalendarUnit and DIN 1355 / ISO 8601

2010-01-13 Thread Alexander Spohr
Hi list,

I just fell over NSWeekCalendarUnit. It delivers the week of a date.
Sadly it seems to do so only for the US but not for e.g. Germany and all ISO 
8601 countries (most of europe) - except UK.

The current week is 3 in the US but 2 in Europe (except UK ;)

For a list see:
http://en.wikipedia.org/wiki/Seven-day_week#Week_numbering

Currently we use something like this:

[[[NSCalendar currentCalendar]
components:NSWeekCalendarUnit fromDate:[NSDate date]]
week];

Is this a bug of NSCalendar or am I doing something wrong?

atze

___

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

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

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

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


Re: iPhone: diagnose crashes

2010-01-11 Thread Alexander Spohr
Your App crashes in MainViewController.m line 113.
You send a message to a dead object in there.

atze


Am 11.01.2010 um 14:50 schrieb Eric E. Dolecki:

 I have an app that I am trying to debug. When I run in Simulator I have no
 problems. When I am tethered to my dev machine with a device I see no
 problems. When I'm out and about I'll get crashes when I click into a
 UITextField in a view I flip to I'll get the crashes (sometimes)
 
 Using Organizer I'll check into the crashes and I don't understand them:
 
 Exception Type:  EXC_BAD_ACCESS (SIGBUS)
 
 Exception Codes: KERN_PROTECTION_FAILURE at 0x000e
 
 Crashed Thread:  0
 
 
 Thread 0 Crashed:
 
 0   libobjc.A.dylib   0x3ebc objc_msgSend + 20
 
 1   ZipWeather0x3ace -[MainViewController
 updateClock] (MainViewController.m:113)
 
 2   Foundation0xdd94 __NSFireTimer + 136
 
 3   CoreFoundation0x000574bc CFRunLoopRunSpecific + 2192
 
 4   CoreFoundation0x00056c18 CFRunLoopRunInMode + 44
 
 5   GraphicsServices  0x436c GSEventRunModal + 188
 
 6   UIKit 0x3c28 -[UIApplication _run] + 552
 
 7   UIKit 0x2228 UIApplicationMain + 960
 
 8   MyApp 0x2c76 main (main.m:14)
 
 9   MyApp   0x2c0c start + 44
 
 
 Thread 0 crashed with ARM Thread State:
 
r0: 0x0017bb60r1: 0x33843fc8  r2: 0x3dd612f7  r3: 0xbf7e98fd
 
r4: 0x0006r5: 0x0038  r6: 0x0017bb60  r7: 0x24c0
 
r8: 0x33843fc8r9: 0x001fc098 r10: 0x00105bf0 r11: 0x00105ce0
 
ip: 0xa07csp: 0x2370  lr: 0x3ad5  pc: 0x3090febc
 
  cpsr: 0x000f0010
 
 
 Any ideas based on the above?
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de
 
 This email sent to a...@freeport.de

___

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

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

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

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


Re: NS_INLINE and obj = nil;?

2010-01-02 Thread Alexander Spohr

Am 02.01.2010 um 05:09 schrieb Stephen J. Butler:

 If you really wanted a macro, it would look like this:
 
 #define GDRelease(x) do { [(x) release]; (x) = nil; } while (0)

What is the do while good for?

Would this not work as well:
#define GDRelease(x) { [(x) release]; (x) = nil; }

Or even this:
#define GDRelease(x) [(x) release], (x) = nil;

atze

___

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

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

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

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


Re: NS_INLINE and obj = nil;?

2010-01-02 Thread Alexander Spohr

Am 02.01.2010 um 17:28 schrieb Clark Cox:

 On Sat, Jan 2, 2010 at 6:29 AM, Alexander Spohr a...@freeport.de wrote:

 Would this not work as well:
 #define GDRelease(x) { [(x) release]; (x) = nil; }
 
 Or even this:
 #define GDRelease(x) [(x) release], (x) = nil;


 No, neither would work as well. Consider the following:
 
 if(x)
GDRelease(x);
 else
foo(x);
 
 
 With the do/while, that expands to:
 
 if(x)
do { [(x) release]; (x) = nil; } while (0);
 else
foo(x);
 
 which works just fine.

I see.

 However, your first example, would expand to:
 
 if(x)
{ [(x) release]; (x) = nil; };
 else
foo(x);
 
 That semi-colon makes that statement a parse error.

Right.

 and your second example expands to:
 
 if(x)
[(x) release]; (x) = nil;
 else
foo(x);
 
 which is also a parse error.

No to this.
I put a , not a ; between the statements. So at least my last example would 
work - had I just left the last ; out of it:

#define GDRelease(x) [(x) release], (x) = nil
expands to:
if(x)
   [(x) release], (x) = nil;
else
   foo(x);

But the while(0) looks not as fragile.

atze

___

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

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

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

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


Re: Program not working under Snow Leopard

2009-12-28 Thread Alexander Spohr
Is the delegate of your NSURLConnection retained while the request runs?

atze



Am 27.12.2009 um 16:23 schrieb insanely...@mac.com:

 I'm working on a program that manages file downloads via NSURLConnection.  I 
 was developing under Leopard and the program was working just fine.  I've 
 switched to a new computer running Snow Leopard with the latest Xcode.  My 
 program now crashes with the ever popular EXEC_BAD_ACCESS error at seemingly 
 random points.  At first it was consistently crashing when I was attempting 
 to reference the value in an NSDate variable (via NSLog).  So I commented 
 that line out and then it crashed with the same error on a different 
 variable.  Also, I can run the program just fine in the debugger with it set 
 to Debug.  Once it's set to Release it crashes.  I've confirmed the settings 
 are identical for Debug/Release.  And as I said, this code worked fine in 
 Leopard.
 
 At this point, I'm not bothering to include any code since it seems to crash 
 at random points.  I was just hoping to see if anyone has heard of similar 
 issues or may have some insight into Leopard vs. Snow 
 Leopard.___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de
 
 This email sent to a...@freeport.de

___

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

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

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

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


Re: extending automatic core data entity classes

2009-12-28 Thread Alexander Spohr

Am 28.12.2009 um 07:59 schrieb Damien Cooke:

 iPhone Simulator 3.1 (139.1), iPhone OS 3.1.2 (7D11)
 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', 
 reason: '*** -[NSManagedObject returnAdditiveWarningByType]: unrecognized 
 selector sent to instance 0x3a2d580'

What class is at 0x3a2d580?
Show debug output.

 It is called like this in the code
 AdditiveEntity *additiveEntity = (AdditiveEntity *)[fetchedResultsController 
 objectAtIndexPath:indexPath];
 if ([additiveEntity returnAdditiveWarningByType] == 
 ADDITIVE_WARNING_TYPE_WARNING)
 {

 }
 
 This indicates that despite the fact I have cast the object to an 
 additiveEntity the class I am trying to apply this to is of type 
 NSManagedObject not my class at all.

Right! Why don’t you log what you get and have a look why it is not what you 
expect?

 So my questions are am I a complete idiot and have missed something simple?

How should we know? You don’t show how your fetchedResultsController gets its 
contents.

 Am I able to add convenience methods to the classes that core data generates 
 for use as the entity classes if so can someone tell me what am I doing wrong?

Not without seeing code. Besides, I would not touch the generated classes. Use 
a category instead.

 Is there something stopping me from casting the result of 
 [fetchedResultsController objectAtIndexPath:indexPath] to a AdditiveEntity 
 which is a subclass of NSManagedObject anyway?

You can cast your objects even to a BOOL. But that will not make it a BOOL if 
it is not a BOOL already.

 @interface AdditiveEntity : NSManagedObject { 
 }
 
 - (ADDITIVE_WARNING_TYPE)returnAdditiveWarningByType;
 
 @end

So this is your header. Does your class have an implementation of that method?

atze

___

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

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

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

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


Re: IPhone- Datasensitive bug from CoreData...

2009-12-25 Thread Alexander Spohr

Am 25.12.2009 um 06:40 schrieb Brian Bruinewoud:

 I don't understand how the value of 'score' breaks things. If I get rid of 
 the negation in this code:
int score;
if( self.isGood )  score =   sender.tag;
else   score = - sender.tag; 
 everything works fine: adding good and bad to the same person is acceptable.

If you get rid of this what are you doing with that:
[newDeed setValue: [NSNumber numberWithInt: score] forKey: @points];
 
 Any suggestions on what to investigate?

1. Make real classes of your CoreData objects.

2. Just to do something with score try:
int score = [sender tag];
if(![self isGood])
score = -score;

3. Is points in your model broken?

4. Other than that it sounds like a memory problem.

atze

___

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

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

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

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


Re: Is there a warning for this?

2009-12-24 Thread Alexander Spohr

Am 24.12.2009 um 09:26 schrieb Brian Bruinewoud:

 All,
 
 I had this code:
 
   [[fetchedResultsController sections] count]
 
 Which always returned zero even thought sglite showed entries in the table.
 When I put a break point on the getter, nothing happened.
 
 Amazingly, it dawned on me pretty quickly that I needed this:
 
   [[self.fetchedResultsController sections] count]
 
 (notice the 'self' at the start)
 
 Is there some way to turn on a warning saying 'you are directly accessing an 
 ivar where a (non-trivial) getter/setter exists'?

Not that I know.
But you are free to give your ivars another name like 
ivarFetchedResultsController. Then you will get an error if you try the first 
example.

atze



___

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

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

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

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


Re: Autorotation for a subview

2009-12-23 Thread Alexander Spohr
Eric,

1. Can’t you use autoresizingMask for all subviews? You can do pretty much 
automagic with it. Just let your Button hang to the lower and right borders.
A view should not resize/reposition itself.

2. Don’t put the view of controller B into a view of controller A.
Why not presentModalViewController:animated:?

3. is a question from me to the knowing:
It seems that when didRotateFromInterfaceOrientation: is called, all views are 
still in the old orientation. Is this correct? If so I will file a bug because 
after it DID rotate the views should all have their new position / size.

atze



Am 23.12.2009 um 02:09 schrieb Eric E. Dolecki:

 I already stated (I believe) that I needed to redo the way this application
 is being constructed. In this way I'll have more direct access to subviews.
 I originally created another view controller with it's own nib and I was
 indeed loading it and using it as a subview to my main view. No leaks since
 it's removed itself from superview.
 
 In regards to the NSNotification, I look at that as a learning opportunity
 and not merely a way of throwing some code at a problem hoping it will make
 it work. I haven't ever used it before - I've only been part-timing iPhone
 apps for about 7 months now. It's fascinating and exciting and humbling when
 you're trying to do something and were unaware of the proper framework or
 methods to use.
 
 Eric
 
 On Tue, Dec 22, 2009 at 7:37 PM, mmalc Crawford mmalc_li...@me.com wrote:
 
 
 On Dec 22, 2009, at 3:37 pm, Matt Neuburg wrote:
 
 This sounds like a good time for the view to post an NSNotification.
 The
 subview can then respond to it. m.
 
 Sounds like overkill --- swatting mosquitoes with sledgehammers.
 
 An NSNotification is not a sledgehammer. And letting interested listeners
 know that a certain key moment in the lifetime of the application has been
 reached, is not a mosquito. Indeed, this is why something like
 UIApplicationDidFinishLaunchingNotification *is* a notification. Sometimes
 the delegate or subclass instance is not the only interested party; the
 moment where didRotateFromInterfaceOrientation: arrives might be such a
 case.
 
 Using a notification per se is not a sledgehammer.
 Setting up your own view to post notifications for this situation, however,
 almost certainly is (*insofar as it's possible to determine the OP's
 requirements, given the confused problem description...*).
 There is already a perfectly good mechanism for communicating changes about
 a device's orientation through an object that's in the best place to respond
 to such changes -- UIView*Controller*'s
 willAnimateRotationToInterfaceOrientation... et al. methods.
 
 On Dec 22, 2009, at 4:25 pm, Eric E. Dolecki wrote:
 I am interested in NSNotification as I haven't used that yet.
 
 
 It's not clear if you're trying to solve a problem or learn about iPhone OS
 programming in general.
 Unthinkingly chasing interesting API is not a particularly useful
 strategy for solving a problem.
 Per Henry's reply, you should properly describe what the task is you're
 trying to accomplish using terminology and conventions that will best help
 those trying to help you.
 
 Hint; this:
 - (IBAction) displayInfo:(id)sender {
 
 myInfoView = [[InfoViewController alloc] initWithNibName:@
 InfoViewController
 bundle:[NSBundle mainBundle]];
 
 myInfoView.view.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin
 |
 UIViewAutoresizingFlexibleRightMargin |
 UIViewAutoresizingFlexibleTopMargin
 | UIViewAutoresizingFlexibleBottomMargin);
 
 [self.view addSubview:myInfoView.view];
 
 }
 
 makes almost no sense.
 
 Using a view controller to instantiate a view to add as a subview of
 another view that is presumably managed by another view controller is not a
 supported pattern.  You're also ignoring basic memory management guidelines,
 and will almost certainly be leaking both the view controller and its
 accompanying view.  Adding notifications to this scenario will not end
 prettily.
 
 mmalc
 

___

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

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

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

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


Re: Remember Window and Inspector Positions

2009-12-21 Thread Alexander Spohr

Am 21.12.2009 um 20:22 schrieb David Blanton:

 I have a main window and a few floating inspectors. I would like to come back 
 to the position the user left these upon relaunch. Do I have to program this 
 or is there some Cocoa or other construct that does this for me?

You can put that into UserDefaults.
And I think a window just needs a name (in IB even?) and some BOOL set to YES 
to that automagic. But I am not sure about the latter.

atze

___

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

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

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

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


Re: NSTableview datasource issues

2009-12-20 Thread Alexander Spohr
Did you set a breakpoint on the data source methods?

Please reread about memory management. Your code is full of wrong retains.

Why is segmentDict a global variable? You just assign to it but never release 
it.
segmentIndustry is a class and should be named with a capital S.

segmentIndustryData is always empty. How should it populate your table view?

atze




Am 20.12.2009 um 02:09 schrieb aronis...@afroamerica.net:

 I know this has been discussed before, but I have been going through the 
 issue of reloadData and datasource methods not running. I cannot figure out 
 what is going on with my datasource methods.
 Everything is connected. But when on [segmentTableView reloadData], no 
 datasource method is run.
 After the application was running, I debugged the code and checked the 
 classes of SelectorController and TableSource. They are all connected in 
 runtime.For table view, I only connected it to SelectorController - 
 segmentTableView, and its dataSource to SelectorController - 
 segmentTableView. All of them are connected properly in runtime.In Log, when 
 I print the datasource and delegate of SegmentTableView, it shows 
 SelectorController.
 
 This is troublesome as I have 4 other tables in the same application that are 
 loaded properly through their dedicated datasources.
 It is only in this table that nothing is working. What am I missing? Your 
 help is invaluable.
 
 
 Her is some of the relevant code:
 
 
 // SelectorController.h
 #import Cocoa/Cocoa.h
 @classsegmentIndustry;
 
 
 @interface SelectorController : NSObject {
 NSMutableArray *segmentIndustryData;
 IBOutletNSTableView *segmentTableView;
 IBOutletNSArrayController *segmentDataController;
 
 IBOutletNSButton *stockSelectButton;
 intmodelRS;
 
 }
 
 -(void) insertObject:(segmentIndustry *) s inSectorDataAtIndex:(int)index;
 
 -(IBAction) initializeSectorSegmentData:(id) sender;
 @end
 
 
 
 // SelectorController.m
 
 
 
 #import SelectorController.h
 #import segmentIndustry.h
 #import MyDocument.h
 
 
 NSDictionary *segmentDict;
 
 
 @implementation SelectorController
 
 
 - (id)init
 {
 self = [superinit];
 if (self) {
 
 // Add your subclass-specific initialization here.
 // If an error occurs here, send a [self release] message and return nil.
 segmentDict =[NSMutableDictionarydictionary];
 [segmentDictretain];
 
 }
 return (self);
 }
 - (void)awakeFromNib
 {
 segmentIndustryData=[[NSMutableArrayalloc] init];
 [segmentIndustryDataretain];
 segmentDataController=[[NSArrayControlleralloc] init];
 [segmentDataControllerretain];
 
 
 }
 //Load into TableView in the GUI
 #pragma mark Table view dataSource methods
 
 
 - (int) numberOfRowsInTableView:(NSTableView *) TableView
 {
 return [segmentIndustryDatacount];
 
 }
 
 
 -(id)tableView:(NSTableView *)aTableView
 ObjectValueForTableColumn:(NSTableColumn *)aTableColumn
 row:(int)rowIndex
 {
 
 NSString *identifier =[aTableColumn identifier];
 segmentIndustry *stock =[segmentIndustryDataobjectAtIndex:rowIndex];
 return [stock valueForKey:identifier];
 
 }
 
 
 -(void) tableView:(NSTableView *) aTableView
 setObjectValue:(id)anObject
 forTableColumn:(NSTableColumn *) aTableColumn
 row:(int) rowIndex
 {
 NSString *identifier =[aTableColumn identifier];
 //What stock?
 segmentIndustry *stock =[segmentIndustryDataobjectAtIndex:rowIndex];
 [stock setValue:anObject forKey:identifier];
 
 //Set the value for the attribute named identifier
 }
 
 
 
 
 
 
 
 -(IBAction)initializeSectorSegmentData:(id) sender
 {
 segmentDict=[[MyDocumentgetSectorSegmentData:(id) sender] mutableCopy];
 [segmentDictretain];
 NSWindow *w =[segmentTableViewwindow];
 [wmakeKeyWindow];
 //Fill the table row by row;
 int i=0;
 NSMutableArray *aXtemp;
 if ([segmentIndustryDatacount]0) [segmentIndustryDataremoveAllObjects];
 [[segmentDataControllercontent] removeAllObjects];
 for (idkeyinsegmentDict)
 {
 aXtemp = [NSMutableArrayarrayWithArray:[(NSArray 
 *)[segmentDictobjectForKey:key] mutableCopy]];
 if ([(NSString *) [aXtemp lastObject] intValue]== modelRS) {
 [aXtemp insertObject:(NSString*) keyatIndex:(NSUInteger)1];
 segmentIndustry *s = [[segmentIndustryalloc] init];
 [s setSegName:(NSString *)[aXtemp objectAtIndex:(NSUInteger) 0]];
 [s setSegOther:(NSString *)[aXtemp objectAtIndex:(NSUInteger)1]];
 [s setSegIndustry:(NSString*)[aXtemp objectAtIndex:(NSUInteger)2]];
 [s setSegSector:(NSString *)[aXtemp objectAtIndex:(NSUInteger) 3]];
 // Add it to the content array of 'stockDataController'
 [segmentDataControlleraddObject:s];
 [selfinsertObject: s inSectorDataAtIndex:(int)i];
 ++i;
 }
 }
 
 //Re-sort (in case the user has sorted a column
 [segmentDataControllerrearrangeObjects];
 
 // Get the sorted array
 
 NSArray *a = [segmentDataController arrangedObjects];
 for ( i=0;i[a count];++i) {
 [segmentTableView editColumn:0 row:i withEvent:nil select:YES];
 
 [segmentTableViewreloadData];
 
 }
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 

Re: NSTableview datasource issues

2009-12-20 Thread Alexander Spohr

Am 20.12.2009 um 18:32 schrieb aronis...@afroamerica.net:

 I did not give you all the methods in my code (it is too lengthy).  
 segmentDict is a global variable because I need it somewhere else.

Sounds like bad design ;)

 a dealloc method takes care of releasing the arrays and dictionary.

Nope! First you alloc a dict in init:
 segmentDict =[NSMutableDictionarydictionary];
 [segmentDictretain];
And later you copy:
 -(IBAction)initializeSectorSegmentData:(id) sender
 {
 segmentDict=[[MyDocumentgetSectorSegmentData:(id) sender] mutableCopy];
// and retain
 [segmentDictretain];

That are three retains on segmentDict - and only one release in dealloc.

 - (void)awakeFromNib
 {
 segmentIndustryData=[[NSMutableArrayalloc] init];
 [segmentIndustryDataretain];
// double init/retain

 segmentDataController=[[NSArrayControlleralloc] init];
 [segmentDataControllerretain];
// double init/retain


 Anyway, even without retain, the table doesn't reload data.
 
 I do not think naming is the issue, it is more of the good habit to have. 

It makes clear what you have at hand - if you stick to it.

Really, I don’t want to offend you but the code you show is buggy and leaks. I 
did not check the rest of your code after finding the release bugs.

atze

___

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

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

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

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


Re: pls explain rotated iPhone coordinates to me

2009-12-15 Thread Alexander Spohr
This seems wrong.
When do you call this code?

Usually it is just enough to set the springs of your scroll view in IB. Then, 
after rotation, refit your content.

atze


Am 15.12.2009 um 03:46 schrieb Matt Neuburg:

 I am not grasping how coordinates work in a rotated iPhone app, and I'm
 hoping someone will explain them.
 
 My goal is a scroll view consisting of two equal pages side by side with
 the iPhone sideways (landscape). I have accomplished this, but I don't
 understand how I did it; I used pure trial and error, and what works makes
 no sense to me. Here's what I did.
 
 The scroll view occupies the entire window (except for the status bar, of
 course). It has a view controller implemented so as to permit the
 autorotation, and the plist tells us to start up in landscape mode. And we
 do. So far so good.
 
 Now I populate the scroll view. I want its content to be double-wide, but I
 have to widen its *height* (svc is the scroll view's controller):
 
CGRect f = svc.view.frame;
CGSize sz = CGSizeMake(f.size.height * 2.0, f.size.width); // swap!
((UIScrollView*)svc.view).contentSize = sz;
 
 Now I place the first page content:
 
CardController* cc =
 [[CardController alloc] initWithCard: [data objectAtIndex: 0]];
svc.view.frame = f; // don't swap!!
[svc.view addSubview:cc.view];
 
 Now I place the second page content:
 
f.origin.x += f.size.height; // ??? height and width are swapped...
 // but x and y are not swapped?
CardController* cc2 =
 [[CardController alloc] initWithCard: [data objectAtIndex: 1]];
cc2.view.frame = f;
[svc.view addSubview: cc2.view];
 
 This works great. But why? What on earth is going on here? Thanks - m.
 

___

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

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

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

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


Re: Bluetooth failure

2009-12-13 Thread Alexander Spohr
Am 13.12.2009 um 03:15 schrieb Rob Keniger:

 On 12/12/2009, at 11:24 PM, Alexander Spohr wrote:
 
 As far as I know, the Simulator has no GameKit as it does not exist under 
 Mac OS.
 
 That's actually not quite true, GameKit exists on the simulator but it (very 
 unfortunately) cannot use the Mac's Bluetooth hardware, so it's not very 
 useful.

Then we should file a bug report and request it.
It would even be valuable for Mac OS.

atze

___

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

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

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

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


Re: Bluetooth failure

2009-12-12 Thread Alexander Spohr
As far as I know, the Simulator has no GameKit as it does not exist under Mac 
OS. So this can not work. Therefore your problem is not the iPod but the Mac.
You need two iPhones/iPods to do GameKit tests.

atze


Am 12.12.2009 um 01:42 schrieb Development:

 I have a Gen 2 iPod and the simulator trying to share data over bluetooth I 
 am using the standard GK routines. However the iPod cannot see the simulator 
 and the simulator, though it can see the ipod, as soon as I try to connect I 
 get the error in the connect screen :Connection Lost
 
 when i log the error this is the error data : 
 com.apple.gamekit.GKSessionErrorDomain Code=30505 UserInfo=0x1420f30 Failed 
 while pending outgoing invitation.
 
 Basically I'm almost thinking that there is something wrong with the iPod's 
 bluetooth since it appears blind and cannot accept connections. None of the 
 connectivity routines are ever called in the code.
 
 - (void)session:(GKSession *)session 
 didReceiveConnectionRequestFromPeer:(NSString *)peerID
 {
   NSLog(@Connections request from: %@ to session: %@,peerID,session);
   [session acceptConnectionFromPeer:peerID error:nil];
 //
   
 }
 
 is never called on the iPod even though I am attempting to 
 connect.___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de
 
 This email sent to a...@freeport.de

___

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

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

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

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


Re: Question about touchesBegan

2009-12-10 Thread Alexander Spohr

Am 10.12.2009 um 14:46 schrieb Eric E. Dolecki:

 What I am trying to do now is when I create the subView with the tuner bar, I 
 am setting it's view's bounds to something much smaller than the whole screen 
 and then animating it up. I think this approach might work.

I thought you did that already...
If not - it helps.

atze

___

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

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

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

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


Re: Question about touchesBegan

2009-12-09 Thread Alexander Spohr

Am 09.12.2009 um 20:32 schrieb Eric E. Dolecki:

 I have a main view that uses touchesBegan. I call up and display a subView
 on top of the main view, and that subView has it's own touchesBegan.
 
 The subView obstructs the touchesBegan in the main view. Is this expected?


Yes. Otherwise no subview of the window would ever get any touches...

Sub does not mean below :)

atze


___

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

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

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

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


Re: Question about touchesBegan

2009-12-09 Thread Alexander Spohr

Am 10.12.2009 um 04:34 schrieb Eric E. Dolecki:

 Well - I wonder if it's possible to enable touches in a sub view but not for
 the entire view - just part of it.
 
 I have a view with buttons in it. I call up a sub view that requires touches
 for swiping... I want the buttons in the view below to still register touch
 events for that entire view.

Usually the superview of the buttons would handle swipes.
If you have buttons put them on top (as a subview) of your swipe receiver.

Or - as was pointed out - let the controller catch all touches.

atze

___

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

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

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

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


Re: Question about touchesBegan

2009-12-09 Thread Alexander Spohr
Um, have to follow up to myself...

Am 10.12.2009 um 08:02 schrieb Alexander Spohr:

 Am 10.12.2009 um 04:34 schrieb Eric E. Dolecki:
 
 Well - I wonder if it's possible to enable touches in a sub view but not for
 the entire view - just part of it.
 
 I have a view with buttons in it. I call up a sub view that requires touches
 for swiping... I want the buttons in the view below to still register touch
 events for that entire view.
 
 Usually the superview of the buttons would handle swipes.
 If you have buttons put them on top (as a subview) of your swipe receiver.
 
 Or - as was pointed out - let the controller catch all touches.

If your swipe view and buttons are in the same hierarchy

- (void)bringSubviewToFront:(UIView *)view
- (void)sendSubviewToBack:(UIView *)view

should help.

But as these are in the docs of UIView I am sure you already found them. ;)

atze

___

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

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

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

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


Re: Programatically Setting Delegate

2009-12-06 Thread Alexander Spohr
I translate you url for a better understanding for other readers:
You google:
 you forgot to allocate the object before setting it's delegate
The result:
 No results found for you forgot to allocate the object before setting it's 
 delegate.

So what are you telling us?

Maybe you should have shown code.
The error message is clearly not because you forgot an alloc. The compiler does 
not check if you pointer is pointing to a valid object or nil or garbage. How 
should it?

Or I completely misunderstood what you wanted to know. I am sorry then for 
pointing you to the obvious.

atze


Am 05.12.2009 um 20:57 schrieb Chunk 1978:

 i figured it out.  alexander, this would have been more helpful:
 http://tinyurl.com/yjpeljv
 
 On Sat, Dec 5, 2009 at 2:42 PM, Chunk 1978 chunk1...@gmail.com wrote:
 thanks for teaching me how to use google.  huge help.
 
 unfortunately, since i've imported both UIKit and my controller class
 into my custom UIImageView class, my question is wasn't what does that
 error mean, but why am i receiving it.
 
 On Sat, Dec 5, 2009 at 6:45 AM, Alexander Spohr a...@freeport.de wrote:
 http://lmgtfy.com/?q=error+request+for+member+is+something+not+a+structure+of+union
 
atze
 
 
 Am 05.12.2009 um 09:12 schrieb Chunk 1978:
 
 i have a UIViewController that i'm setting as the delegate for my
 custom UIImageView class.  from my custom UIImageView class i want the
 delegate to change it's background color (based on computations
 performed within the UIImageView class).
 
 in my UIViewController i write:
 –
 myUIImageViewClass.classDelegate = self;
 –
 
 then in my custome UIImageViewClass i synthisize the accessor method
 for the classDelegate, which is of type id. then from within the code
 i try to change the background color of it's delegate with this:
 –
 [[classDelegate view] setBackgroundColor:[UIColor greenColor]];
 –
 
 if i write it like classDelegate.view.backgroundColor = ... then i
 receive and error saying error request for member is something not a
 structure of union
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de
 
 This email sent to a...@freeport.de

___

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

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

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

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


Re: Programatically Setting Delegate

2009-12-05 Thread Alexander Spohr
http://lmgtfy.com/?q=error+request+for+member+is+something+not+a+structure+of+union

atze


Am 05.12.2009 um 09:12 schrieb Chunk 1978:

 i have a UIViewController that i'm setting as the delegate for my
 custom UIImageView class.  from my custom UIImageView class i want the
 delegate to change it's background color (based on computations
 performed within the UIImageView class).
 
 in my UIViewController i write:
 –
 myUIImageViewClass.classDelegate = self;
 –
 
 then in my custome UIImageViewClass i synthisize the accessor method
 for the classDelegate, which is of type id. then from within the code
 i try to change the background color of it's delegate with this:
 –
 [[classDelegate view] setBackgroundColor:[UIColor greenColor]];
 –
 
 if i write it like classDelegate.view.backgroundColor = ... then i
 receive and error saying error request for member is something not a
 structure of union

___

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

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

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

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


Re: [iphone] Libxml2 with a wrapper to NSArray

2009-12-04 Thread Alexander Spohr

Am 04.12.2009 um 10:09 schrieb Philip Vallone:

 Next I had a syntax error when declaring my NSArray and like you said it was 
 pointing to an empty array:
 
   NSArray* result = [NSArray arrayWithArray:PerformXMLXPathQuery(xmlData, 
 @//mynode)];

Why are you putting the contents of the array you got into another array?
Just keep the array you get:
NSArray* result = PerformXMLXPathQuery(xmlData, @//mynode);

atze

___

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

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

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

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


NSConnection retaining delegate?

2009-11-25 Thread Alexander Spohr
Hi list,

is NSConnection retaining its delegate?
(At least as long as it is collecting data)

I thought contract is that a delegate is never retained?

This behavior requires to _always_ send cancel to the connection before you 
release the delegate. Otherwise the NSConnection might still hold on to the 
delegate which should by now have been purged from memory.

Is this right or am I wrong? Should I file a bug?

atze

___

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

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

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

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


Re: NSURLConnection retaining delegate?

2009-11-25 Thread Alexander Spohr
Shame on me!
I meant NSURLConnection.
Andy, sorry that I bothered you with the wrong test.
This is one example where copy-paste is better than fresh typing...

So the (corrected) question still stands:
is NSURLConnection retaining its delegate?

atze



Am 25.11.2009 um 21:19 schrieb Andy Lee:

 On Wednesday, November 25, 2009, at 12:15PM, Alexander Spohr 
 a...@freeport.de wrote:
 is NSConnection retaining its delegate?
 (At least as long as it is collecting data)
 
 FWIW I've never used NSConnection, but in the following quick and dirty code 
 it did not retain the delegate I gave it.
 
   TestDelegate * aTestDelegate = [[[TestDelegate alloc] init] 
 autorelease];
   NSConnection * aConn = [[NSConnection alloc] initWithReceivePort:nil 
 sendPort:nil];
   [aConn setDelegate:aTestDelegate];
 
 The TestDelegate object got dealloced despite being the NSConnection's 
 delegate.
 
 
 I thought contract is that a delegate is never retained?
 
 I think there is at least one class that breaks the rule about not retaining 
 delegates (and is documented accordingly).  I forget which it is and I don't 
 have time to search for it, but it doesn't seem to be NSConnection.
 
 --Andy
 

___

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

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

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

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


Re: NSURLConnection retaining delegate?

2009-11-25 Thread Alexander Spohr

Am 25.11.2009 um 23:25 schrieb Jerry Krinock:

 
 On 2009 Nov 25, at 12:53, Alexander Spohr wrote:
 
 I meant NSURLConnection.
 
 * Normally the delegate is receiving and storing headers, data and errors for 
 you.  You should retain the delegate as long as you are interested in the 
 headers, data or errors being stored.  Once you have extracted or wish to 
 abandon this information, release the delegate or allow it to be autoreleased.

This is the problem. Releasing is not enough in this case.

I have this layout:

Ownership:
Controller - Loader - NSURLConnection

Delegation:
NSURLConnection - Loader - Controller

 The idea is that you mind your own references, and NSURLConnection will mind 
 its own references.

Controller's dealloc would just release Loader.
Loaders dealloc would just call cancel and release NSURLConnection.
Controller does not set Loader's delegate to nil because it will get recycled 
anyway because Controller and no one else owns it.
-BUT-
NSURLConnection still holds on to Loader and sends it connectionDidFinish. This 
in turn makes Loader tell its own delegate that the loading is complete. 
Because Loader does not retain its delegate (avoiding retain-cycles) everything 
blows up.

Or is the contract to always [anyObject setDelegate:nil] before you release the 
related objects? That would be news for me.

atze

___

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

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

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

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


Re: Core Data and +[NSExpression expressionForFunction:...]

2009-11-25 Thread Alexander Spohr
Ron,

I am not sure if that works at all. I never fetched using methods that are not 
part of the database as a qualifier. Your code has to be very slow because it 
would need to fetch all Photos and then call distanceFromLatitude:longitude: on 
each.

Why not qualify directly using a bounding rect?
latitude  inLatitude - 0.1  latitude  inLatitude + 0.1 
longitude  inLongitude - 0.1  longitude  inLongitude + 0.1
The database can figure that out very fast.

atze



Am 26.11.2009 um 02:08 schrieb Ron Aldrich:

 Hello All,
 
 I'm trying to query a Core Data database which contains geoLocation 
 information for all of the objects of type Photo which are within a 
 specified distance of a target point, using the following code.
 
 - (NSArray*) photosNearLatitude: (NSNumber*) inLatitude
  longitude: (NSNumber*) inLongitude
 {
  NSExpression *theLHS = [NSExpression expressionForFunction: [NSExpression 
 expressionForEvaluatedObject]
selectorName: 
 @distanceFromLatitude:longitude:
   arguments: [NSArray 
 arrayWithObjects:
   [NSExpression 
 expressionForConstantValue: inLatitude],
   [NSExpression 
 expressionForConstantValue: inLongitude],
   nil]];
 
  NSExpression* theRHS = [NSExpression expressionForConstantValue: [NSNumber 
 numberWithDouble: 0.1]];
 
  NSPredicate* thePredicate = [NSComparisonPredicate 
 predicateWithLeftExpression: theLHS
 
 rightExpression: theRHS

 modifier: NSDirectPredicateModifier

 type: NSLessThanOrEqualToPredicateOperatorType
 
 options: 0];
 
  NSManagedObjectContext* theManagedObjectContext = [self 
 managedObjectContext];
 
  NSFetchRequest* theFetch = [[[NSFetchRequest alloc] init] autorelease];
  theFetch.entity = [NSEntityDescription entityForName: @Photo
inManagedObjectContext: 
 theManagedObjectContext];
  theFetch.predicate = thePredicate;
 
  NSError* theError = NULL;
  NSArray* theResults = [theManagedObjectContext executeFetchRequest: theFetch
   error: 
 theError];
 
  return theResults;
 }
 
 The Photo class has the following selector.
 
 - (NSNumber*) distanceFromLatitude: (NSNumber*) inLatitude
 longitude: (NSNumber*) inLongitude
 
 My problem is that when I call executeFetchRequest, an exception occurs:
 
 2009-11-25 16:55:20.633 Serendipity[8498:a0f] Unsupported function expression 
 FUNCTION(SELF, distanceFromLatitude:longitude: , 47.712834, 
 -122.225)
 
 -[Photo distanceFromLatitude:longitude:] is never called.
 
 Can anyone suggest what might be going wrong?
 
 - Ron Aldrich
 

___

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

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

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

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


Re: drawRect method not called after several hours...

2009-11-23 Thread Alexander Spohr

Am 23.11.2009 um 13:30 schrieb Boris Prohaska:

 It does GUI updates multiple times a second.

How?

atze

___

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

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

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

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


Re: Transparency Help 2

2009-11-23 Thread Alexander Spohr
Am 23.11.2009 um 19:01 schrieb R T:

 Given: A litho Image, Black  White pixels only. 
 I want to show just the Black Pixels in a subclassed NSView.

Underlay all white pixel with an alpha of 0 and composite that?

atze

___

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

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

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

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


Re: tiffs on pasteboard

2009-11-20 Thread Alexander Spohr

Am 20.11.2009 um 03:04 schrieb Chris Idou:

 But what are the rules and conventions? Why would Finder put the icon in the 
 pasteboard on the assumption that is what the user wants, but TextEdit would 
 paste in the actual file on the assumption that is what the user wants? It 
 seems schizophrenic.

Yeah. Copying a 20MB image to the pasteboard would be what the user wants. Or 
better one Gig of video. I think not.
You think like a user (who would assume that the file is really on the 
pasteboard) and not like a developer (who should know that the pasteboard 
content has to be lightweight).

 I just want a list of rules of how to use the Pasteboard in a way that 
 conforms to what users expect. If I start ignoring the TIFF part of the 
 pasteboard in favor of the URL on the assumption that is what the user wants, 
 why is the tiff there anyway?

The TIFF is a preview. The URL is the meat.

 And will that get me into trouble in other cases?

That depends only on the pasteboard provider. There is no strict rule. The 
provider does not know the recipient and therefore puts everything on the 
pasteboard that will satisfy the task the provider offers.

atze

___

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

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

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

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


Re: Performance

2009-11-18 Thread Alexander Spohr

Am 16.11.2009 um 07:14 schrieb Chris Carson:

 The first class is the model that submits asynchronous bulk reads to the USB 
 device. The callback for these reads copies the received data from the buffer 
 asynchronous filled by the request and into an NSData object that is 
 allocated and added to an NSArray. The buffer that the asynchronous request 
 was using is recycled into a new asynchronous request. So the pool of buffers 
 is allocated once and reused while the NSData objects are continuously 
 allocated and deallocated (when released by the controller).
 
 The second class is the view that uses an NSTimer to call [self 
 setNeedsDisplay:YES] 24 times per second. The drawRect: method requests data 
 from the data source (the third, controller class) and draws it with OpenGL.

Why? Only redraw if new data is available.

 The third class is the controller class that serves as a data source for the 
 view. When the view calls the giveMeData: method, the controller class calls 
 the buffer: method in the model class, which removes and returns the oldest 
 NSData object in its NSArray. The controller then does some computations on 
 it and passes it off to the view in a new NSData object.

This sounds like you poll the model? Use a the controller as a delegate of the 
model to avoid polling. Make it event driven.

 The application runs pretty well, and running it through the Leaks instrument 
 there are no leaks except for 16-bytes when the application is first starting 
 caused by IOUSBLib. However, looking at it in the Activity Monitor, the real 
 memory used starts off at 25 MB and steadily grows to 250+ MB while the 
 virtual memory starts off at about the same and steadily grows to about the 
 same or sometimes close to 500MB, over the course of several minutes. This 
 especially happens if I don't move the mouse for a while, or don't have the 
 application in focus. As soon as a move the mouse or bring the application 
 into focus, it's as if an autorelease pool is drained and the memory drops 
 back down to 30-40MB real and 30-40MB virtual. This is annoying since the 
 application hangs for 5 seconds or so when this memory draining is occurring. 
 Has anyone dealt with this before? Any ideas on what could be causing this 
 and how to work around it?

This is exactly the case. The run loop does nothing if it has no input to 
handle.
Alloc your own autorelease pools at places that look like they would alloc some 
amount of autoreleased objects. Loops, the method you fire with your timer! and 
the filling of the array.

I do have a comment in my code (fired by a timer) that looks like this:
// NSView's getRectsBeingDrawn:count calls [NSMutableData 
dataWithLength]
// those build up if we don’t get them away faster than the runloop

(@List: Should I file a radar?)


 Another related question:
 
 The number of asynchronous requests that the driver submits at once and the 
 maximum number of objects in the NSArray are set to some constant. Now in 
 theory, the requests should be added and drained simultaneously (i.e. by 
 separate threads), but if I make this constant larger, I notice a greater 
 delay between when data entering the USB device and being plotted. It's as if 
 the asynchronous requests are being filled and added to the NSArray all in a 
 group, and then drained by the view all in a group... maybe? Is this 
 something subtle from the way run loops work? Is the USB asynchronous bulk 
 read run loop source on the same thread as the view class's drawRect method?

That could be, depending on your code. I have no advice here.

atze

___

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

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

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

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


Re: [iPhone] Implement a screen like contacts screen

2009-11-11 Thread Alexander Spohr
tableHeaderView

atze


Am 11.11.2009 um 14:45 schrieb Tharindu Madushanka:

 Hi
 
 Could I get some points on how to create a iPhone Contacts like screen. I
 think parts starting from mobile number is possible with Editable Detail
 view. But the Add Image and Name part is confusing. so Add image is not a
 table view cell or something and if then the field for Name cannot also be a
 table view cell. I am really glad to get some idea about it.
 
 Thanks
 
 Tharindu Madushanka
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de
 
 This email sent to a...@freeport.de

___

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

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

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

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


Re: Adding a vertical scrollbar to a multiline textfield

2009-11-10 Thread Alexander Spohr

Am 10.11.2009 um 12:45 schrieb Ian Piper:

 I hope someon can advise as to the best way to do what I want. I have a 
 multiline textfield that receives a very long piece of text. I wanted to add 
 a vertical scrollbar. I tried putting the multiline textfield inside a scroll 
 view but I'm not sure how you would tell the latter when to provide a 
 scrollbar. Presumably the textfield has to be a descendant of the scrollview 
 but I thought that putting one inside the other would do that.
 
 I also tried to use a textview but in that case I got an error saying that 
 NSTextView may not respond to setStringValue.
 
 What is the best way to do this?

Read the docs of NSTextView and understand how you set its text content.

atze

___

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

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

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

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


Re: Obtaining selected text from the frontmost application

2009-11-10 Thread Alexander Spohr
Services?
At least if the user wants you to get the text.

Otherwise? Would be a security issue and should not be possible.

atze



Am 10.11.2009 um 17:55 schrieb Nava Carmon:

 Hi,
 
 How do I approach to this task? Which technologies to use and whether there 
 are example of something similar.
 
 Thanks a lot for the guidance,
 
 Nava
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de
 
 This email sent to a...@freeport.de

___

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

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

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

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


Re: Core-Data : how to merge two contexts ?

2009-11-07 Thread Alexander Spohr


Am 07.11.2009 um 09:39 schrieb Eric Morand:

The NSManagedObjectContext is your scratchpad. If you want  
something inside it fetch it or create it.

If you change something, the change will be promoted.



Hi atze,

Actually, the change will be promoted only when they are committed  
to the store, and that implies a save on the disk. Or am I wrong ?


You are right.
EOF is capable of nested editing context. I don’t know if CoreData can  
do that as well.


But why don’t you want to save?
If you just want your objects in memory, why use CoreData at all?

atze

___

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

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

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

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


Re: NSDate / NSXMLParser

2009-11-04 Thread Alexander Spohr

The parser CAN parse the timezone and adjust the date accordingly.

To parse this date:
20091021T121942+0200
I use this format:
MMdd'T'HHmmssZZZ
and it works fine.

The only thing you need is to find the right timezone format string.
Yours might be
'-'MM'-'dd'T'HH':'mm':'ssZ
Not sure if you need to '' the : and -
And I really don’t know if the Z at the end of your date is tr35-6  
compatible.


Have a look at
http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns
for your format.


atze

___

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

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

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

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


Re: Handling projects with several XIBs

2009-11-02 Thread Alexander Spohr


Am 02.11.2009 um 11:55 schrieb Tobias Jordan:

The problem I am currently having is that when updating the  
interface I have to a) make my changes to every localization (en,  
ge, fr, jp, etc.) or  b) re-create all of the localizations which  
isn't that easy to handle since I am not the one translating  
everything.


That is how you do it for localized nibs.

Both ways are really time-consuming and I was wondering if there's a  
way to define some placeholders for strings and other resources such  
as images or sth. like that.


Alternatively you can use just one nib and replace the values using  
NSLocalizedString(). But you have to watch out for the lengths and  
sizes in different languages.



What's the most fastest and efficient way?


It depends on what you goal is.
a  b) are best if you want to have nice sized buttons in all languages
NSLocalizedString is easier to implement and to translate but the  
final look might get gruesome.


atze

___

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

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

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

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


Re: Problem with allocating memory

2009-10-28 Thread Alexander Spohr


Am 28.10.2009 um 10:27 schrieb Michael Abendroth:


Why is this happening?


How should we know if you don’t provide the faulty code?

atze

___

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

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

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

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


Re: Displaying a view modally (iPhone)

2009-10-21 Thread Alexander Spohr

Mike,

you need a view that has the size of the window to cover it  
completely. Otherwise touches will go down the responder chain and  
reach other views.


What happens while you show the spinner?
If you load data from the net show the UIApps spinner at the top.

atze



Am 21.10.2009 um 02:26 schrieb Mike Manzano:


Hi,

I'd like to display a busy indicator view (HUD) regardless of  
whatever view is currently at the top of the view stack. I'd also  
like this view to display modally so that the user interface beneath  
it is dead to touch events. This is like Tweetie 2's HUD that  
appears when you've successfully posted something to Instapaper,  
with the difference that the UI underneath it wouldn't accept events  
as they do in Tweetie 2. I'd also like to have some control over  
animating the HUD onto and off of the screen.


My current thinking is to find the topmost view controller somehow  
and send it presentModalViewController:animated:. However, I don't  
know how much control over animation I'd get with that method as the  
built-in animation styles sort of assume a full screen view. Also,  
I've never tried to use this method with a view that's smaller than  
the screen size.


Another thought is to just add the view to the root view and bring  
it to the top (this however won't make the view modal as the views  
below will still respond to touch events).


Can anyone tell me if I'm thinking along the right directions? I'd  
like to have some confirmation before I invest a bunch of time only  
to find out it's the wrong method.


Thanks,

Mike Manzano
mike (at) instantvoodoomagic (dot) com
http://instantvoodoomagic.com
@instantvoodoo

Oh BTW, the first reply that gets me closer to a solution gets a  
free promo code for Newsie (http://instantvoodoomagic.com/newsie),  
the Google Reader client for iPhone/iPod touch that I just released ;)




___

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

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

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

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


  1   2   >