How to include UIColor picker in code-completion in Swift playgroundbook

2018-02-13 Thread John Michael Zorko

Hello, all …

A friend and I are creating a playgroundbook that allows users to write code to 
control, among other things, the color of an external device. We would like to 
use the UIColor picker box in the code-completion bar above the keyboard, but 
so far, the only way we know how to include it is to include everything, like 
so:

//#-code-completion(everything, show)

While this certainly works, it includes a bunch of other stuff that is 
overkill. Is there a way to specify, in addition to our own APIs (playSound() 
and setLightColor(), just the color picker? Something like:

//#-code-completion(playSound(), setLightColor(), UIColor(), show)

Regards,

John



___

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

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

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

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


xcodebuild and PMD

2015-11-26 Thread John Michael Zorko

Hello, all …

I’m exploring how to plug our iOS builds into our existing PMD-based code 
sniffing tool. We’re using Xcode 7.1.1. Is there a way that I can process 
xcodebuild’s output (or hook into the Xcode analyzer output) into a PMD XML 
file? I’m aware of OCLint, but we also have some Swift code (and there will 
only be more of it as time goes on).

Any help would be quite appreciated!

Regards,

John



___

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

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

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

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

Re: xcodebuild and PMD

2015-11-26 Thread John Michael Zorko
> On Nov 26, 2015, at 12:21 PM, Alex Zavatone  wrote:
> 
> What’s PMD?

https://pmd.github.io 


___

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

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

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

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

iOS:targeting iOS3 through iOS6

2012-09-21 Thread John Michael Zorko

Hello, all …

The iPhone5 and iOS6 is out now, so a client wants me to update the apps i've 
done for them. The thing is, they still have users on first-generation devices 
and iPhone 3Gs, so I need to make sure the apps still work there, while also 
taking advantage of the larger display of the new iPhone / iPod touch. I've 
kept Xcode 4.4.1 so I can target armv6, and i've Xcode 4.5 to target the new. 
I'm thinking i'll have to build these apps with 4.4.1, then again with 4.5, and 
lipo them together. Questions I have:

1. Is this correct? If not, how do I target old and new devices?
2. Are there examples that I could reference?

I appreciate any assistance / pointers :-)

Regards,

John

___

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

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

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

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

Xcode 4.3, XIB files and deployment target iOS 3.1

2012-07-06 Thread John Michael Zorko

Hello, all ...

I'm working on an app that has to work on first-gen iPod touch devices. I set 
the deployment target to 3.1 and made sure armv6 was specified such that my app 
now at least launches on said firstgen iPod touch. However, it hangs before 
showing the tab bar or first view controller:

viewController1 = [[[FirstViewController alloc] 
initWithNibName:@FirstViewController_iPhone bundle:nil] autorelease];
viewController2 = [[[SecondViewController alloc] 
initWithNibName:@SecondViewController_iPhone bundle:nil] autorelease];

self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.viewControllers = [NSArray 
arrayWithObjects:viewController1, viewController2, nil];   // HANGS HERE
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];

The view controllers are the Xcode-generated versions -- i've not added any UI 
elements yet. Though initWithNibName:bundle: is called on each VC, their 
viewDidLoad methods are _not_ called. Is there something special I need to do 
with the Xcode-generated XIB files in order to support iOS 3.1?

Regards,

John

___

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

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

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

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


iOS 5: iPod Library Access

2012-04-12 Thread John Michael Zorko

Hello, all ...

I'm trying to navigate the artists / albums / genres / etc. on a device. The 
documentation for this is usually easy to follow, but i'm finding it to be 
confusing regarding the concept of persistent IDs. I've a couple of questions:

1. What does and what does not have an MPMediaItemPropertyPersistentID?
a. Does each artist have one?
b. Does each album have one?
c. Does each genre have one?
d. Does each song / tv show / movie / audiobook / playlist / podcast / 
etc. have one?
e. Are these IDs unique across all collections i.e. will a specific 
album have the same persistent ID of, say, another artist or a song from 
another album?

2. Is it possible to find a particular artist / album / genre / etc. given only 
it's MPMediaItemPropertyPersistentID (assuming 1(e) is true)? If so, how? I see 
lots of examples for finding the albums of an artist, etc. given the artist 
name, album name, etc., but what if two artists have the same name, or 
different artists used the same title for their album? I'd like to use the 
MPMediaItemPropertyPersistentID, if possible, to make each search unambiguous. 
If this is possible, could someone point me at some example code that uses the 
MPMediaItemPropertyPersistentID to find a specific item?

Regards,

John, appreciative


___

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

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

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

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


iOS 5: iPod Library Access, pt 2

2012-04-12 Thread John Michael Zorko

Hello all,

Is an _artist_ an MPMediaItemCollection of albums, or an MPMediaItem / Entity? 
If the later, how do I get it's MPMediaItemPropertyPersistentID?

Is an _album_ an MPMediaItemCollection of songs, or an MPMediaItem / Entity? If 
the later, how do I get it's MPMediaItemPropertyPersistentID?

... and do the above answers also apply to movies, tv shows, podcasts, 
audiobooks, genres, etc.?

Regards,

John
___

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

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

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

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


iOS 5: AVFoundation and MPMediaItemPropertyAssetURL

2012-04-05 Thread John Michael Zorko

Hello, all ...

I'm experimenting with making AVFoundation play local [purchased from] iTunes 
content on the device. I can set up an MPMediaQuery to fetch the content like 
so:

MPMediaQuery *query = [[[MPMediaQuery alloc] init] autorelease];
[query addFilterPredicate:[MPMediaPropertyPredicate 
predicateWithValue:[NSNumber numberWithInt:MPMediaTypeTVShow] 
forProperty:MPMediaItemPropertyMediaType]];

... and if I go through the query's items array, I can get the name and asset 
URL:

for (MPMediaItem *item in [query items])
{
NSString *name = [item valueForProperty:MPMediaItemPropertyTitle];
NSURL *url = [item valueForProperty:MPMediaItemPropertyAssetURL];

NSLog(@ video name: %@ url: %@, name, url);
}

video name: Plague of Babies / Bloaty's Pizza Hog url: 
ipod-library://item/item.m4v?id=4414454911022643168

