Re: stdout or stderr file path on iPhone?

2011-08-30 Thread Chris Markle
Manfred,

> Background: I have a third party library (that I am not allowed to change) 
> that logs to a file in Debug mode. I want to see this log output directly in 
> the Xcode console, because transferring log files from the iPhone is too 
> complicated. The library provides an API to set the file path (unfortunately 
> not a file handle or something else).

>From OS/X man pages and I'm thinking this probably works as well on
iOS, although I didn't test it:
http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man4/stdout.4.html

So e.g., stdout would be /dev/stdout. See if that works for you...

Chris
___

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

Please do not post 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


How to wait for methods with result/completion blocks to finish?

2011-03-07 Thread Chris Markle
This is on iOS... Say I have use a method that has some kind of
result/completion block like ALAssetsLibrary assetForURL In the
example below, in the assetForURL result block, the JPEG
representation of the asset is read into a buffer and the NSData form
of that buffer is assigned to a property. I need the property to be
set before my code continues past his point. How do I go about
accomplishing that? Am I forced to show a "waiting for xxx" view until
this finishes?

I tried surrounding the assetForURL call with a semaphore but this
does not work on the main app thread (the dispatch_semaphore_wait()
blocks the main thread and thus the dispatch_semaphore_signal() in the
resultBlock never gets to run to signal that the block is done).

I guess in general I an wondering how I correctly wait for things to
happen that I absolutely positively need to be done before I
continue...

Thanks in advance...

Chris

* * *

-(void)getJPEGFromAssetForURL:(NSURL *)url {
ALAssetsLibrary* assetslibrary = [[ALAssetsLibrary alloc] init];
[assetslibrary assetForURL:url
resultBlock: ^(ALAsset *myasset) {
ALAssetRepresentation *rep = [myasset defaultRepresentation];
Byte *buf = malloc([rep size]);
NSError *err = nil;
NSUInteger bytes = [rep getBytes:buf fromOffset:0LL
length:[rep size] error:&err];
if (err || bytes == 0) {
[...]
}
self.imageJPEG = [NSData dataWithBytesNoCopy:buf
length:[rep size] freeWhenDone:YES];
}
failureBlock: ^(NSError *err) {
NSLog(@"can't get asset %@: %@", url, err);
}];
[assetslibrary release];
}
___

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

Please do not post 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 wait for methods with result/completion blocks to finish?

2011-03-08 Thread Chris Markle
Matt, Kyle,

Thanks for the guidance and pointers to other doc. I am having trouble
wrapping my head around the asynch patterns, especially since I am
working with a code base that I inherited that is not doing a good job
of leveraging these patterns.

There are two cases (at least) in that app (which uploads images and
videos from the Photo Library or Camera using a proprietary protocol)
where it seems like we need to "wait". Maybe you can help me mentally
refactor these two...

1. Camera used to take picture or video (UIImagePickerController).
Want to save image that was taken to the camera roll like happens with
the camera app. That saving process starts when the user returns from
the camera. If they then go to the Photo Library (again with
UIImagePickerController), we don't let them do that until the image is
fully saved since we want them to be able to see them image in the
library that they just shot. So when they tap the "photo library"
button, we (as Kyle said) "throwing up a modal 'please wait' UI" until
the save to photo library function is completed, at which point we
show the photo library.

2. When all the picture taking or choosing from the library choosing
has happened, and the user ultimately has picked an image/video to
upload, they press "upload". If it's a video, we have the file already
that we need to transfer. But if it's an image we would like to get
the JPEG representation (via ALAsset / ALAssetRepresentation) into a
file so that we can transfer that file (the uploader system is
file-based). That's where some form of that code with the resultBlock
from my original post comes into play. It has the resultBlock that
returns the asset and I need to wait for that block to complete so
that I have the JPEG representation available that I can then put into
a file to transfer.

Any thoughts about how I can adjust my thinking and the app's design
to deal with these cases would help me understand this better.

Thanks in advance.

Chris
___

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

Please do not post 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 wait for methods with result/completion blocks to finish?

2011-03-09 Thread Chris Markle
Matt, Kyle,

Thanks for taking your time to give me your thoughts on this. It's
good food-for-thought and "thought" is what I need now... Thanks!

Chris
___

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

Please do not post 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


Seeking advice for how to implement "notification" upon completion of asynchronous upload

