Re: Random crashes
Perhaps do an NSLog on the [NSWindow becomeKeyWindow] / [NSWindow updateWindows] and see if an NSLog on NSNotification willEnterForeground fires before either of those methods. If so, then you have a good chance of closing down whatever SpriteKit is doing when your app is going to background and then restarting those processes upon willEnterForeground notification. At the very least, you should be able to get a better look at the error logs by adding a bit of delay. On Apr 1, 2014, at 5:19 PM, Alexander Reichstadt l...@mac.com wrote: Hi, in a project using the default Spritekit template all works fine until one leaves the app and switches to another process, which results in random crashes without a backtrace. After having switched to another process and returning to the running or also paused game, it's only a question of time when it will crash. It always seems to involve the main window. The trace is not very helpful as it crashes outside the app's own code. The last calls that I can see in the debugger are sometimes [NSApplication updateWindows], other times it's [NSWindow becomeKeyWindow]. Googling this issue was not very helpful. Suggestions varied from putting the entire app in a try-block, subclassing NSApplication for testing purposes, up to including creating the entire project from scratch and copy pasting line by line.good luck with that. Except for that last option I tried the other two to no avail. Is there a way to find the root cause of such a crash? Thx ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/caoimghgin%40gmail.com This email sent to caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Image without profile gets an sRGB profile on Mavericks
As Sandy says, its not a matter of right/wrong. Simply expected vs. unexpected. Sure, if I save an image with a profile and immediately ask what profile the image is tagged with, I would expect the result of nil, not sRGB. However, there is a certain brilliance to having all nil profiles default to sRGB. It's a damn fine idea. However, the question becomes a) Does the image REALLY have an embedded profile? b) If so, When/What put that profile there? (Probably quickly tested by measuring the size of the image) c) If not, should the framework REALLY say there was? I'd think the responsibility of assigning a default profile for non-tagged images should be higher up the food chain. On Mar 23, 2014, at 2:41 PM, Sandy McGuffog mcguff...@gmail.com wrote: Untagged images are a free-for-all - any app or framework can assume whatever it wants for a color space with them, so there’s no “wrongly” about what Mavericks does. It’s just different to previous versions. So far as I am aware, Apple is (strongly) discouraging the use of Device RGB, for the good reason that using it leads to inconsistent results. Sandy On Mar 23, 2014, at 8:14 PM, Leonardo mac.iphone@gmail.com wrote: I create a jpg RGB image with Photoshop without any icc profile. I import it in my app. NSBitmapImageRep*srcRep = [NSBitmapImageRep imageRepWithData:imageData]; NSLog(@profileName %@, srcRep.colorSpace.localizedName); On OS X 10.8.5 I properly get Device RGB. On Mavericks 10.9.2 I wrongly get sRGB IEC61966-2.1. Therefore I can't understand whether the image: 1. has no profile then I have to assign a profile chosen by my user. 2. has its own profile then I do not touch it. I even tried CGColorSpaceCopyName. Same result. Did Apple changed its mind on Mavericks giving a profile to all the orphans, or am I missing some step? Regards -- Leonardo ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/mcguffogl%40gmail.com This email sent to mcguff...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/caoimghgin%40gmail.com This email sent to caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Does UIAutomation testing even work?
I wish I could say I have had success, but it's far too early. Looking forward to replies. If it works, it'll take pressure off my beta-testers and allow me to sleep at night after a refactor. On Jan 23, 2014, at 5:50 PM, Rick Mann rm...@latencyzero.com wrote: I'm logging the element tree of my app. I can see my hierarchy: UIAWindow: rect:{{0, 0}, {1024, 768}} UIAPopover: rect:{{614, 59}, {400, 613}} UIATableView: name:settingsTable value:rows 1 to 4 of 4 rect:{{614, 116}, {400, 556}} UIAStaticText: name:CAMERA CONNECTION value:CAMERA CONNECTION rect:{{629, 136}, {189, 21}} UIAImage: name:camera_connection_2_large.png rect:{{784, 177}, {60, 60}} ... UIAButton: name:Help rect:{{776, 638}, {77, 44}} But no where in that list are the cells of the table view, and when I ask for the cells() on the table view UIAElement, I get back an empty list. At least one cell as accessibility enabled and a label in IB. There's scant evidence of this being used very heavily online, which reinforces my conclusion that it just doesn't really work well enough for people to use. Is anyone successfully using this to test their apps? -- Rick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/caoimghgin%40gmail.com This email sent to caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Stale xib files
However, isn't the process of updating apps in appstore identical to an Ad-Hoc distro? For instance, I've seen this same issue when distributing apps via TestFlight or even my own server. On Nov 17, 2013, at 9:06 AM, Koen van der Drift koenvanderdr...@gmail.com wrote: On Nov 16, 2013, at 7:33 PM, Roland King r...@rols.org wrote: The process of updating apps from the appstore is different from installing in the sim or copying to the device, it creates an entirely new directory with the app bundle, installs the new app and then copies the user data over. So you shouldn't need to do anything special for your users (as long as you are talking about an appstore update) Thanks, that's good to know. My previous comment about using loadView is after reading some more not a good solution, since Apple recommends not to call [super loadView]. - Koen. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Stale xib files
That would be a huge relief. Thanks Roland! On Nov 17, 2013, at 9:50 AM, Roland King r...@rols.org wrote: No I'm not sure that it is. Appstore updates really do blow things away and start over. I'm not sure that anything less than that does that. On 17 Nov, 2013, at 10:33 pm, Kevin Muldoon caoimgh...@gmail.com wrote: However, isn't the process of updating apps in appstore identical to an Ad-Hoc distro? For instance, I've seen this same issue when distributing apps via TestFlight or even my own server. On Nov 17, 2013, at 9:06 AM, Koen van der Drift koenvanderdr...@gmail.com wrote: On Nov 16, 2013, at 7:33 PM, Roland King r...@rols.org wrote: The process of updating apps from the appstore is different from installing in the sim or copying to the device, it creates an entirely new directory with the app bundle, installs the new app and then copies the user data over. So you shouldn't need to do anything special for your users (as long as you are talking about an appstore update) Thanks, that's good to know. My previous comment about using loadView is after reading some more not a good solution, since Apple recommends not to call [super loadView]. - Koen. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Stale xib files
I've experienced this as well, switching from xib to code. As far as I know, a clean install is only answer. Sent from my iPhone On Nov 16, 2013, at 12:26 PM, Koen van der Drift koenvanderdr...@gmail.com wrote: I'm in the process of removing some xibs, and construct my views in the ViewController. As it turns out, the app in the simulator or my device don't recognize that the xib was removed, and I need to completely reset the simulator, clean my build and build-folder, and then it works. My question is, how can I prevent this for my users? I don't want them to have to remove their app including all the data once an update becomes avialble. - Koen. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/caoimghgin%40gmail.com This email sent to caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Stale xib files
Nice!!! Sent from my iPhone On Nov 16, 2013, at 4:34 PM, Koen van der Drift koenvanderdr...@gmail.com wrote: I found a solution (thanks to SO). I moved the view creating code from viewDidLoad to loadView. And call [super loadView] first. - Koen. On Nov 16, 2013, at 12:54 PM, Kevin Muldoon caoimgh...@gmail.com wrote: I've experienced this as well, switching from xib to code. As far as I know, a clean install is only answer. Sent from my iPhone On Nov 16, 2013, at 12:26 PM, Koen van der Drift koenvanderdr...@gmail.com wrote: I'm in the process of removing some xibs, and construct my views in the ViewController. As it turns out, the app in the simulator or my device don't recognize that the xib was removed, and I need to completely reset the simulator, clean my build and build-folder, and then it works. My question is, how can I prevent this for my users? I don't want them to have to remove their app including all the data once an update becomes avialble. - Koen. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/caoimghgin%40gmail.com This email sent to caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Updating provisioning profiles xCode 5
Used to be I could manage my development provisioning profiles in the Organizer. Or I could update development profile in Apple Portal with new devices, download, double-click and viola! Neither seems to be the case now. Has this moved or have I gone blind? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Still can't get autolayout to work the way I want
I love the power of auto-layout, but I'll be damned if I can make it behave when working on the GUI .xib file. I've taken to using auto-layout without .xib, building the UI elements in the viewController.m and attaching NSLayoutContraints manually. It's a bit of a pain, but if the layout is complicated I think it's time saved. On Sep 19, 2013, at 6:18 PM, Brad O'Hearne br...@bighillsoftware.com wrote: On Sep 19, 2013, at 2:45 PM, Rick Mann rm...@latencyzero.com wrote: I am never able to get this shit right 100% of the time, and I don't know if it's because I'm doing something wrong, or iOS is broken and I need to do something else. As a second to Rick's request, auto-layout has given me fits on both iOS and OS X. I have not found the Auto-Layout Guide doc or various blog / other posts or WWDC sessions (unless I missed one that had this in it) on it to be a silver bullet. I find the pre-autolayout springs/struts approach to be easy to understand, but more importantly, it behaves consistently and the IB UI doesn't seem to get confused. With auto-layout, I've had no such success -- the IB UI seems to have a will of its own, and the UI seems to continually generate or change various things inexplicably in response to what are by all other indications proper constraints you create. If anyone out there has THE definitive guide on how to use auto-layout and accomplish various common use cases of relative resizing, you have money waiting in my wallet. Thanks, Brad ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/caoimghgin%40gmail.com This email sent to caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Still can't get autolayout to work the way I want
Yes, IB does automagically pop in constraints and for simple layouts, it works. But, with more complicated layouts, moving a single element around will rearrange one or more other constraints, generally breaking everything. I'm not familiar with the clear constraints command in IB, but like I was mentioning earlier, I'm avoiding the creation and use of .xib files for anything but the simplest layouts. Maybe iOS7 constraints have improved drastically, I just haven't had the time to dig into it. Anyway, this link is a nice intro into building UI from code with constraints... http://ioscreator.com/auto-layout-in-ios-6-adding-constraints-through-code/ On Sep 19, 2013, at 6:31 PM, Rick Mann rm...@latencyzero.com wrote: On Sep 19, 2013, at 15:29 , Kevin Muldoon caoimgh...@gmail.com wrote: I love the power of auto-layout, but I'll be damned if I can make it behave when working on the GUI .xib file. I've taken to using auto-layout without .xib, building the UI elements in the viewController.m and attaching NSLayoutContraints manually. It's a bit of a pain, but if the layout is complicated I think it's time saved. Does IB not put in any constraints when you lay out the basic nib? Or do you do the Clear Constraints command when you're done? Do you remove them programmatically? How do you deal with the autoresizing constraints iOS still seems to apply? -- Rick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: IB autolayout is impossible
For small elements, I have to agree. Programmatically creating NSLayoutConstraints is the only way to go, IMHO. Sent from my iPhone On Aug 19, 2013, at 7:49 PM, Rick Mann rm...@latencyzero.com wrote: On Aug 19, 2013, at 16:48 , dangerwillrobinsondan...@gmail.com wrote: In general in 4.x add your constraints that will make a satisfiable layout, then remove the ones you don't want. The next one does less trying without asking but this one is not that bad if people follow the flow: add yours, remove theirs. Yeah, this is precisely what I tried to do, and usually I can make that work. But not this time. I finally had to remove all my views and re-add them. -- Rick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/caoimghgin%40gmail.com This email sent to caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: If Statements In Objective C For IOS Development
I may not be reading this right, but it looks like you're doing math calc on the objects, rather than the values within the objects. See if this works for you… - (IBAction)nextButtonAction:(id)sender { int textFieldOneTextAsInteger = [self.textFieldOne.text integerValue]; int textFieldTwoTextAsInteger = [self.textFieldTwo.text integerValue]; int textFieldThreeTextAsInteger = [self.textFieldThree.text integerValue]; if (textFieldOneTextAsInteger * textFieldTwoTextAsInteger textFieldThreeTextAsInteger) { self.label.text = @One value; } else if (textFieldOneTextAsInteger * textFieldTwoTextAsInteger textFieldThreeTextAsInteger){ self.label.text = @Another value; } else { self.label.text = @They are the same value; } } On Jun 15, 2013, at 10:53 AM, Harmony Neil harmony.n...@gmail.com wrote: Hellow, I've been rewriting my IOS app (mainly because I had to) and got my 3 text fields: t1, t2, and t3 being what I'm calling them. I've also got a label on there. What I want to do is have it so that if t2 multiplied by t3 is greater than t1 the text on the label says one thing, if t2 multiplied by t3 is less than t1 the text on the label to say something else and if it is the same, say something else. However xcode doesn't like my if statement. it's complaining about the line: if (t2*t3t1) { self.label.text=@1 bit of text for example; } I've tried running the app, and xcode is complaining about the t1, t2 and t3 things in the if statement … Something about identifiers. The way I got round it before was to have 1 label showing the result of t2 multiplied by t3, then another label saying the text that I wanted, but I really want to make it tidier this time around. Can anyone help me fix this? And I didn't say can anyone suggest any books or whatever either. I'm tired of making my screen reader read long pages. Thanks for any code suggestions etc though, Harmony.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/caoimghgin%40gmail.com This email sent to caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: ARC Release too soon
I'd think adding the WindowController to a @property (strong, nonatomic) NSArray *array; would keep those objects alive. Most often, I would simply add each WindowController (or in my case, ViewController) one-at-a-time in the .h. I simply feel it's clearer to see. @property (strong, nonatomic) RJLarryViewController *larryViewController; @property (strong, nonatomic) RJCurleyViewController *curleyViewController; @property (strong, nonatomic) RJMoeViewController *moeViewController; On Mar 16, 2013, at 5:38 PM, Chris Paveglio chris_paveg...@yahoo.com wrote: Sure I totally understand that. My question is more of what is the most elegant way to do it. Add them to an array? - Original Message - From: iain i...@sleepfive.com To: Chris Paveglio chris_paveg...@yahoo.com Cc: Cocoa Dev List Cocoa-dev@lists.apple.com Sent: Saturday, March 16, 2013 2:35 PM Subject: Re: ARC Release too soon On 16 Mar 2013, at 06:16 PM, Chris Paveglio chris_paveg...@yahoo.com wrote: So, am I doing some fundamental window management wrong (not sure since old app worked OK and didn't seem to leak), or how do I do something so ARC doesn't dealloc window controllers at the end of the function that fires them off If you want the window controllers to hang around after the function finished you need to assign them to a strong variable otherwise they will be released. Iain ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/caoimghgin%40gmail.com This email sent to caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSData Mime Types...
I've developed an application using EDMessage Frameworks which sends emails with attached PDF to a OSX fax server (running 4-Sight FAX v 7.x). The fax server converts the attached PDF into a 1-bit tiff and sends it to a fax number specified in the body of the email. This email w/attachment works very well with all sorts of email systems, however the fax server 4-Sight FAX v 7.x rejects the EDMessage email saying it's not formatted properly. After examining the raw headers of a successful email-fax to 4-Sight FAX vs. an unsuccessful email-fax which EDMessage created, I have the following question. I suspect my Content-Type needs to be specified as Content-Type: application/pdf rather than Content-Type: application/octet-stream; What methods/techniques are available in NSData to set Mime-Types and other such things? Below is example of code I'm using with EDMessage. NSString *text = @Kevin Muldoon;Company;1-267-363-7401\r##\rMy fax cover letter!\r##\r; NSData *documentData =[NSData dataWithContentsOfFile:@/Users/kevin/ Documents/example.pdf]; NSMutableArray *attachmentList = [NSMutableArray array]; [attachmentList addObject:[EDObjectPair pairWithObjects:documentData:@example.pdf]]; NSMutableDictionary * headerFields = [NSMutableDictionary dictionary]; [headerFields setObject:@Kevin Muldoon caoimgh...@gmail.com forKey:EDMailFrom]; [headerFields setObject:@Center4Sight faxser...@center4sight.com forKey:EDMailTo]; [headerFields setObject:@Hi there, with attachment... forKey:EDMailSubject]; EDMailAgent *mailAgent = [EDMailAgent mailAgentForRelayHostWithName:@mail.centerforsight.net port:1234]; [mailAgent setUsesSecureConnections:NO]; [mailAgent sendMailWithHeaders:headerFields body:[text stringWithCanonicalLinebreaks] andAttachments:attachmentList]; And here is the raw result of that email which fails... --EDMessagePart-13136997390 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Kevin Muldoon;Company;1-267-363-7401 ## My fax cover letter! ## --EDMessagePart-13136997390 Content-Type: application/octet-stream; name=waitforit.pdf Content-Transfer-Encoding: base64 Kevin Muldoon e: caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSData Mime Types...
Alright. Makes sense. Thanks for replying everyone. On Aug 19, 2011, at 12:47 PM, Jens Alfke wrote: On Aug 19, 2011, at 5:51 AM, Kevin Muldoon wrote: I suspect my Content-Type needs to be specified as Content-Type: application/pdf rather than Content-Type: application/octet-stream; What methods/techniques are available in NSData to set Mime-Types and other such things? None. NSData is a simple uninterpreted blob of bytes. You’ll have to look at the docs for the EDMessage framework to see how you can customize the MIME type of your attachment. —Jens Kevin Muldoon e: caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Memory management and returned values from methods...
Hey guys, I know of at least one way to fix this memory leak but I'm hoping to find a few more ways. I'm chewing through a text file of 205,960 lines in a C while loop. All is good until MyObject returns a value. Of course the return value set to autorelease (Well, I suppose it would autorelease anyway if I just didn't copy, alloc or init), but the loop is going so rapidly it never actually releases. The program freezes before it's finished. I've avoiding garbage collection since I've started Obj-C but I know (or reasonably suspect) that I could simply - (NSString *)stopTheMemoryLeakAndKeepOnTruckin { NSAutoreleasePool *pool; pool = [[NSAutoreleasePool alloc] init]; //do interesting things... [pool drain]; return [result autorelease]; } However, there must be a better way than giving up control of releasing my objects to NSAutoreleasePool. I appreciate ya'll weighing in on the subject. A small example program below... // // AppController.m // Kvorkian // @implementation AppController NSString *filePath @/Users/username/output.txt NSMutableArray *objectArray = [[NSMutableArray alloc] init]; FILE *filePointer; char buffer[BUFSIZ] = Garbage; filePointer = fopen([filePath UTF8String], r); while (fgets(buffer, sizeof(buffer), filePointer) != NULL) { NSString *line = [[NSString alloc] initWithString:[NSString stringWithFormat:@%s, buffer]]; MyObject *myObject = [[MyObject alloc] initWithString:line]; //Do some very interesting things with the line in myObject... [myObject doAnInterestingMethod]; NSString * iNeedThisString = [myObject makeAMemoryLeakAndDriveMeCrazy]; [myObject release]; [line release]; } @end // // MyObject.m // Kvorkian // - (id)init {/**/}; - (id)initWithString {/**/}; - (void)doAnInterestingMethod {/**/}; - (NSString *)makeAMemoryLeakAndDriveMeCrazy { //do interesting things... return [result autorelease]; } @end Kevin Muldoon e: caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Memory management and returned values from methods...
You make a very compelling point. On Jul 15, 2011, at 4:36 PM, Scott Ribe wrote: On Jul 15, 2011, at 1:38 PM, Kevin Muldoon wrote: However, there must be a better way than giving up control of releasing my objects to NSAutoreleasePool. How is this giving up control? There's always an NSAutoreleasePool provided by the run loop which cleans up between handling events; all you're doing is adding one that will clean up sooner. -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice Kevin Muldoon e: caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Cocoaheads?
meetup.com probably has a group listed near you. On Jul 13, 2011, at 8:38 PM, WT wrote: On 14 Jul 2011, at 01:23, William Squires wrote: Sorry about the post - if there's an appropriate Apple list for info on Cocoaheads clubs is/are, please direct me there. I'm interested to see if there's one here in San Antonio, TX, USA. Google is your friend. Search for cocoaheads (sans quotes) and it's the very top result. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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/caoimghgin%40gmail.com This email sent to caoimgh...@gmail.com Kevin Muldoon e: caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Adding Spotlight comment data to folder/file
Would like to get/set Spotlight comments into directories and files. I thought this would have been the easy part. Kevin Muldoon e: caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Adding Spotlight comment data to folder/file
Oh my dear lord above. I think I'll one line it with a scripting bridge call. If it works. On Jul 11, 2011, at 7:57 PM, Wim Lewis wrote: On 11 Jul 2011, at 12:05 PM, Kevin Muldoon wrote: Would like to get/set Spotlight comments into directories and files. I thought this would have been the easy part. IIRC you can read them pretty easily as the kMDItemFinderComment metadata attribute. Setting them is harder. The comments are stored in two places, AIUI --- an extended file attribute (com.apple.metadata:kMDItemFinderComment xattr) and in the .DS_Store file (maybe only on older OS revisions) --- neither of which seem like things other apps should mess with directly. I think the most-nearly-supported way to do this is still to send an aevt to the Finder (set the comt property of the file to the text you want). Some example code here, though be aware it was mostly written in the 10.4 timeframe: https://github.com/omnigroup/OmniGroup/blob/master/Frameworks/OmniAppKit/OpenStepExtensions.subproj/NSFileManager-OAExtensions.m Technote 2045 seems to have vanished softly and silently away from the web, but it's still available in Xcode's embedded document viewer. Kevin Muldoon e: caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Adding Spotlight comment data to folder/file
Program is a drag/drop app that asks user for the work order number and creates a directory structure customized for the client. Submitted files are copied into a date stamped folder within that job 'Supplied Folder'. I thought it would be handy to place user name/computer name which used the program within the comments field of that date stamped folder, therefore giving an extra level of tracking should it be needed. I mention spotlight because that is what the comments field is now labeled as you hit command-i on a file/folder. I'm leery of calling AS through ScriptingBridge since the directories are created programmatically in Obj-C. I have experienced Apple Events not recognizing the presence of files/folder created by, lets say a shell script, until some moments later. Well, as I indicated, it's only a bit of icing on the cake. I'm just a bit shocked such an trivial task in a scripting language requires such heavy lifting in Obj-C (or more accurately, C). On Jul 11, 2011, at 8:17 PM, Kyle Sluder wrote: On Mon, Jul 11, 2011 at 5:07 PM, Kevin Muldoon caoimgh...@gmail.com wrote: Oh my dear lord above. I think I'll one line it with a scripting bridge call. If it works. The bigger question is why you want to put stuff in this field? It's intended for the user. If you want to generate additional Spotlight data, you should write a Spotlight importer. --Kyle Sluder Kevin Muldoon e: caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Loading Nibs which are self-ref
Yes, that was a typo. My email was acting weird. So, I'm not entirely certain Wim. I kinda feel I'm caught between the xCode 3 way of doing things and xCode 4 (and all the variants in between). Seems Obj-C/Cocoa is changing so fast I'm just not sure which way is right. Specifically, when using Andrew Stones method, I would expect I could access the UI elements of the window...uhm...somehow. That I could call the object I attached to the nib and hide the window. Or get the string value of a NSText field. So far, I'm stumped. There was an xCode example which I think would clear things up for me but this no longer exists. Possibly for good reason. /Developer/Examples/InterfaceBuilder/SimpleMultiWindow Anyway, I'd be happy to raw nib load as I was leaning towards or even NSWindowController...I just want to remove my working code from my AppController (or whatever it's called in later xCodes) and place it where it makes more sense. So it will have a semblance of reusability rather than entwined into 'main'. Thanks for the responses guys. Maybe google will be kinder to me as I dive back into it. If ya'll have any places you'd like to point me, I'll happily check it out. On Wed, Jul 6, 2011 at 9:11 PM, Wim Lewis w...@omnigroup.com wrote: On 6 Jul 2011, at 2:43 PM, Kevin Muldoon wrote: I'm seeking to do a copyObject class that has it's own progress window. So, I'm doing my research and I see a technique for loading a nib with an object, like so... MyDocument *myDocument = [[MyDocument alloc] init]; [NSBundle loadNibNamed:@MyDocument owner:myDocument]; [owner:myDocument doAnInterestingMethodToTheWindow]; Now, this looks like it's the compartmentalization I want when building UI! Andrew Stone takes things even father. http://www.stone.com/The_Cocoa_Files/Doing_Objects_Right.html So, I've been banging away at this for 10+ hours and things aren't working quite as expected. Given all the changes in xCode/Cocoa in the last 2 years, I'm wondering if I'm looking at antiquated techniques and need to be looking elsewhere for handling multiple windows. That looks right to me (assuming the third line's owner: is a typo). Though as Jens Alfke says, if you make your owner object a subclass of NS{View,Window}Controller it will take care of some housekeeping for you. In what way is it not working as expected? Are you checking the results of loadNibNamed:, etc? Are your owner object's outlets being set to the correct non-nil objects instantiated from the nib? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Loading Nibs which are self-ref
Realizing I'm not making myself very clear. I have two questions. We have an application called WindowWindow with two classes. AppController.m (which is linked as a delegate of Files Owner) SecondWindow.m (as a subclass of NSWindowController with an init method calling self = [super initWithWindowNibName:@SecondWindow owner:self];) 1) So, how exactly is SecondWindow.m going to know about and act upon a NSButton or NSTextField within in the SecondWindow.xib? 2) Shouldn't [secondWindow close] be working just as [secondWindow window] is working? For some reason, [secondWindow close] isn't working at all. At least the documentation says this is how it's done. // // SecondWindow.h // WindowWindow // @interface SecondWindow : NSWindowController { } - (id)init; @end // // SecondWindow.m // WindowWindow // #import SecondWindow.h @implementation SecondWindow - (id)init { self = [super initWithWindowNibName:@SecondWindow owner:self]; if (self != nil) { NSLog(@SecondWindow super initWithWindowNibName success...); } else { NSLog(@SecondWindow had trouble loading/init...); } return self; } // // AppController.m // WindowWindow // #import AppController.h @implementation AppController @synthesize secondWindow; - (void)applicationDidFinishLaunching:(NSNotification *)notification { secondWindow = [[SecondWindow alloc] init]; [secondWindow window]; // this activates the window. Documentation says it should and it does. // I placed a 3 second NSTimer here just to be sure it wasn't a timing issue. [secondWindow close]; } On Jul 7, 2011, at 8:03 AM, Kevin Muldoon wrote: Yes, that was a typo. My email was acting weird. So, I'm not entirely certain Wim. I kinda feel I'm caught between the xCode 3 way of doing things and xCode 4 (and all the variants in between). Seems Obj-C/Cocoa is changing so fast I'm just not sure which way is right. Specifically, when using Andrew Stones method, I would expect I could access the UI elements of the window...uhm...somehow. That I could call the object I attached to the nib and hide the window. Or get the string value of a NSText field. So far, I'm stumped. There was an xCode example which I think would clear things up for me but this no longer exists. Possibly for good reason. /Developer/Examples/InterfaceBuilder/SimpleMultiWindow Anyway, I'd be happy to raw nib load as I was leaning towards or even NSWindowController...I just want to remove my working code from my AppController (or whatever it's called in later xCodes) and place it where it makes more sense. So it will have a semblance of reusability rather than entwined into 'main'. Thanks for the responses guys. Maybe google will be kinder to me as I dive back into it. If ya'll have any places you'd like to point me, I'll happily check it out. On Wed, Jul 6, 2011 at 9:11 PM, Wim Lewis w...@omnigroup.com wrote: On 6 Jul 2011, at 2:43 PM, Kevin Muldoon wrote: I'm seeking to do a copyObject class that has it's own progress window. So, I'm doing my research and I see a technique for loading a nib with an object, like so... MyDocument *myDocument = [[MyDocument alloc] init]; [NSBundle loadNibNamed:@MyDocument owner:myDocument]; [owner:myDocument doAnInterestingMethodToTheWindow]; Now, this looks like it's the compartmentalization I want when building UI! Andrew Stone takes things even father. http://www.stone.com/The_Cocoa_Files/Doing_Objects_Right.html So, I've been banging away at this for 10+ hours and things aren't working quite as expected. Given all the changes in xCode/Cocoa in the last 2 years, I'm wondering if I'm looking at antiquated techniques and need to be looking elsewhere for handling multiple windows. That looks right to me (assuming the third line's owner: is a typo). Though as Jens Alfke says, if you make your owner object a subclass of NS{View,Window}Controller it will take care of some housekeeping for you. In what way is it not working as expected? Are you checking the results of loadNibNamed:, etc? Are your owner object's outlets being set to the correct non-nil objects instantiated from the nib? Kevin Muldoon e: caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Loading Nibs which are self-ref
My God that knowledge was hard won. Still, I'm getting some unresponsive behavior. The usual way: You declare the button as an IBOutlet in SecondWindow’s instance variable declarations, and wire it up to the actual control in IB. Yes, this works now that I have wired window to NSWindowController via inherited 'window' outlet and set delegate to controller. I just wasn't grokking. Partially because of this next question. Can I (or should I) hook up File's Owner as I would a subclass of NSWindowController? Thereby skipping creating a new object- subclassing as SecondWindow? That seems 'right'. That nicely separates my code from my UI, making it (bit) more portable, but may be contributing to unresponsive behavior. For instance...This code will update NSTextField with text... secondWindow = [[SecondWindow alloc] init]; [secondWindow setStringValueOfMyTextField:@Hello! I am SecondWindow! I am very glad to meet you.]; [secondWindow showWindow:secondWindow]; This code will NOT update NSTextField with text... secondWindow = [[SecondWindow alloc] init]; [secondWindow showWindow:secondWindow]; [secondWindow setStringValueOfMyTextField:@Hello! I am SecondWindow! I am very glad to meet you.]; Thanks for the assistance. I'm looking forward to getting to the part which started me doing this part. On Jul 7, 2011, at 12:17 PM, Jens Alfke wrote: On Jul 7, 2011, at 5:03 AM, Kevin Muldoon wrote: I don’t see a difference. Xcode is just a tool; it doesn’t dictate the ways you develop code. If anything, it’s the releases of the OS that introduce and deprecate ways of doing things. And both NSWindowController and manual nib loading have been around forever. 1) So, how exactly is SecondWindow.m going to know about and act upon a NSButton or NSTextField within in the SecondWindow.xib? The usual way: You declare the button as an IBOutlet in SecondWindow’s instance variable declarations, and wire it up to the actual control in IB. 2) Shouldn't [secondWindow close] be working just as [secondWindow window] is working? Actually calling -window isn’t the right way to show the window. All it does is cause the window to be loaded; this may or may not cause the window to be visible depending on how you set the ‘visible at launch time’ flag on the window in IB. Usually you want this flag to be false so that NSWindowController can customize the window bounds (tiling or restoring) before it’s displayed. If you want to show the window, call -showWindow:. For some reason, [secondWindow close] isn't working at all. At least the documentation says this is how it's done. Hm. My first guess is that you didn’t wire up the window to the NSWindowController’s inherited ‘window’ outlet. Lots of things won’t work unless you do this. (You also have to wire up the window’s delegate to the controller.) —Jens Kevin Muldoon e: caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Loading Nibs which are self-ref
Well, I suppose that's what attracted me to this technique. When we call... secondWindow = [[SecondWindow alloc] init]; The init method within SecondWindow does this... self = [super initWithWindowNibName:@SecondWindow owner:self]; Meaning the Files Owner is SecondWindow -- because it was initialized that way. Now, if common practice is to make the new nib in IB, then create a new NSObject instance within that nib and then subclass said instance to SecondWindow, I'm not sure what benefit initWithWindowNibName@nameOfNib owner:instantiatedObject would have in the real world. It is interesting to note that subclassing FileOwer to SecondWindow actually does work. Outlets and Actions are seen and can be wired up in IB, forgiving any oddness I described which may or may not be odd at all. Am I thinking too differently here? On Jul 7, 2011, at 5:36 PM, Jens Alfke wrote: On Jul 7, 2011, at 12:45 PM, Kevin Muldoon wrote: Can I (or should I) hook up File's Owner as I would a subclass of NSWindowController? Thereby skipping creating a new object-subclassing as SecondWindow? That seems 'right'. That nicely separates my code from my UI, making it (bit) more portable, but may be contributing to unresponsive behavior. I’m sorry, I don’t understand what you’re asking. The class of the Files’ Owner object should be set to your NSWindowController subclass. You don’t add any custom object to the nib for the window controller. The “File’s Owner” pseudo-object in the nib is a placeholder for the pre-existing object specified as the owner when the nib is loaded; it’s not an object loaded by the nib. The purpose of that object is so that outlets in that object can be hooked up, and so objects from the nib can be pointed at it. For instance...This code will update NSTextField with text... secondWindow = [[SecondWindow alloc] init]; [secondWindow setStringValueOfMyTextField:@Hello! I am SecondWindow! I am very glad to meet you.]; [secondWindow showWindow:secondWindow]; This code will NOT update NSTextField with text... secondWindow = [[SecondWindow alloc] init]; [secondWindow showWindow:secondWindow]; [secondWindow setStringValueOfMyTextField:@Hello! I am SecondWindow! I am very glad to meet you.”; Both of those should work correctly. —Jens Kevin Muldoon e: caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Loading Nibs which are self-ref
Ahh. Yes. I see what you're saying. And maybe you see where I was confused. This GUI approach to hooking up code/UI is nifty, but extremely difficult to explain/comprehend. As to xCode2,xCode3,xCode4, you'll notice one of the first things we used to have to do was create an AppController, then create an NSObject in IB and then make it a subclass of AppController and then hook it as a delegate of File Owner. That was annoying, and in later additions of xCode, the AppDelegate is automagically created and xCode encouraged developers to access UI elements via separate Controller objects. This makes sense and I wanted to do just that, but you'll notice nobody ever mentions subclassing the File's Owner of SecondWindow.nib to the SecondWindow.m the window is supposed to be controlled by. As if to say this would be explaining how exactly to breathe. On Jul 7, 2011, at 5:36 PM, Jens Alfke wrote: On Jul 7, 2011, at 12:45 PM, Kevin Muldoon wrote: Can I (or should I) hook up File's Owner as I would a subclass of NSWindowController? Thereby skipping creating a new object-subclassing as SecondWindow? That seems 'right'. That nicely separates my code from my UI, making it (bit) more portable, but may be contributing to unresponsive behavior. I’m sorry, I don’t understand what you’re asking. The class of the Files’ Owner object should be set to your NSWindowController subclass. You don’t add any custom object to the nib for the window controller. The “File’s Owner” pseudo-object in the nib is a placeholder for the pre-existing object specified as the owner when the nib is loaded; it’s not an object loaded by the nib. The purpose of that object is so that outlets in that object can be hooked up, and so objects from the nib can be pointed at it. For instance...This code will update NSTextField with text... secondWindow = [[SecondWindow alloc] init]; [secondWindow setStringValueOfMyTextField:@Hello! I am SecondWindow! I am very glad to meet you.]; [secondWindow showWindow:secondWindow]; This code will NOT update NSTextField with text... secondWindow = [[SecondWindow alloc] init]; [secondWindow showWindow:secondWindow]; [secondWindow setStringValueOfMyTextField:@Hello! I am SecondWindow! I am very glad to meet you.”; Both of those should work correctly. —Jens Kevin Muldoon e: caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Loading Nibs which are self-ref
I'm seeking to do a copyObject class that has it's own progress window. So, I'm doing my research and I see a technique for loading a nib with an object, like so... MyDocument *myDocument = [[MyDocument alloc] init]; [NSBundle loadNibNamed:@MyDocument owner:myDocument]; [owner:myDocument doAnInterestingMethodToTheWindow]; Now, this looks like it's the compartmentalization I want when building UI! Andrew Stone takes things even father. http://www.stone.com/The_Cocoa_Files/Doing_Objects_Right.html So, I've been banging away at this for 10+ hours and things aren't working quite as expected. Given all the changes in xCode/Cocoa in the last 2 years, I'm wondering if I'm looking at antiquated techniques and need to be looking elsewhere for handling multiple windows. Kevin Muldoon e: caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Reading Adobe Photoshop header, Obj-C
Was writing a program to create thumbnails using SIPS, GhostScript, ImageMagick. During testing I found I needed to read the header file of Adobe Photoshop native documents directly because Duotone image color mode simply wasn't returning the proper color mode (in a variety of programs). So I threw together this bit of code which works great for the first tag, but // References //http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/PhotoshopFileFormats.htm#50577409_pgfId-1055726 //http://www.adobe.com/content/dam/Adobe/en/devnet/photoshop/psir/ps_image_resources.pdf NSFileHandle *fileHandler = [NSFileHandle fileHandleForReadingAtPath:@/Users/kevin/Desktop/balloon.psd]; NSData *psdFileHeader = [NSData dataWithData:[fileHandler readDataOfLength:26]]; // read entire PSD header NSData *signature = [psdFileHeader subdataWithRange: NSMakeRange(0,4)]; NSData *version = [psdFileHeader subdataWithRange: NSMakeRange(4,2)]; NSData *reserved = [psdFileHeader subdataWithRange: NSMakeRange(6,6)]; NSLog(@Raw string is '%s' (length %d)\n, [signature bytes], [signature length]); NSLog(@Raw string is '%s' (length %d)\n, [version bytes], [version length]); NSLog(@Raw string is '%s' (length %d)\n, [reserved bytes], [reserved length]); As you can see from the output, the 'version' 'reserved' isn't being read at all. Must I coerce/parse something here? Much thanks... [Session started at 2011-06-28 09:14:31 -0400.] 2011-06-28 09:14:31.458 Read Standard Input[65929:10b] Raw string is '8BPS' (length 4) 2011-06-28 09:14:31.460 Read Standard Input[65929:10b] Raw string is '' (length 2) 2011-06-28 09:14:31.460 Read Standard Input[65929:10b] Raw string is '' (length 6) Kevin Muldoon e: caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Reading Adobe Photoshop header, Obj-C
Hey Jens, I suppose the trouble here is that I'm familiar with Objective-C code and not so familiar with its parent, C. On Jun 28, 2011, at 1:00 PM, Jens Alfke wrote: On Jun 28, 2011, at 6:23 AM, Kevin Muldoon wrote: As you can see from the output, the 'version' 'reserved' isn't being read at all. Must I coerce/parse something here? Much thanks… I’m not familiar with the PSD format, but aren’t ‘version’ and ‘reserved’ binary? You’re printing them as C strings. Assuming ‘version’ is a 16-bit big-endian integer, you could read it like this: const uint8_t* bytes = [signature bytes]; uint16_t version = *(const uint16_t*)(bytes + 2); version = NSSwapBigShortToHost(version); Another way (that I often use) is to define a C struct that matches the fields and layout of the header, then cast the bytes to a pointer to that struct and read the fields. It makes your code look a lot cleaner, but you have to be careful to (a) make sure the compiler packs the struct fields properly, and (b) you byte-swap all integer/float fields appropriately. —Jens Kevin Muldoon e: caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Reading Adobe Photoshop header, Obj-C
No problem at all. I'll pick up Kernighan Ritchie. Thanks for reply. On Jun 28, 2011, at 1:17 PM, Jens Alfke wrote: On Jun 28, 2011, at 10:11 AM, Kevin Muldoon wrote: I suppose the trouble here is that I'm familiar with Objective-C code and not so familiar with its parent, C. Yeah, unfortunately Objective-C does not absolve you of having to know C. With where you’re going, I’d suggest cracking open Kernighan Ritchie or some other good C book. (It’s a shame Cocoa doesn’t have more powerful stream APIs, or some equivalent of Perl/PHP/Ruby’s ‘unpack’ function, that would let you do this kind of stuff without needing to do pointer grunge. For some reason streams have always been a primary Achilles’ heel of Cocoa. I’ve been coding in it for ten years and I still never use NSFileHandle — if I have to stream data to/from files I just drop down to ANSI C or POSIX I/O calls.) —Jens Kevin Muldoon e: caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Retrieve NSTable DataSource from AppController
Basic stuff, I'm sure, but I'm stumped after several hours of googling... I have an NSTable which receives its dataSource from MyTableController.m. However, my AppController.m needs the data MyTableController.m holds. Since AppController.m hasn't explicitly instantiated MyTableController (MyTableController being an NSObject within IB with appropriate delegates and such) how does AppController.m access MyTableController.m data? Thanks for the help. http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/TableView/Tasks/UsingTableDataSource.html#//apple_ref/doc/uid/2117-BBCBHIJJ Kevin Muldoon e: caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
EDMessage, Symlinks zip files
Hello all, After importing the EDMessage Framework and adding a build phase to copy the framework, I found it worked very well. However, when I attempted to .zip the compiled app to send via email, my Finder hiccuped ( All Finder windows closed at once and no zip file to be seen). I decided I'd make a Package in PackageMaker and it too hiccuped but it did manage to display a dialog saying something about Symlinks. For the record, StuffIt handled the file without complaint. Anyway, what's with this behavior? Is this unique to EDMessage or do all imported frameworks have this non-zipping, symlinking behavior? Kevin Muldoon e: caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Aliases with NDAlias not appearing where I tell them to be.
Much thanks for the information everyone. Invaluable stuff, and I finally have the behavior I was looking for. I'm still fuzzy on the real function of 'fromPath:'. It's equiv in FSNewAlias() appears to be fromFile which is defined as 'A pointer to the starting point for a relative search...' and could be given a NULL value (at least in fromFile). Of course my fuzziness on 'relative search' may stem from my complete non-understanding of 'alias records'. It's all quite overwhelming really. @Sean -- My suggestion to change the var name 'aliasFilePath' to 'aliasFileName' stemmed from not 'grokking' that a path COULD go there. I even think it SHOULD go there. I may recommend changing it back to it's original name and for clarity sake, perhaps building an explicit path to the alias much as is done with the path to the file it points to [ kDirOfTestProject stringByAppendingPathComponent:kTestFileName]. On the other hand, since I appear to be the only person in the world who was confused, please take that suggestion with a 20lb grain of salt. Alright. Back to the salt mines. On Thu, Apr 28, 2011 at 2:48 PM, Sean McBride s...@rogue-research.comwrote: On Thu, 28 Apr 2011 14:05:46 -0400, Kevin Muldoon said: [[NSWorkspace sharedWorkspace] selectFile:aliasFilePath inFileViewerRootedAtPath:@]; This was wrong though, as 'aliasFilePath' was not a full path. I've fixed that in git. -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Aliases with NDAlias not appearing where I tell them to be.
FSNewAlias() huh? I'll take a look. So, you think I'm reversing the 'fromFile' parameter with 'aliasWithPath' ? That would be embarrassing! Still, the example code shows the following... NSString * kDirOfTestProject = @~/Developer/Projects/NDAlias/; // you need to change this to the location of NDAlias NSString * filePath = @Test File.txt, * folderPath = @Test Folder, * aliasFilePath = @AliasFile; testCreatingAliasFileFor( [[kDirOfTestProject stringByAppendingString:filePath] stringByExpandingTildeInPath] ); void testCreatingAliasFileFor( NSString * aFilePath ) { if( [[NDAlias aliasWithPath:aFilePath fromPath:NSHomeDirectory()] writeToFile:aliasFilePath] ) { printf(I have created an alias file for\n\t%s.\n, [aFilePath fileSystemRepresentation]); [[NSWorkspace sharedWorkspace] selectFile:aliasFilePath inFileViewerRootedAtPath:@]; } else { printf(Alias file creation failed.\n); } } or in other words.. The variable aFilePath passed into the function testCreatingAliasFileFor() is clearly the full path of the file I want an alias of. The NSHomeDirectory() at fromPath is clearly the path to the users home directory. The variable aliasFilePath (which should be renamed to something like aliasFileName) is the name of the alias file that writeToFile needs, apparently stringing fromPath of the method it's wrapped around. Anyway, thanks for the rant! I very much appreciate a historical perspective on things. I'll keep banging away it when time permits. On Thu, Apr 28, 2011 at 9:54 AM, Sean McBride s...@rogue-research.comwrote: On Wed, 27 Apr 2011 18:17:21 -0400, Kevin Muldoon said: Alias file! I've not used NDAlias for alias files, only for alias records. I just looked at the example, and it does seems somewhat crusty. Still, I think you are misunderstanding the 'fromFile' parameter. Have you read Apple's docs for FSNewAlias()? That should clarify things. I'll be pushing a couple of minor fixes to the example regardless. Just like one created when we option-drag files from one directory to another in the Finder. Command-option-drag. :) Yeah, I'd love to require 10.6 but not a fit for our environment. Honestly, I'm perplexed this feature hasn't already been packaged into the standard obj-c libraries until just now. The standard conspiracy theory is because aliases come from Classic Mac OS, and the unix/Cocoa folks hated everything from there, that they were never added. Whatever the delay, they are finally in Cocoa as of 10.6. Mysteriously, they decided to switch from the term 'alias' to 'bookmark' despite the term alias being consistently used in both the UI and API since System 7 (and the term 'alias' persists in the UI, and the term 'bookmark' is already overloaded). Rant over. :) -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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
Aliases with NDAlias not appearing where I tell them to be.
I hope some of you NDAlias users can lend a hand. Everything in the code looks right and everything in the Console looks right but instead of creating an alias on the Desktop, the alias is created next to the compiled program in the xcode project folder. #import Cocoa/Cocoa.h #import Alias.h int main (int argc, const char * argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSString *fileDirectory = @~/Documents/DustBin/20110322/152223/; NSString *fileName = @myFile.png; NSString *filePath = [[fileDirectory stringByAppendingString:fileName] stringByExpandingTildeInPath]; NSString *aliasDirectory = [[NSHomeDirectory() stringByAppendingPathComponent: @Desktop] stringByExpandingTildeInPath]; NSString *aliasName = @ANewAliasTo_myFile.png; NSString *aliasPath = [aliasDirectory stringByAppendingPathComponent: aliasName]; if( [[NDAlias aliasWithPath:filePath fromPath:aliasDirectory] writeToFile:aliasName] ) { NSLog(@Create an alias for...\n\t %@, filePath); NSLog(@And placed the alias here...\n\t %@, aliasPath); } else { NSLog(@Alias file creation failed); } [pool release]; return 0; } The Debugger has exited with status 0. [Session started at 2011-04-27 14:32:46 -0400.] 2011-04-27 14:32:46.261 NDAliasesURLProject[3514:10b] Create an alias for... /Users/kevin/Documents/DustBin/20110322/152223/myFile.png 2011-04-27 14:32:46.263 NDAliasesURLProject[3514:10b] And placed the alias here... /Users/kevin/Desktop/ANewAliasToMyFile.png ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Aliases with NDAlias not appearing where I tell them to be.
if( [[NDAlias aliasWithPath:filePath fromPath:aliasDirectory] writeToFile:aliasName] ) { Just following the example provided by creator of NDAlias. Yes, seems weird to me too. I'd post his example code but it's not very compact. I rewrote it for this forum so it could be understood easily. On Apr 27, 2011, at 3:09 PM, Quincey Morris wrote: On Apr 27, 2011, at 11:40, Kevin Muldoon wrote: NSString *aliasName = @ANewAliasTo_myFile.png; ... 2011-04-27 14:32:46.263 NDAliasesURLProject[3514:10b] And placed the alias here... /Users/kevin/Desktop/ANewAliasToMyFile.png This isn't your code. Look at the alias file name in the log and the file name in your code. That's probably not relevant to your problem, but posting log output is an implicit claim that it comes from the posted code. Everything in the code looks right ... This surely looks wrong: if( [[NDAlias aliasWithPath:filePath fromPath:aliasDirectory] writeToFile:aliasName] ) { That doesn't seem like a sensible value for 'fromPath', and I don't see NDAlias having a documented 'writeToFile' method at all, and (even if it did) shouldn't you be specifying 'aliasPath', not 'aliasName'? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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: Aliases with NDAlias not appearing where I tell them to be.
On Apr 27, 2011, at 3:14 PM, Fritz Anderson wrote: Also — though probably you're just doing it for the example — I don't recommend finding standard directories by concatenating literal strings. Pass the constant NSDesktopDirectory to NSSearchPathForDirectoriesInDomains(). You mean like so... NSArray * paths = NSSearchPathForDirectoriesInDomains (NSDesktopDirectory, NSUserDomainMask, YES); NSString * desktop_path = [paths objectAtIndex:0]; Yes, that looks much better. Thanks!___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Aliases with NDAlias not appearing where I tell them to be.
Hey Sean, Alias file! Just like one created when we option-drag files from one directory to another in the Finder. Yeah, I'd love to require 10.6 but not a fit for our environment. Honestly, I'm perplexed this feature hasn't already been packaged into the standard obj-c libraries until just now. On Apr 27, 2011, at 5:27 PM, Sean McBride wrote: On Wed, 27 Apr 2011 23:13:07 +0200, Peter Lübke said: Am 27.04.2011 um 21:09 schrieb Quincey Morris: ..., and I don't see NDAlias having a documented 'writeToFile' method at all, and (even if it did) ... It actually does, as I just found out looking at Nathan Day's homepage: http://homepage.mac.com/nathan_day/pages/source.xml But don't use that code. The newest is here: https://github.com/nathanday/ndalias On Wed, 27 Apr 2011 15:26:35 -0400, Kevin Muldoon said: You mean like so... NSArray * paths = NSSearchPathForDirectoriesInDomains (NSDesktopDirectory, NSUserDomainMask, YES); NSString * desktop_path = [paths objectAtIndex:0]; Better still, if you can require 10.6+ is to use URLs and not paths, in which case you'd use URLForDirectory:inDomain:appropriateForURL:create:error:. Kevin, are you trying to create an alias record or an alias file? -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post 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/caoimghgin%40gmail.com This email sent to caoimgh...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
LSUIElement making custom windows non-visible.
Writing a small app which completes a task, displays info in a custom semi-transparent NSPanel (based on http://mattgemmell.com/2006/03/12/hudwindow) and, after a few seconds, the NSPanel fades away and the program terminates. Works great but looking to get a more GROWL-like behavior by having the menu/dock icon non-visible on launch. My understanding is turning on LSUIElement in the pList is the method to make this happen. Unfortunately, this makes the NSPanel non-visible as well. Thanks for the help. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com