I then make an AVURLAsset from the URL and ask AVFoundation to load said URL 
(ipod-library://item/item.m4v?id=4414454911022643168) via AVURLAsset 
loadValuesAsynchronouslyForKeys. The block is called, I make an AVPlayerItem, 
AVPlayer, attach the player to an AVPlayerLayer, etc. Everything seems cool. I 
call play once the AVPlayerItem's status is AVPlayerItemStatusReadyToPlay. I 
even see the playbackLikelyToKeepUp. However, nothing plays -- I don't see any 
errors, just nothing. Am I missing something? This same approach works well 
when playing a video from the application bundle as well as videos from the 
interwebz ...

Regards,

John

___

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

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

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

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


iOS: This application needs location services / Allow / Don't Allow alert

2012-02-01 Thread John Michael Zorko

Hello, all ...

I've an issue that i'm trying to solve, and i've run into several walls. This 
app i'm working on requires Core Location, and on first install, iOS displays 
it's this app needs location services / Allow / Don't Allow alert. That's 
fine, but the issue is that my app's window's root view controller's 
viewDidLoad is called before the iOS-supplied alert is dismissed, and said 
viewDidLoad checks to see if CL is enabled and shows it's own alert if not. The 
result: once the user dismisses the iOS-supplied alert by tapping Allow, the 
alert that my view controller created is shown (because when my view controller 
did the CL check, the user hadn't dismissed the iOS-supplied alert yet, so CL 
was not enabled at the time).

I've tried viewWillAppear, viewDidAppear, becomeFirstResponder, 
canBecomeFirstResponder, even a few nasty hacks that I really would rather not 
do if I can possibly help it. Nothing has worked so far. Other apps seem to 
solve this problem by having the next CL check happen after a user action. I 
would prefer not to make the user tap something on the screen after dismissing 
the iOS-supplied alert, but I don't see any other way since I don't see any 
notification that my app gets once the iOS-supplied this app needs location 
services / Allow / Don't Allow is dismissed by the user. 

This app requires location services -- the client does not want the app to 
perform it's function if it detects that it's somewhere it's not supposed to 
be. Is it possible for the app to somehow detect when the iOS-supplied alert 
has been dismissed, so it can do it's CL check in case the user tapped Don't 
Allow?

Regards,

John

___

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

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

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

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


Re: iOS: This application needs location services / Allow / Don't Allow alert

2012-02-01 Thread John Michael Zorko

Fritz,

The app does periodically (re)check for CL and auth status -- this isn't the 
problem. However, the didChangeAuthorizationStatus listening I was not doing, 
and me thinks that was the missing piece. I'll try that, and many thanks all :-)

Regards,

John

On Feb 1, 2012, at 9:24 AM, Fritz Anderson wrote:

 On 1 Feb 2012, at 2:09 AM, John Michael Zorko wrote:
 
 This app requires location services -- the client does not want the app to 
 perform it is function if it detects that it's somewhere it's not supposed 
 to be. Is it possible for the app to somehow detect when the iOS-supplied 
 alert has been dismissed, so it can do it's CL check in case the user tapped 
 Don't Allow?
 
 Checking for Core Location, only once, in advance of need, is probably the 
 wrong approach. The user could authorize or deauthorize CL at times other 
 than the moment your application happens to load. Make yourself the delegate 
 of the shared CLLocationManager, and listen for 
 locationManager:didChangeAuthorizationStatus:. 
 
 If you don't have CL, disable the functions you want to restrict, even if 
 that means putting a 50% alpha black mask over the whole screen, preferably 
 with a button to show an explanation of why the app is crippled. Respond 
 (don't assume) when CL comes back or goes away.
 
   — F
 


___

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

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

iOS4: AVFoundation, determining video aspect ratio and orientation

2011-10-13 Thread John Michael Zorko

Hello, all ...

I'm developing a video recording / playback app for a client. It works, but 
when playing back the video from the internet, I want to get information 
regarding the aspect ratio and orientation of the video i.e. if it was recorded 
when the device was in portrait or landscape. I'm not sure how to get this 
information from the AVAsset. Is there a way i've missed?

Regards,

John

___

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

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

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

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


iOS4: glReadPixels() to CMSampleBufferRef for video?

2011-07-25 Thread John Michael Zorko

Hello, all ...

While all of this discussion on Xcode 4 is interesting (please, Apple, make 
multiple-window development work again), i've an issue that i'm hoping someone 
could help with. I'm recording audio and video using AVFoundation, and i'm 
applying a GPU shader to the incoming video frames for effects. The problem is 
that after I get the pixels from the GPU via glReadPixels(), i'm kinda stuck as 
to how to make a CMSampleBuffer out of them so I can write it with an 
AVAssetWriter. The examples i've seen are confusing to me as they only seem to 
be concerned with video, when i'm recording video _and_ audio (though i'm not 
doing any processing to the audio).

Could someone post some example code that illustrates how to get pixels from 
the GPU (i'm assuming glReadPixels() is the best way to do this) and create a 
CMSampeBuffer with those pixels? I'd really appreciate it :-)

Regards,

John

___

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

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

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

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


iOS: AVFoundation, creating sample buffers for an AVAssetWriter from OpenGL ... so confused :-/

2011-07-14 Thread John Michael Zorko

Hello, all ...

I'm trying to create a sample buffer from an OpenGL view using glReadPixels(), 
so I can write the sample buffer with an AVAssetWriter I set up. I'm recording 
audio and video, and i'm really quite confused as to how to do this. So far, 
i'm recording audio and video straight from the sample buffers passed into the 
sample buffer delegate's captureOutput:didOutputSampleBuffer:fromConnection 
call, using an AVAssetWriter that I already set up. However, since i've got a 
shader doing things to the video, I actually want to write the shader-modified 
frame instead of the one passed to the delegate. The examples i've seen so far 
use AVAssetWriterInputPixelBufferAdaptor, but the examples only handle video, 
not video and audio. How do I take what glReadPixels() returns and put it into 
a CMSampleBuffer, so I can write it with my AVAssetWriter?

Any help would be quite appreciated :-)

Regards,

John



___

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

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

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

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


iOS: AVFoundation, AVAssetWriter and caching

2011-07-05 Thread John Michael Zorko

Hello, all ...

I'm interested in caching a movie as I play it from the internet, so that the 
next time the user asks for the movie, it can play it from the device 
filesystem. I'm thinking capturing frames and audio and using an AVAssetWriter 
like I would when recording from the camera, but i'm not sure if this will work 
when recording from a playing asset. Would anyone illuminate me as to whether 
this is possible, or if I need to explore other ways of doing this (which would 
probably be a lot less cool and efficient than doing it this way, alas)?

Regards,

John

___

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

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

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

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


iOS 4.3: AVAsset loadValuesAsynchronouslyForKeys not calling completion handler?

2011-05-02 Thread John Michael Zorko

Hello, all ...

Sometimes loadValuesAsynchronouslyForKeys doesn't call it's completion handler, 
i'm thinking possibly due to some network error. It will just hang there, and 
the completion handler block is never executed. My question is: how can I trap 
this?

Regards,

John

___

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

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

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

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


video analog to MPMediaItemCollection?

2011-04-20 Thread John Michael Zorko

Hello, all ...

I can access the iOS device's iPod library with MPMediaItemCollection, but I 
don't see a way to access the video library on the device. Does an API for this 
exist?

Regards,

John

___

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

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

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

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


iOS 4: more AVAsset questions

2011-04-17 Thread John Michael Zorko

Hello, all ...

I've more questions regarding AVAsset:

1. I see AVAsset and AVURLAsset. Is there a subclass that allows me to create 
an asset from a bytestream? I'm finding that AVURLAsset is a bit too high level 
for what I need to do (that being, create an asset for a stream of bytes coming 
from a socket).

2. If #1 isn't possible, is there a way I can specify the NSURLRequest for the 
AVURLAsset, so I can do things like specify HTTP headers for the request?

Regards,

John, appreciative of the assistance :-)


___

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

Please do not post 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 do I disable Xcode 4's SVN support?

2011-04-17 Thread John Michael Zorko

Hello, all ...