2011-03-31 Thread Chris Markle
Still fairly new here to iOS and Objective-C programming, so looking
for some advice to help keep me from going down the wrong road(s)... I
would like to build an Objective-C class or classes to perform a file
upload using a non-standard protocol. It would run the upload
asynchronously and would need to notify the caller upon completion. I
see a variety of techniques used or discussed for this and I was
hoping to get some advice on which pattern or patterns I should use
and which I should stay away from. I have no issue with using stuff
that only runs on the latest iOS or OS X systems, so supporting older
OS's in not a concern for me.

I see in particular:

1. delegates - e.g., NSURLConnection connection:didFailWithError: and
connectionDidFinishLoading:, or similar ones in ASIHTTPRequest
requestFinished or requestFailed

2. blocks - e.g., ASIURLRequest completionBlock or failedBlock, or
ALAssetsLibrary assetForURL:resultBlock:failureBlock: (ASIHTTPRequest
actually implements delegates and blocks and allows you to mix and
match them.)

3. KVO (key-value observation) - e.g., some service where you observe
an isFinished property

4. Notifications (NSNotificationCenter, etc.) - haven't really seen
this used much but a lot of people seem to talk about it as a good
approach

There are probably other techniques as well...

For a new, modern API which approach or approaches should I use or not
use? I suppose my main interest here is to use something that's
flexible to the programmer that uses my API, and something that is
conventional ion its approach so that the programmer is using
something normal and not unusual.

Thanks in advance for any counsel on this...

Chris
___

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

Please do not post 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: Seeking advice for how to implement "notification" upon completion of asynchronous upload

2011-04-01 Thread Chris Markle
WT,

Thanks for the code! So of the approaches:

>> 1. delegates
>> 2. blocks
>> 3. KVO
>> 4. Notifications

you went with delegates (didFinishDownloadingData: and
failedWithError:) for completion notification.

Has this worked out well for others that have used this code? Did you
consider any of the other alternatives and if so what made you go with
the delegate approach?

Chris
___

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

Please do not post 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


Has anyone used the VOIP background mode for a non-VOIP app?

2011-05-17 Thread Chris Markle
The "App Store Review Guidelines" state (2.16) that "Multitasking apps
may only use background services for their intended purposes: VoIP,
audio playback, location, task completion, local notifications, etc."

There is a background mode plist key (UIBackgroundModes="voip") for
apps that provide VOIP services, allowing the app to continue to
handle listening and data sockets while in the background. In the
discussion for UIBackgroundModes, the doc states that: "These keys
should be used sparingly and only by applications providing the
indicated services."

All this taken together suggests that I shouldn't use this key for
"voip" unless I am specifically a VOIP application, or else risk App
Store rejection.

Is anyone using this form of background mode in an non-VOIP app that's
in the app store?

Fwiw I would like to be able to run in the background enough to be
able to send and receive SSH-level keepalives so that I can keep an
SSH session open, given that it's costly to setup in the first place
(imho).

Thanks in advance...

Chris
___

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

Please do not post 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: Has anyone used the VOIP background mode for a non-VOIP app?

2011-05-17 Thread Chris Markle
Steve,

> This is a psychological quiz, right? Let's see if someone, who managed to 
> violate
> the guidelines and GET AWAY with it, will come on a public list and admit to 
> it.

Yeah I wondered about that... They could always reply directly to me -
I don't work for Apple. For a small fee I could keep their secret ;)

Chris
___

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

Please do not post 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


Hints for supporting dragging a file onto the dock icon, then onto a row in menu presented at that point?

2012-09-13 Thread Chris Markle
I'm pretty new to OS X development and just looking for hints about
how to do something like this... I saw an app called Dragster that
allows you to drag a file over the dock icon for the app, at which
point a menu of rows opens up form the app icon, and you can continue
to drag the file over a particular row. I'd like to emulate that
notion of dragging a file over the dock icon, then over a row in a
menu presented from the icon.

So far I've played with:

1. Using the openFile: and openFiles: NSApplication delegates to let
me handle dragging a file over the icon and handling that.

2. Modifying the dock menu to add items and separators to the dock
menu (at least simple cases). But what I notice here is that this menu
if presented on a two-fingered click of the doc icon, not presented
when I drag the file over the dock icon.

How do I get the or a menu to show when I drag the file onto the icon?
Then, once I get a menu showing, how do I get to the point where I can
drag the file onto a row in the menu?