I run my own SVN server, and I do my own SVN management. I would greatly prefer 
that Xcode 4 not even try to talk to my SVN server, as it keeps asking me to 
allow access to that key in my keychain, over and over and over and over again. 
How can I disable Xcode 4's SVN support permanently?

Regards,

John

___

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

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

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

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


AVFoundation and OpenGL?

2011-04-10 Thread John Michael Zorko

Hello, all ...

I've been playing with Core Animation and AVFoundation to get some interesting 
results. I've a question, though, with regards to AVFoundation and OpenGL:

Can I make OpenGL work with AVPlayerLayer?

Regards,

John


___

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

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

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

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


AVAssetImageGenerator and HTTP-Live streams

2011-04-10 Thread John Michael Zorko

Hello again ...

I've found that when I use AVAssetImageGenerator to try to create a thumbnail 
from an HTTP-Live video stream, it fails, yet it works for basic M4V streams. I 
suspect that the multiple-bitrate nature of HTTP-Live is messing with it. I 
suppose I can parse the M3U8 myself and choose one of the bitrate streams, then 
parse the M3U8 for that stream and make an asset of one segment just to get the 
thumbnail, but i'm wondering if there's an easier way?

The URL of the stream i'm trying to generate a thumbnail for is:

http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8

Regards,

John

___

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

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

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

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


blocks and NSInvocation question

2011-04-10 Thread John Michael Zorko

Hello, all ...

I'm stumped as to why this generates a warning when I compile. Do I need to do 
something special with my AVURLAsset * to be able to access it from inside the 
block in order to add it to an NSInvocation?

for (int index = 0; index  [assetsToLoad count]; index ++)
{
NSURL *streamURL = [assetsToLoad objectAtIndex:index];
AVURLAsset *asset = [AVURLAsset URLAssetWithURL:streamURL options:nil];
NSString *tracks = @tracks;

[asset loadValuesAsynchronouslyForKeys:[NSArray arrayWithObject:tracks] 
completionHandler:^
 {
 SEL sel = @selector(setupPlayerForAsset:withIndex:);
 NSMethodSignature *sig = [self methodSignatureForSelector:sel];
 NSInvocation *inv = [NSInvocation 
invocationWithMethodSignature:sig];
 NSNumber *invNumber = [NSNumber numberWithInt:index];
 [inv setTarget:self];
 [inv setSelector:sel];
 [inv setArgument:asset atIndex:2];// warning: passing 
argument 1 of 'setArgument:atIndex:' discards qualifiers from pointer target 
type



 [inv setArgument:invNumber atIndex:3];
 [inv retainArguments]; 
 [inv performSelectorOnMainThread:@selector(invoke) withObject:nil 
waitUntilDone:YES];
 [self performSelectorOnMainThread:sel withObject:asset 
waitUntilDone:YES];
 }];
}
}

Regards,

John

___

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

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

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

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


AVFoundation and YouTube?

2011-04-05 Thread John Michael Zorko

Hello, all ...

I've used AVFoundation / AVAsset / AVPlayer / etc. to play both M3U8 and M4V 
content on iOS 4.3.1. I'd also like to use it to play YouTube content (so I can 
do animation / scaling stuff on the AVPlayerLayer). I've a couple of questions:

1. Is this possible with the iOS-optimized versions of YouTube content?
2. If so, how do I get the iOS-optimized version of the URL?

Regards,

John

___

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

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

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

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


iOS4: remote / headset events and the remote control display

2010-08-05 Thread John Michael Zorko

Hello, all ...

My iOS4 application plays audio, runs in the background and receives remote 
control events. All of this works, but the one thing that sometimes doesn't is 
the updating of the pause / play state on the remote control display. In other 
words, i'll tell my app to play, put it in the background, double-click the 
home button, swipe over to the remote control screen and press pause ... the 
audio pauses (I call AudioQueuePause()) but the remote-control screen button 
often doesn't change it's image to the play state image. I've read the Remote 
Control of Multimedia portion of the iOS Event Handling Guide, and as far as I 
can tell i'm doing exactly what it recommends (though i'm not using 
AVAudioPlayer, i'm using Core Audio directly), yet while the headset and 
remote-control events themselves work in my app, the remote-control display 
button is usually not updated. 

Any help on how I can fix this would be appreciated :-)

Regards,

John, who hopes everyone is doing well :-)

___

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

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


iOS: CFReadStreamCreateWithFile non-exclusive file access?

2010-06-29 Thread John Michael Zorko

Hello, all ...

I'm trying to implement a progressive download / cache using 
CFReadStreamCreateWithFile() to open a file URL that another thread is writing 
to. Basically, I have one thread with an NSURLConnection downloading a URL, and 
it's didReceiveData writes the data to the file via an NSFileHandle. Meanwhile, 
i've another thread that is trying to open this file via 
CFReadStreamCreateWithFile() to play it back. The idea is that the thread with 
the NSURLConnection can write the data to the file as fast as it gets it, and 
the thread with the CFReadStream can consume it at it's leisure (like, say, the 
audio playback rate).

What i'm seeing is that the CFReadStreamCreateWithFile() always returns nil 
when given the file URL that the other thread has open and is writing to, yet 
returns a stream if the file isn't already open. Is there a way I can make a 
CFReadStream with non-exclusive access to an already open file, or do I need to 
go down to the BSD open() call with SHLOCK to do this? Or is there another way? 
Any help is appreciated :-)

Regards,

John


 
___

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

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

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

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


Re: iOS4: CFReadStream and background operation

2010-06-23 Thread John Michael Zorko

Jens,

 2. However, CFReadStreams created _while_ the app was in the background 
 often (though not always) _don't_ call their callbacks _until_ the app is 
 brought in the foreground, then all of a sudden the callback happens.
 
 I think foreground/background is a red herring — that has almost no effect on 
 the behavior of the app.

 What I _have_ seen is bugs in my code that result in incoming activity (like 
 network I/O) not waking up the runloop, so the event doesn’t get delivered … 
 until some other event comes in and causes the runloop to wake up. This is a 
 lot likelier to happen when the app is in the background, because when it’s 
 active there are user events (even the mouse entering/exiting views) that 
 keep the runloop going pretty often.