I'm perfectly fine with pointers for things and areas to look at
relative to this... Thanks in advance!

Chris
___

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

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


Anyone able to get __crashreporter_info__ to work on iOS?

2013-02-27 Thread Chris Markle
In "Application Specific Crash Report Information"
(http://mjtsai.com/blog/2013/02/27/application-specific-crash-report-information/)
Michael Tsai notes:

* * * his comments * * *
Wil Shipley shows how an application can add information to a crash
log by assigning to a special string variable. I see the same
technique used in Apple’s source for configd:

/* CrashReporter info */
const char *__crashreporter_info__ = NULL;
asm(".desc ___crashreporter_info__, 0x10");

I also like to use -[NSThread setName:].
* * * end of his comments * * *

I tried this on iOS and did not see any change to a crash report, at
least when the crash report is viewed in Xcode Organizer > Device
Logs.

I basically made a single view iOS project and had this as my ViewController.m:

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
[super viewDidLoad];

// Do any additional setup after loading the view, typically from a nib.

[self addCrashreporterInfo];
[self crash];
}

static const char *__crashreporter_info__ = NULL;
asm(".desc ___crashreporter_info__, 0x10");

- (void)addCrashreporterInfo
{
__crashreporter_info__ = "TestApp 1.0.0";
}

- (void)crash
{
char *addr = 0;
*addr = 1;
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

@end

Anyone have any success using this on technique to annotate crash
reports on iOS?

Chris

___

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

Please do not post admin requests or moderator comments to the list.
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: Anyone able to get __crashreporter_info__ to work on iOS?

2013-02-27 Thread Chris Markle
Thanks for the followup Greg.

Chris

On Wed, Feb 27, 2013 at 5:05 PM, Greg Parker  wrote:
> On Feb 27, 2013, at 4:52 PM, Chris Markle  wrote:
>> Anyone have any success using this on technique to annotate crash
>> reports on iOS?
>
> The iOS crash reporter does not support these annotations. Sorry.
>
>
> --
> Greg Parker gpar...@apple.com Runtime Wrangler
>
>



--
Chris Markle
Aspera, Inc.
cmar...@asperasoft.com | 510-849-2386 x215
___

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

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


While we're on the subject of DMG's for software distribution...

2008-09-08 Thread Chris Markle
Hi Folks,

(Not super saavy about Mac OS X here so bear with me please...)

On the subject of DMG's... I inherited a software product that
currently ships using some moldy-oldy version of the Wise installer. I
think basically all it does is put the application _folder_ into the
Applications folder. In the application folder I am referring to is
the application bundle, some PDFs (doc) and a Plugins folder with one
plugin bundle in it. I think the application expects the plugins to be
in this specific place i.e., the Plugins folder in the applications
folder.

I'd prefer to ship this as a DMG... But if I understand DMG-based
delivery correctly, the idea is that Mac users are used to this and
"know" to copy the application bundle to the Applications folder. But
I need the user to copy the application folder (not just the bundle)
into the Applications folder. otherwise the plugin won't be found and
life as we know it will cease ;)

Is DMG just a non-starter for this or is there a way with a DMG format
to someone clue in the user that the folder needs to be copied, not
just the application bundle.

Thanks in advance...

Chris
___

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

Please do not post 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 [EMAIL PROTECTED]


How to create process independent of current process AND that takes command line arguments?

2008-04-03 Thread Chris Markle
Hi there,

Preferably using Cocoa stuff, how can I create a separate process that
is independent of my current process (that is I don't want the process
to be a child of my current process) AND that can take command line
arguments. I looked at NSTask and NSWorkspace classes and they don't
look like they can handle this. I am new to the platform so I easily
could have missed something. Thanks in advance!

Chris
___

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

Please do not post 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 [EMAIL PROTECTED]


Re: How to create process independent of current process AND that takes command line arguments?

2008-04-03 Thread Chris Markle
Chris S.,

>  Why do you not want it to be a child? The reason I ask is that if your
> requirement is that the spawned process isn't terminated when the parent
> dies, then NSTask will suffice. Whilst processes it spawns are children,
> they're in a different process group and session and so don't die when the
> parent dies.

I had assumed that the process would term (or hang) when the parent
died... Bad assumption I guess you're saying ;) If the NSTask spawned
process will stay up when the parent goes away, then that then I'll
take a closer look at that. Thanks!