Thanks for the reply and the info :-) I still think it has to do with 
foreground / background, because i've narrowed it down to CFReadStreamRead() 
hanging (as if there were no bytes to read) even though the read stream 
callback got the kCFStreamEventHasBytesAvailable event _and_ 
CFReadStreamHasBytesAvailable() returns TRUE (I wanted to make bloody sure).  
The section of code is _literally_ this (from my CFReadStream callback):

} else if (eventType == kCFStreamEventHasBytesAvailable) {
//
// Read the bytes from the stream
//

BOOL reallyReallyHasBytes = 
CFReadStreamHasBytesAvailable(stream);

NSLOG(@really really has bytes: %s, reallyReallyHasBytes ? 
yes : no);

UInt8 bytes[kAQBufSize];
CFIndex length = CFReadStreamRead(stream, bytes, kAQBufSize);

NSLOG(@recvd %i bytes, length);

Output:

2010-06-23 13:10:23.299 AudioPress[933:a61f] Thread 94518032: 
AudioEngineShoutcast 3959968: really really has bytes: yes

(and no more output ... it's hung on the CFReadStreamRead)

... and this code _works_ when in the foreground, but when in the background, 
the CFReadStreamRead() often (though not always) hangs. This is already after 
the run loop dispatched the event, so AFAIK the code isn't losing events. The 
documentation for CFReadStream clearly says that if at least one byte is 
available, CFReadStreamRead() won't block ... yet here it is, blocking (the 
recvd bytes message is never logged and the thread is hung until I put the 
app in the foreground again). This is using the GM seed of iOS4 on my 3GS. I 
don't know where else to look or what else to think, other than maybe 
CFReadStreamRead() isn't guaranteed to work while the app is backgrounded and 
that I should maybe drop back to the BSD send() / recv() calls and hope they do 
/ are? Is there something else I should be looking for that could cause this?

Regards,

John

___

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

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

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

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


Re: iOS4: CFReadStream and background operation

2010-06-23 Thread John Michael Zorko

Jens,

 2. However, CFReadStreams created _while_ the app was in the background 
 often (though not always) _don't_ call their callbacks _until_ the app is 
 brought in the foreground, then all of a sudden the callback happens.
 
 I think foreground/background is a red herring — that has almost no effect on 
 the behavior of the app.

I think I know what the problem is -- my app is being suspended. Even though I 
have the audio key added to the plist file, there is this sentence (best 
imagined as narrated by an ominous, deep voice with a thick reverb) from the 
iPhone Application Programming Guide:

However, if this key is not present when the application moves to the 
background, or if your application stops playing audio while in the background, 
your application is suspended.

I think what is happening is that if iOS4 catches my app not playing audio in 
the background (like if it calls AudioQueueStop() even if it's going to call 
AudioQueueStart() later), it suspends it.

Regards,

John


___

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

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

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

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


iOS4: CFReadStream and background operation

2010-06-22 Thread John Michael Zorko

Hello, all ...

I've an app that reads from the network using CFReadStream (it needs to use 
CFReadStream so that it can throttle the connection and specify how many bytes 
to read each time). What i'm finding is that CFReadStream callbacks aren't 
always called when the app is in the background. Specifically, what I _seem_ to 
be seeing is this:

1. CFReadStreams created when the app was in the foreground continue (the 
CFReadStream callback is called) when the app is put in the background.
2. However, CFReadStreams created _while_ the app was in the background often 
(though not always) _don't_ call their callbacks _until_ the app is brought in 
the foreground, then all of a sudden the callback happens.

The app in question is set up for background operation and runs in the 
background when the user presses the home button -- I can put a breakpoint in 
my thread's run loop and see this -- but the CFReadStream callback doesn't 
always get called, which makes this app appear to stop until the user brings it 
in the foreground again.

Thoughts? If anyone could assist and help me understand why this happens (and 
how to fix it), i'd be quite appreciative :-)

Regards,

John

___

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

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

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

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


[iPhone 3.1] Core Animation that leaves a trial?

2010-02-25 Thread John Michael Zorko

Hello, all ...

I'm interested in having a CAKeyframeAnimation leave a trail i.e. imagine the 
image of a pencil being animated across the screen -- I want to draw a path of 
where the pencil has been along with the animated pencil. However, i'm not sure 
how to do this, since Core Animation is doing the drawing for me. If anyone can 
offer some pointers, i'd be quite appreciative :-)

Regards,

John


___

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

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

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

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


[iPhone 3.1] navigationItem.backBarButtonItem weirdness

2010-02-10 Thread John Michael Zorko

Hello, all ...

I've a question about the UINavigationController backBarButtonItem property. I 
wanted to merely set my own image for the back button, instead of it using the 
title of the controller above in the hierarchy.  So, this is what I did (yes 
this app is using Three20, but I don't think that's the reason):

- (id)initWithNavigatorURL:(NSURL *)URL query:(NSDictionary *)query 
{
if (self = [super initWithNavigatorURL:URL query:query]) 
{
self.navigationItem.backBarButtonItem = [[[UIBarButtonItem 
alloc] initWithImage:[UIImage imageNamed:@backarrow.png]   
style:UIBarButtonItemStylePlain target:self action:@selector(back)] 
autorelease];
}

return self;
}

- (void)back:(id)sender
{
}

Now, this worked -- but I wasn't _expecting_ it to work. I was expecting that 
my back selector would be called, and I would have to tell the nav controller 
to pop. However, my back selector isn't called, and the back button _works_ 
like it always has. While i'm not in any way against freebees like this, i'm a 
bit concerned as to _why_ it works like this.  Any explanation would be 
appreciated, explanations that actually edify me more so :-)

Regards,

John


___

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

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

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

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


Re: [iPhone 3.1] navigationItem.backBarButtonItem weirdness

2010-02-10 Thread John Michael Zorko

Peter,

Yeah, but I get no NSException when I press the back button -- it does what 
it's always done (which I want). Also, I added the colon and it still doesn't 
even try to call my selector.

In short, it works -- but i'm not sure _why_ it works.

Regards,

John

 your selector is missing colon:
 
 @selector(back:)
 
 for method:
 
 -(IBAction)back:(id)sender
 
 Hello, all ...
 
 I've a question about the UINavigationController backBarButtonItem property. 
 I wanted to merely set my own image for the back button, instead of it using 
 the title of the controller above in the hierarchy.  So, this is what I did 
 (yes this app is using Three20, but I don't think that's the reason):
 
 - (id)initWithNavigatorURL:(NSURL *)URL query:(NSDictionary *)query
 {
if (self = [super initWithNavigatorURL:URL query:query])
{
self.navigationItem.backBarButtonItem = [[[UIBarButtonItem 
 alloc] initWithImage:[UIImage imageNamed:@backarrow.png]   
 style:UIBarButtonItemStylePlain target:self action:@selector(back)] 
 autorelease];
}
 
return self;
 }
 
 - (void)back:(id)sender
 {
 }
 
 Now, this worked -- but I wasn't _expecting_ it to work. I was expecting 
 that my back selector would be called, and I would have to tell the nav 
 controller to pop. However, my back selector isn't called, and the back 
 button _works_ like it always has. While i'm not in any way against freebees 
 like this, i'm a bit concerned as to _why_ it works like this.  Any 
 explanation would be appreciated, explanations that actually edify me more 
 so :-)
 
 Regards,
 
 John

___

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

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

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

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


[iPhone 3.1] NSInvocation on main thread?

2010-02-10 Thread John Michael Zorko

Hello, all ...

I'm using NSInvocation so I can pass multiple arguments to delegate methods. 
However, I also want these delegate methods to get called on the main thread. 
Is there a way that I can use NSInvocation to call the method it wraps on the 
main thread, like performSelectorOnMainThread?

Regards,

John


___

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

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

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

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


iPhone:NSURLConnection and keep-alive

2010-01-20 Thread John Michael Zorko

Hello, all ...

Is it possible to specify (and hence, re-use) a persistent connection with 
NSURLConnection? I want to issue new GET requests without having to 
re-establish the connection to the server. If so, would anyone point me at an 
example?

Regards,

John

___

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

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

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

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


iPhone: @protocol and @optional

2010-01-05 Thread John Michael Zorko

Hello, all ...

After [re-]reading the Apple documentation, i'm still not clear as to what 
@optional really does in a @protocol. I thought that declaring certain messages 
as @optional would make the app not crash if a certain message didn't have an 
implementation in a class that adopts the protocol, however i'm finding that 
this isn't the case:

2010-01-05 10:40:58.698 VoxityNowPlaying[14413:207] *** Terminating app due to 
uncaught exception 'NSInvalidArgumentException', reason: '*** 
-[VoxityNowPlayingViewController playerURLFinished:]: unrecognized selector 
sent to instance 0x39138f0'

... yet my protocol is defined thusly:

@protocol VoxityPlayerDelegate NSObject

@optional

- (void)playerURLFinished:(NSURL *)url;

.
.
.

@end

Do I need to wrap code that sends messages to delegates with 
-respondsToSelector? If so, what is the point of @optional in the protocol?

Regards,

John


___

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

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

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

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


Re: iPhone: @protocol and @optional

2010-01-05 Thread John Michael Zorko

Mike et al,

OK, I get it -- @optional in a @protocol is kind of like #pragma warning: 
in (MS) C++ in that it just tells the compiler to not generate specific 
warnings, in this case warnings about a class that doesn't fully implement the 
protocol. I thought it would automatically call -respondsToSelector, but I 
understand that that's runtime behavior, and the protocol doesn't alter what 
the object does in the runtime. Thanks, all!

Regards,

John, who loves it when he learns something and can verify it himself) :-)

On Jan 5, 2010, at 11:06 AM, Mike Abdullah wrote:

 Protocols cannot decide or change behaviour of an object. Instead, it is up 
 to the object in question to adopt the protocol appropriately. Declaring 
 methods as @optional just means that you have a choice whether to implement 
 or not. Anyone wanting to call the method should first check if its 
 implemented with -respondsToSelector:

___

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

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

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

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


Re: iPhone: load cell from XIB slows down tableview?

2010-01-04 Thread John Michael Zorko


Tony,

Have you verified that you've set the Identifier for the custom cell  
in the XIB to match the above cellID?  If they don't match, you'll  
end up loading the XIB for every row in the table view.  If things  
are set up properly, the XIB will be loaded once for each visible  
row on the screen plus a few more depending on how fast you scroll.


I fixed the issue last night, perhaps 20 minutes after I posted the  
question. Yes, it was exactly as you described -- I had the ID set  
incorrectly in the XIB. Many thanks!


This is less of an issue, but iterating over the objects in the XIB  
can be avoided by adding an outlet connected to the custom cell to  
your class that owns the XIB.  I've got a sample project that  
demonstrates this available at


http://majestysoftware.com/code/CustomCellFromNib.zip

The project was created pre-3.0, so you'll get a deprecation warning  
when building.  The basic concept is still valid in 3.x.


That is a good idea -- i'll try it :-)

Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.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


iPhone: load cell from XIB slows down tableview?

2010-01-03 Thread John Michael Zorko

Hello, all ...

I'm trying to determine why my tableviews scroll so jerkily on non-3GS devices. 
The datasource only has perhaps 170 records, so I think it may have something 
to do with how i'm instantiating the cells in -tableView:cellForRowAtIndexPath. 
In other apps i've done, I create the view for the cell programmatically, and 
alloc / init the cell if I can't dequeue it. However, in this app, I have the 
cell's view loaded from a XIB. Is there a better way of defining my cell's view 
with IB that still results in a performant tableview?

- (UITableViewCell *)tableView:(UITableView *)tableViewIn 
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
   static NSString *cellID = @mycellID;

MyAppDelegate *appDelegate = (MyAppDelegate *)[[UIApplication 
sharedApplication] delegate];

LogDailyCell *cell = (LogDailyCell *)[tableViewIn 
dequeueReusableCellWithIdentifier:cellID];

   if (nil == cell)
   {
NSArray *nib = [[NSBundle mainBundle] 
loadNibNamed:@LogDailyCell

 owner:self options:nil];
for (id oneObject in nib)
{
if ([oneObject isKindOfClass:[LogDailyCell class]])
{
cell = (LogDailyCell *)oneObject;
break;
}
}
   }

MyObject *act = nil;

switch(indexPath.section)
{
case 0:
act = [appDelegate array1ItemAtIndex:indexPath.row];
cell.type = 2;
break;
case 1:
act = [appDelegate array2ItemAtIndex:indexPath.row];
cell.type = 3;
break;
case 2:
act = [appDelegate array3ItemAtIndex:indexPath.row];
cell.type = 4;
break;
case 3:
act = [appDelegate array4ItemAtIndex:indexPath.row];
cell.type = 5;
break;
}

cell.name.text = act.name;
cell.label1.text = [NSString stringWithFormat:@%i, act.anNSString];
cell.field1.text = @;
cell.field2.text = @;
cell.ident = indexPath.row;
[cell.deleteButton removeFromSuperview];

   return cell;
}

Regards,

John
___

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

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

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

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


simple NSRunLoop question

2009-12-02 Thread John Michael Zorko

Hello, all ...

i've done some googling, and read documentation for NSRunLoop and NSThread, but 
there's something I don't know: How do I get the run loop of a specific 
NSThread?  Something like:

[streamerThread getCurrentRunLoop];

??

Regards,

John


___

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

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

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

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


iPhone: how to tell if a UIScrollView is scrolling?

2009-11-10 Thread John Michael Zorko


Hello, all ...

After making the NSOperation and view tag changes, my app is scrolling  
a large table view with hundreds of images much better. However, there  
is still some jerkiness, caused by the fact that when the NSOperation  
calls the refresh (image update) method, it has to call it on the main  
thread. So, every time the image needs to update, the scrolling pauses  
for a bit, which makes scrolling jerky when images haven't been cached.


I was thinking that I could only update the image if the table view  
isn't scrolling, but I don't see an isScrolling property on  
UIScrollView. Is there a way, in OS 2.2.1, that I can tell if a scroll  
view is scrolling?


Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.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


questions on memory issues

2009-11-10 Thread John Michael Zorko


Hello, all ...

Firstly, I very much appreciate the help i've received here -- thank  
you very much :-)


I've a debugging question. I've an issue that manifests as what  
appears to be a dangling pointer. I've a view that is loaded, and all  
is fine. This is OS 2.2.1. My understanding is that under OS 2.x, the  
view controller only releases it's view when the view controller is  
released. However, if I put a breakpoint on my view controller's - 
loadView method, it's called again sometime later (and it's view  
property is now something completely different, pointing to an  
NSArray, NSOperation or something else), without the view controller's  
-dealloc method being called beforehand. I would think that if the  
view controller had to be released, say because of a memory warning,  
that its' -dealloc method would be called. I don't know why it's not ...


In OS 3.x, I can just be sure to catch the viewDidUnload delegate  
method and set the view to nil, and make sure I recreate it in  
loadView, but I would like to target OS 2.2.1 if at all possible.


Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.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: iPhone: NSOperation and UITableVIews

2009-11-09 Thread John Michael Zorko


Dave, Alex ...