Chris 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 [EMAIL PROTECTED]


Re: How to create process independent of current process AND that takes command line arguments?

2008-04-03 Thread Chris Markle
Chris S.,

>  Why do you not want it to be a child? The reason I ask is that if your
> requirement is that the spawned process isn't terminated when the parent
> dies, then NSTask will suffice. Whilst processes it spawns are children,
> they're in a different process group and session and so don't die when the
> parent dies.

Is there anything special I need to specify or any particular
terminology for this that I should look for in the doc to get this
behavior (running in a different process group)? Thanks!

Chris 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 [EMAIL PROTECTED]


/Library/Logs vs. user/Library/Logs

2008-10-22 Thread Chris Markle
New to OS X development here... I see some things log to /Library/Logs
and others to user/Library/Logs (user=an individual account). I'm
thinking my app, which is a user-oriented app (not a system app) would
log to the user-specific location. Unless it's bad form to log there
and there is some other, more acceptable, best practice with respect
to log file location. So... is there a best practice? Is is documented
anywhere in Apple doc? Where should I go to read about accepted usage
of the /Library and user/Library directories and the files therein?
Thanks in advance. Chris
___

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

Please do not post 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 [EMAIL PROTECTED]


Re: /Library/Logs vs. user/Library/Logs

2008-10-23 Thread Chris Markle
Thanks guys. Good advice. Here's my summary of what you guys said:

1. Document to read: Low-Level File Management Programming Topics:
Locating Directories on the System
(http://developer.apple.com/documentation/Cocoa/Conceptual/LowLevelFileMgmt/Tasks/LocatingDirectories.html)

2. Putting logs into the ~/Library/Logs folder is a good choice. The
user running the application is more likely to have permission to
write files in that folder. People may be annoyed if  apps drop files
outside of the user's home directory.

3. Don't put logs in ~/Documents, as a some programs do.

4. One could consider as well: ~/Library/Application
Support//* .  It all depends on the sort of log, intended
use, length of keep, size, etc... (On my system, the files in here
look to be more like DB's, etc. as opposed to something transient like
a log file; moreover, ~/Library/Logs looks to be used specifically for
this purpose by some number of apps on my system.) Still, it's worth
noting the existence of this other directory.

Thanks again.

Chris
___

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

Please do not post 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 [EMAIL PROTECTED]


Re: /Library/Logs vs. user/Library/Logs

2008-10-23 Thread Chris Markle
Jason,

> Why not use ASL for logging? It's worked really well for me. I also have
> an Obj-C class you can use that wraps ASL if you want.

Right now our app runs (for better or for worse) on Windows and OS X
with lots of common code between the two. I think ASL might work in
the future as we become more and more OS X-aware. Thanks for the
tip...

Chris
___

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

Please do not post 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 [EMAIL PROTECTED]


PackageMaker installing into /Applications or ~/Applications depending on admin or not?

2008-12-07 Thread Chris Markle
We have an installer for our current app that use Vise. We'd like to
switch maybe to PackageMaker and its artifacts. One thing that the
Vise-created install does is get installed to /Applications if you're
and admin and to ~/Applications if you're a standard user. Does anyone
know if PackageMaker does the same thing? Or can it be motivated to do
so? I plan on trying this myself but I'm a PackageMaker newby and am
concerned about the influence of various settings on my experiments...

Chris
___

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

Please do not post 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 [EMAIL PROTECTED]


Get Info via OS X UI on app with changed version data still shows old value, unless copied, then it works

2008-12-09 Thread Chris Markle
Confused here about where "Get Info" on an app bundle gets its info...
I'm sure this is basic stuff for you guys, but I'm relatively new at
this.

I have a directory called say "AppDir" with an application bundle in
it called "App1". I altered the various version strings and what-not
in App1/Info.plist and App1/Resources/English.lproj/InfoPlist.strings
to newer values (just edited and saved them as appropriate). I then
did a Get Info on the App1 bundle and the General > Version data still
shows the _old_ data. Scratching my head as to why... Then I
duplicated App1 to "App1 copy" and tried a Get Info on the App1 bundle
in the duplicated directory. It shows the proper changed value in the
General > Version data.

So the original I manipulated always seems to show the old version
string data via Get Info but copies of the directory/app show the
changed value. Anyone know what's going on here?

Thanks in advance...

Chris
___

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

Please do not post 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 [EMAIL PROTECTED]