An alternative implementation might be to have each cell queue up an  
operation when it needs to load an image (not the view controller).  
Then, each cell could cancel it's operation in [UITableViewCell  
prepareForReuse].



Cool -- I learned something today :-)  I did this, so now the  
NSOperation * is stored in the cell, hence I can get it from  
prepareToReuse and call cancel on it.  Nifty!  I also set the tag of  
the cell and get it back in my refresh method, which means i'm only  
telling the cells currently displayed to load their artwork.  The  
scrolling is still a bit jerky, though much much better, and nothing  
i've not seen in other apps on this device (first gen 8G iPod touch,  
running OS 2.2.1). I'm sure it will perform much better on a more  
recent device like my iPhone 3GS, but I like to test with the oldest  
thing I can :-)


Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.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


iPhone: NSOperation and UITableVIews

2009-11-08 Thread John Michael Zorko


Hello, all ...

I have an indexed table view with -- surprise -- images that take a  
long time to load. So, I put the loading into an NSOperation-derived  
subclass and have the main() method send a refresh msg to my main  
thread, telling it to reload the table.  This works, but the problem  
is that if the user scrolls quickly, a whole bunch of NSOperations get  
queued up, even for cells that the user scrolled far past i.e. they're  
not anywhere close to being on the screen. This has the bad effect of  
making my refresh msg get send for cells that have long since  
passed, making the app really slow to scroll (which really defeats the  
purpose of this whole exercise).


I would like to cancel these extra NSOperation instances, but my app  
is targeting OS 2.2.1 and:


1. I can't seem to see a way of determining if a cell is going to be  
drawn or not i.e. I don't see a way to cancel the NSOperations that  
aren't relevant to the portion of the table view that would be shown  
on the screen.


2. I thought maybe -UITableView reloadRowsAtIndexPaths would help  
(instead of calling -UITableView reloadData every time, which is why  
scrolling is so slow now), but that method is OS 3.1 only.


Any pointers are appreciated!  What is available in OS 2.2.1 to help  
me solve this?


Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.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


[iPhone 3.0] -- UIImage imageFromContentsOfFile and animations

2009-08-13 Thread John Michael Zorko


Hello, all ...

The source of my problem seems to be using UIImage -imageNamed to load  
my array of PNGs to be animated, since imageNamed caches the data in  
case I ask for it again.


However, though replacing imageNamed with imageFromContentsOfFile  
works wherever I set a UIImageView's image property, doing so to load  
the PNG images into my animation array results in the animation being  
invisible on the device, though it works in the simulator.  Here's my  
code:


NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

for (frameIndex = 0; frameIndex = 30; frameIndex ++)
{
NSString *frameName = [NSString  
stringWithFormat:@clapping_%05i, frameIndex];
NSString *path = [[NSBundle mainBundle]  
pathForResource:frameName ofType:@png inDirectory:@clapping];
UIImage *image = [UIImage  
imageWithContentsOfFile:path];


if (image != nil)
{
[self.animationArray addObject:image];
}
}

[pool release];


I've tried various combinations of the inDirectory parameter, to no  
avail -- it plays on the sim, not on the device.  However, using  
UIImage imageNamed works on the device, but uses up a lot of memory  
that causes my glitch.  What to do?  If anyone could tell me how to  
use imageFromContentsOfFile to load an array that UIImageView  
startAnimating will play, i'd love to hear about it :-)

Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.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


[iPhone 3.0] how to find an image leak using Instruments?

2009-08-12 Thread John Michael Zorko


Hello, all ...

I've an an iPhone app that runs swimmingly on my devices, but shows  
display glitches on others testing it.  I suspect it's an image leak  
of some sort (this code uses a _lot_ of images, animations, etc).   
When I run Instruments, though, the leaks tool doesn't seem to point  
to my source in any way that I can see.  How would I go about trying  
to find what is very likely an image leak on the device using  
Instruments?


Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.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: [iPhone 3.0] correct way to release a UIImageView flip animation?

2009-08-09 Thread John Michael Zorko


Kyle et al,

No problem -- here's my code.  There is obviously something i'm not  
getting, so any help is truly appreciated.


First, my view controller has a showAnimation method that is called to  
play the currently loaded animation:


- (void)showAnimation
{
// only play the animation if the preloader thread has finished ...

lilappAppDelegate *delegate = (lilappAppDelegate *) 
[[UIApplication sharedApplication] delegate];


[delegate stopAnimations];

if(YES == delegate.animationPreloaded)
{
delegate.animationView.animationImages =  
delegate.animationArray;

[delegate playAnimation:self.view];
[delegate preloadNextAnimation];
}
}

... and I run a thread to preload the next animation (this code always  
preloads the same one, but the idea is that they'll change, and I  
don't want to load them all at once and waste memory):


- (void)preloadAnimationThread
{
NSAutoreleasePool *outerPool = [[NSAutoreleasePool alloc] init];

self.animationPreloaded = NO;
int frameIndex = 0;

[NSThread sleepForTimeInterval:5];

[self performSelectorOnMainThread:@selector(releaseAnimations)  
withObject:nil waitUntilDone:YES];


[self.animationArray release];
self.animationArray = [[NSMutableArray alloc] init];

for (frameIndex = 0; frameIndex  47; frameIndex += 2)
{
NSString *frameName = [NSString stringWithFormat:@clapping_ 
%05i.png, frameIndex];


	// I tried [UIImage imageContentsFromFile], but it resulted in  
animations that played on the sim but

// not on the device ...

[self.animationArray addObject:[UIImage imageNamed:frameName]];
}

self.animationPreloaded = YES;

[outerPool release];
}

- (void)releaseAnimations
{
self.animationView.animationImages = nil;
}

- (void)stopAnimations
{
[self.animationView stopAnimating];
}

On Aug 8, 2009, at 10:24 PM, Kyle Sluder wrote:

On Aug 8, 2009, at 8:14 PM, John Michael Zorko jmzo...@mac.com  
wrote:


My question -- what is the correct way to release the UIImageView's  
animatedImages array?  I assign an NSMutableArray to it, play the  
animation, then set the UIImageView's animatedImages to nil.  I  
then release the NSMutableArray and recreate it.  Is this correct?


Your question is meaningless without context, and the fact that  
you're asking it indicates a lack of familiarity with the Cocoa  
memory management rules.


Since we have been asked not to paraphrase them here, all I can  
suggest is that you review the documentation and, if you're still  
confused, post your code.


--Kyle Sluder



Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.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: [iPhone 3.0] correct way to release a UIImageView flip animation?

2009-08-09 Thread John Michael Zorko


Kyle et al,

BTW, the issue I see is the infamous program exited with signal:0  
error, with no backtrace.


On Aug 8, 2009, at 10:24 PM, Kyle Sluder wrote:

On Aug 8, 2009, at 8:14 PM, John Michael Zorko jmzo...@mac.com  
wrote:


My question -- what is the correct way to release the UIImageView's  
animatedImages array?  I assign an NSMutableArray to it, play the  
animation, then set the UIImageView's animatedImages to nil.  I  
then release the NSMutableArray and recreate it.  Is this correct?


Your question is meaningless without context, and the fact that  
you're asking it indicates a lack of familiarity with the Cocoa  
memory management rules.


Since we have been asked not to paraphrase them here, all I can  
suggest is that you review the documentation and, if you're still  
confused, post your code.


--Kyle Sluder



Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.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: [iPhone 3.0] correct way to release a UIImageView flip animation?

2009-08-09 Thread John Michael Zorko


Kyle et al,

Wow, it's late ... I forgot some of the code in the last email --  
here's all of it (still not much, no worries).  I see the program  
exited with signal:0 error after this code runs for awhile, and  
there's no backtrace.


On my view controller is:

- (void)showAnimation
{
   // only play the animation if the preloader thread has finished ...

   lilappAppDelegate *delegate = (lilappAppDelegate *)[[UIApplication  
sharedApplication] delegate];


   [delegate stopAnimations];

   if(YES == delegate.animationPreloaded)
   {
   delegate.animationView.animationImages =  
delegate.animationArray;

   [delegate playAnimation:self.view];
   [delegate preloadNextAnimation];
   }
}

... and I run a thread to preload the next animation (this code always  
preloads the same one, but the idea is that they'll change, and I  
don't want to load them all at once and waste memory):


On my app delegate are:

- (void)preloadAnimationThread
{
   NSAutoreleasePool *outerPool = [[NSAutoreleasePool alloc] init];

   self.animationPreloaded = NO;
   int frameIndex = 0;

   [NSThread sleepForTimeInterval:5];

   [self performSelectorOnMainThread:@selector(releaseAnimations)  
withObject:nil waitUntilDone:YES];


   [self.animationArray release];
   self.animationArray = [[NSMutableArray alloc] init];

   for (frameIndex = 0; frameIndex  47; frameIndex += 2)
   {
   NSString *frameName = [NSString stringWithFormat:@clapping_ 
%05i.png, frameIndex];


	// I tried [UIImage imageContentsFromFile], but it resulted in  
animations that played on the sim but

// not on the device ...

   [self.animationArray addObject:[UIImage imageNamed:frameName]];
   }

   self.animationPreloaded = YES;

   [outerPool release];
}

- (void)playAnimation:(UIView *)view
{
[self.animationView setAnimationDuration: 
[self.animationView.animationImages count] / 12];

self.animationView.animationRepeatCount = 1;
[view addSubview:self.animationView];
[self.animationView startAnimating];
}

- (void)preloadNextAnimation
{
self.animationPreloaded = NO;

// now preload the next ones ...

[self  
performSelectorInBackground:@selector(preloadAnimationThread)  
withObject:nil];

}

- (void)releaseAnimations
{
   self.animationView.animationImages = nil;
}

- (void)stopAnimations
{
   [self.animationView stopAnimating];
}


On Aug 8, 2009, at 10:24 PM, Kyle Sluder wrote:

On Aug 8, 2009, at 8:14 PM, John Michael Zorko jmzo...@mac.com  
wrote:


My question -- what is the correct way to release the UIImageView's  
animatedImages array?  I assign an NSMutableArray to it, play the  
animation, then set the UIImageView's animatedImages to nil.  I  
then release the NSMutableArray and recreate it.  Is this correct?


Your question is meaningless without context, and the fact that  
you're asking it indicates a lack of familiarity with the Cocoa  
memory management rules.


Since we have been asked not to paraphrase them here, all I can  
suggest is that you review the documentation and, if you're still  
confused, post your code.


--Kyle Sluder



Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.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


[iPhone 3.0] UIImage startAnimating -- how to tell when it's finished?

2009-08-08 Thread John Michael Zorko


Hello, all ...

I load a UIImageView with an array of PNG images, and call  
startAnimating -- this works very well.  However, I need to know when  
the animation is done, because I need to have a thread load the next  
animation.  Unfortunately UIImageView doesn't implement the  
animationDidStop:finished method :-(


If anyone can give me some pointers on this, i'd appreciate it :-)

Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.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


[iPhone 3.0] correct way to release a UIImageView flip animation?

2009-08-08 Thread John Michael Zorko


Hello, all ...

I'm running a little test right now on my iPod Touch, where i'm  
loading a flip animation (49 PNGs), playing it and unloading it every  
10 seconds.  I see what appears to be a memory leak in Instruments,  
though -- perhaps 2K every time I play an animation.


My question -- what is the correct way to release the UIImageView's  
animatedImages array?  I assign an NSMutableArray to it, play the  
animation, then set the UIImageView's animatedImages to nil.  I then  
release the NSMutableArray and recreate it.  Is this correct?


Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.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


iPhone: getting the pixel data from a PNG file

2009-07-23 Thread John Michael Zorko


Hello, all ...

I need to be able to make an iPhone app read a PNG file and retrieve  
the values of its' pixels.  I know that libPNG can do this, but my  
questions are:


1. does libPNG already exist on the iPhone, or do I need to compile it  
as a .a and link with it?
2. are there Cocoa Touch or other iPhone APIs to help me do this,  
maybe without needing to use libPNG?


Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.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


CFHTTP +authentication

2009-01-25 Thread John Michael Zorko


Hello, all ...

I guess this is more of a Core Foundation question, but it still  
seemed more apropos to this list than Carbon-dev.  Please let me know  
if i'm wrong :-)


I'm trying to handle URLs in this format:

http://user:password@this.url.com/content

... with the user and password filled in of course.  I found that  
NSURLConnection handled these for me, but for reasons beyond the scope  
of this question, NSURLConnection isn't a good choice for what i'm  
trying to do, so i'm using CFNetwork stuff.  I've a question, though:


1. How do I get the HTTP return code?  I use  
CFHTTPMessageCreateRequest() to create the GET request, and  
CFReadStreamCreateForHTTPRequest() to create a CFReadStream for said  
request.  How do I get the response of the request?


Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.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


NSTableView horiz scrollbar doesn't take into account last table column

2008-12-23 Thread John Michael Zorko


Hello, all ...

I'm on 10.5.5, and i've code that shows a table with two columns.  In  
IB, vert and horiz scrollbars are enabled, but when the applications  
runs, the horiz scroller only appears when I size the window such that  
the first table column is partially shown.  The horiz scroller doesn't  
appear at all if the first table column is completely shown and the  
second is not.


The issue is that the second columns' constraints are set in IB, not  
in code.  What I would like to do is go through the columns' entries,  
find the longest one, and set the horiz scroller to scroll based on  
that.  How do I do this in Cocoa?


Regards,

John


___

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

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

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

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


proper way to release a static NSMutableDictionary?

2008-12-15 Thread John Michael Zorko


Hello, all ...

Imagine this:

static NSMutableDictionary *lookup = [NSMutableDictionary new];

... now imagine a situation where I need to clear that dictionary.  If  
I call


[lookup release];
lookup = [NSMutableDictionary new];

... it will obviously be faster than coding a for loop and removing  
each object in the dictionary, but since it was declared as static,  
which is safer?


Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.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: proper way to release a static NSMutableDictionary?

2008-12-15 Thread John Michael Zorko


Ashley,


Imagine this:

static NSMutableDictionary *lookup = [NSMutableDictionary new];

... now imagine a situation where I need to clear that dictionary.   
If I call


[lookup release];
lookup = [NSMutableDictionary new];

... it will obviously be faster than coding a for loop and removing  
each object in the dictionary, but since it was declared as static,  
which is safer?


As long as you are not retaining the objects referenced in the  
dictionary elsewhere, then when the dictionary is deallocated, all  
of its' referenced objects will be released. Whether the dictionary  
was declared static or not does not affect its' contents.


I'm not concerned about the contents per se -- i'm concerned about  
releasing something I declared as static, just to create it again  
later.  Part of me is saying just release the dictionary's contents,  
not the dictionary itself.


Regards,

John


___

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

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

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

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


Re: brain-dead NSThread question ...

2008-09-14 Thread John Michael Zorko


Julien et al,



sleep() is just blocking the thread, so no event is processed. Use  
run loops instead.


Try to replace sleep() with [[NSRunLoop currentRunLoop]  
runMode:beforeDate:]


You mean the NSURLConnection callbacks are not callbacks in the C / C+ 
+ sense i.e. they're more like dispatched messages instead?


Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.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 [EMAIL PROTECTED]


brain-dead NSThread question ...

2008-09-14 Thread John Michael Zorko


Hello, all ...

I'm trying to launch a thread to connect to a server and stream some  
data.  What i'm seeing is that, while my thread launches, the  
NSURLConnection callbacks are never called, and it's probably some  
silly thing i'm not understanding about ObjC / Cocoa (being an old C /  
C++ developer):


int keepRunningThread = 0;

- (void)playStream:(Song *)streamToPlay
{
// if a player thread is running, tell it to stop ...

keepRunningThread = 0;  // tell thread to stop

while(myData.playing == YES)// wait for it to stop
{
sleep(0);
}

// ... and start a new one with the new stream to play

	NSLog(@starting thread to play mp3 stream %s, [streamToPlay.mp3  
UTF8String]);


	[NSThread detachNewThreadSelector:@selector(connectAndPlayStream:)  
toTarget:self withObject:streamToPlay];


}

- (void)connectAndPlayStream:(Song *)streamToPlay
{
myData.playing = YES;

keepRunningThread = 1;

NSString *url = @http://some_host.com/;;
url = [url stringByAppendingString:streamToPlay.mp3];
	NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL  
URLWithString:[url  
stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]]  
cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
	NSURLConnection *connection = [[NSURLConnection alloc]  
initWithRequest:request delegate:self];


if (connection)
{
receivedData = [[NSMutableData data] retain];
}
else
{
NSLog(@can't connect to server);
}

// I suspect this loop is the problem.  How do I wait for all  
data to be received without blocking the NSURLConnection callbacks?


while (keepRunningThread)
{
sleep(1);
}

myData.playing = NO;
}

- (void)connection:(NSURLConnection *)connection didReceiveResponse: 
(NSURLResponse *)response

{
[receivedData setLength:0];
}

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

{
unsigned int length = [data length];

NSLog(@recv'd %d bytes, length);
[receivedData appendData:data];
}

- (void)connection:(NSURLConnection *)connection
  didFailWithError:(NSError *)error
{
// release the connection, and the data object
[connection release];
// receivedData is declared as a method instance elsewhere
[receivedData release];

// inform the user
NSLog(@Connection failed! Error - %@ %@,
  [error localizedDescription],
  [[error userInfo] objectForKey:NSErrorFailingURLStringKey]);
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
// do something with the data
// receivedData is declared as a method instance elsewhere
NSLog(@Succeeded! Received %d bytes of data,[receivedData  
length]);


// release the connection, and the data object
[connection release];
[receivedData release];
}

Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.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 [EMAIL PROTECTED]


new to Cocoa -- threading question

2008-09-06 Thread John Michael Zorko


Hello, all ...

I'm new to Cocoa, and i'm trying to launch a thread.  Yet, the app  
bombs when I try, and the console says it's because the selector isn't  
implemented:


2008-09-06 18:23:30.919 XXX[2363:20b] SEL: playMP3StreamThread
2008-09-06 18:23:30.927 XXX[2363:20b] *** Terminating app due to  
uncaught exception 'NSInvalidArgumentException', reason: '*** - 
[NSThread initWithTarget:selector:object:]: target does not implement  
selector (*** -[XXXAppDelegate playMP3StreamThread])'


Yet, here it is -- i'm not understanding something obviously (the  
example I saw looked easy enough):


@implementation XXXAppDelegate

.
.
.

- (void)playMP3StreamThread:(Song *)streamToPlay
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

	// initialize a mutex and condition so that we can block on buffers  
in use.


pthread_mutex_init(myData.mutex, NULL);
pthread_cond_init(myData.cond, NULL);

	OSStatus err = AudioFileStreamOpen(myData, MyPropertyListenerProc,  
MyPacketsProc,

   
kAudioFileAAC_ADTSType, myData.audioFileStream);
if (err)
{
NSLog(@AudioFileOStreamOpen error %d, err);
}

NSString *url = @http://some_hostl/;;
url = [url stringByAppendingString:streamToPlay.mp3];
	NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL  
URLWithString:[url  
stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]]  
cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
	NSURLConnection *connection = [[NSURLConnection alloc]  
initWithRequest:request delegate:self];


if (connection)
{
receivedData = [[NSMutableData data] retain];
}
else
{
NSLog(@can't connect to server);
}

[pool release];
}


- (void)playStream:(Song *)streamToPlay
{
NSLog(@playing mp3 stream %s, [streamToPlay.mp3 UTF8String]);

// make sure current song play thread is stopped ...






// start a new thread with the new song ...

	[NSThread detachNewThreadSelector:@selector(playMP3StreamThread)  
toTarget:self withObject:streamToPlay];

}

What am I not grokking?  Any pointers would be appreciated ...

Regards,

John




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: new to Cocoa -- threading question

2008-09-06 Thread John Michael Zorko


Kyle,



  [NSThread  
detachNewThreadSelector:@selector(playMP3StreamThread)

toTarget:self withObject:streamToPlay];


The selector you want is playMP3StreamThread:, not
playMP3StreamThread.  That colon is very important.


Ah, yes -- the colon.  I couldn't live without mine ;-)

*cymbal crash*

Regards,

John, who will be here all week ;-)


___

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

Please do not post 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: Cocoa-dev Digest, Vol 5, Issue 1446

2008-08-12 Thread John Michael Zorko
 

Pagtrick,

I have a number of projects that require communication with a server  
using SOAP. Over the last couple of years I've been able to make this  
work on Mac OS X by leveraging WebServicesCore API, wrapped in  
Objective-C.

Now I find myself having to deploy to a platform where not even this  
feeble API is available. I've been investigating alternatives, and  
found the gSOAP library, which at the moment looks like the best  
candidate. However, ideally I would like to use a pure Cocoa solution,  
or a project which has existing Cocoa wrappers. Does anyone have  
experiences with gSOAP on OS X, or know of a good alternative?

I've used gSOAP on OSX before in various C++ projects i've done.  It works well 
in that context, though the gSOAP code generation utilities will generate 
straight-C code as well, which might be easier to wrap with an ObjC class.  
Regarding the platform you're targeting, I suspect I might be targeting the 
same platform.  I might very well be on the same road as you ...

Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.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 [EMAIL PROTECTED]