Radio Backporch Revolution updated to v2.1

The streaming radio iPhone app we developed for New Orleans musicians’ collective Backporch Revolution has been updated to 2.1.

Features:

  • Better caching resulting in fewer sound drop-outs
  • Auto-reconnect on temporarily dropped connection
  • Compatibility with devices running legacy OS 3.x
  • Animated song title changes
  • Reload button on news and artist roster pages
  • Multiple minor bug fixes

Free download from the App Store.

Posted in iPhone Apps, Radio BPR | Leave a comment

How to get the Return key to dismiss a UITextView

Need to dismiss they keyboard in a UITextView? Changing the Return key to read “Done” doesn’t make the iPhone keyboard to go away.  Put this code in the delegate for your UITextView and your return key can behave more like the Done button in the keyboard for a UITextField.

#pragma mark -
#pragma mark UITextViewDelegate methods

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range 
 replacementText:(NSString *)text{
	if (range.length==0) {
		if ([text isEqualToString:@"n"]) {
			[textView resignFirstResponder];
			return NO;
		}
	}
	
 return YES;
			 
}

Posted in iPhone Development, Programming | Tagged , , | 3 Comments

Radio BPR v2 update submitted to app store

Posted in Radio BPR | Tagged , , , | Leave a comment

plist > JSON > XML

Having developed 4 or 5 iPhone apps now that download remote XML data from servers and populate tables view and other content, I can tell you without reservation that it is the slowest way to go.

Performance using JSON is quite a bit better, but if you can get access to the server to write a Property List (.plist) file instead of (or alongside) the XML you will be much happier with the ease-of-coding and, more importantly, the speed in which the data loads into your app.

If you use mySQL/PHP for your backend, pretty much everything you need to know is explained in this excellent blog post by Aaron Dunnington:

Data-driven iPhone Apps with Property Lists and PHP.

Posted in iPhone Development, Programming | Tagged , , , , , | Leave a comment

How To Place a UIWebView inside a UIScrollView

To display several pieces of content on a screen, I needed several views. A scroll view (UIScrollView) was necessary to encompass the headline, photo and story text; I had the headline and photo at the top in a fixed area, but the content was of variable size as the story length changed.

Originally I had a text view (UITextView) to hold the story, but I wanted to do rich-text formatting, and since my database already used HTML to do italic and bold markup, a web view (UIWebView) was the obvious fit.

However, there are some caveats to using web views, most importantly to do with getting the size of the view after you’ve set the content. First, you must make sure the content has completed loading before you retrieve the size; you can do this in the delegate handlerwebViewDidFinishLoading:

Secondly, web views don’t respond correctly to sizeToFit: so you must do some more manual labor using a Javascript call to find the size of the web view after you’ve inserted the content. Some comments on other web sites mentioned that you can try [webView sizeThatFits:CGSizeZero] but this did not work for me.

Here’s the pertinent code from my current project. Also please note that I have a <div id="body"> surrounding my HTML content that I pass into the view. The javascript call uses this to grab the height of the web view after it loads. You’ll also notice that this calculation sometimes falls a little short so I add 12 points to it.

The code below creates a UIButton beneath the text copy, so I added 70 pixels to the contentSize of the enclosing scroll view. It works perfectly for me; hopefully it helps someone else, too.

If there’s a more kosher way to do it, I’d love to hear it. I had considered putting everything (including the headline and photo) inside the UIWebView, but then I would not have been able to have a UIButton beneath/outside it off screen; nor, more importantly would I be able to use my custom NetImageViewer class on the photo. (More on that later.)

#pragma mark -
#pragma mark UIWebViewDelegate methods 
-(void)webViewDidFinishLoad:(UIWebView *)webView{
	if (webView!=bioWebView)return;

	float h;
	
	NSLog(@"web view is %f high", bioWebView.frame.size.height);
	NSString *heightString = [bioWebView stringByEvaluatingJavaScriptFromString:@"document.getElementById("body").offsetHeight;"];
	NSLog(@"web content is %@ high",heightString);
	
	h = [heightString floatValue] +12.0f; // convert from string to float plus some extra points because calculation is sometimes one line short
	
	bioWebView.frame = CGRectMake(bioWebView.frame.origin.x, bioWebView.frame.origin.y, bioWebView.frame.size.width, h);
	
	// get bottom of text field
	h = bioWebView.frame.origin.y + h + 70; // extra 70 pixels for UIButton at bottom and padding.
	[scrollView setContentSize:CGSizeMake(320, h)];
	
	/* 

        position button code here.... 

        */

}

Posted in iPhone Development, Programming | Tagged , , , , | 15 Comments

Xcode installation woes.

iPhone developers: if you install Xcode 3.2.3 to start developing iOS4 apps you may be surprised to find that all prior SDKs and Simulators before 4.0 for iPhone (and 3.2 for iPad) get removed. Trying to build using an older SDK will leave you with a “Base SDK missing” warning.

I wrote a huge blog post last week about how to successfully integrate the old SDKs into the latest Xcode (version 3.2.3), since I wasted a whole trying to get it to work, I thought I would share.

Unfortunately, it still wasn’t working after all that work, so my recommendation to you, should you want to hang on to the older SDKs (for the time being) is to install the new XCode in a new folder outside of /Developer. The dialog in the installer for picking the install location is a little different from what might you might be used to seeing, so proceed carefully.

Posted in iPhone Development | Tagged , , , , | Leave a comment

Juggleware at WWDC

WWDC is definitely the top annual event for Apple developers. The event, which took place last week at the Moscone Center in downtown San Francisco was Juggleware’s first year there, and it was all that it was promised to be.  Thanks to Chris at Calliope Digital for recommending it. It was definitely “drinking from a firehose” (in the words of Jeff LaMarche). Highly recommended if you’re a serious Apple developer. Intense, inspiring, and interesting, WWDC isn’t like your typical convention that’s all about the sales floor. After Jobs’ keynote Monday morning, it’s nothing but technical sessions until Friday night’s beer bash, which was hosted outdoors in a grassy downtown park with hipster geek band OK Go rocking the crowd.

Posted in Miscellany | Tagged , , | Leave a comment

Streaming Radio app approved

Fast on the heels of the last post, we are pleased to announce that Apple has approved Juggleware’s latest app, Radio Backporch Revolution.

Initially we received a rejection letter from the App Store review team, saying that the app used bandwidth that was demanding on the cell network that was excessive “in Apple’s reasonable judgment.” With a 128kbps mp3 stream, I found this curious as I have used several streaming radio apps that connect to 128kbps streams, including the excellent WFMU app, but also the much higher profile AOL Radio app.

Some google searching revealed this helpful article on StackOverflow wherein the writer related being told verbally by App Store personnel that one megabyte per minute was the maximum allowed. I did some quick math on the calculator and it seemed that my app should be receiving 960KB/minute, so I should be good.  But following the StackOverflow poster’s advice related from Apple staff, I shut off all other notifications and used the Settings app>General>Usage  to reset the statistics and then track the app for 5 minutes. For some reason the app came in as receiving 5.4MB over 5 minutes, which means I was around 10% over the limit.

I am not sure if other 128kbps streams have this issue, or there’s mysterious overhead lurking in mine, but I had planned to knock down the quality to 96k anyway as 128k over 3G still has too many dropouts.

I wrote Apple an email back explaining that it was not an app issue but a stream issue, and I could easily knock the stream down a notch. Which I did, and I got an email saying the status of the app had been changed to “Pending” again. A couple days later, a very congenial Apple developer relations person called me and confirmed the rumor that the limit was indeed 1MB per minute. I said that I had already compressed the stream further and she said they’d rerun the metrics.

It was all very well handled, and to my satisfaction… but the question remains, if the limit for data transfer is a hard number (1MB/min) then why isn’t that written in the developer agreement? Why do they only communicate the details of the rules verbally after the fact? As with the no satire rule, it would would be nice to know what the specifics are in advance.

Backporch Revolution is an artist-run collective and netlabel based in New Orleans that specializes in releasing experimental electronic works by local musicians. The website is backporchrevolution.com

Posted in App Store, iPhone Apps, Radio BPR | Tagged , , , , , , , | Leave a comment

Apple v. Satire, part 17.

Pulitzer-prize winning satirist Mark Fiore had his app rejected by Apple because it “ridicules public figures.”

Regular readers will remember that Juggleware’s own app Freedom Time was actually the test case of this unwritten and up-til-then unknown policy, which had not been explicitly defined beyond the word “defamatory” briefly appearing.  For a timeline of other apps (there are at least 16 now) that have been banned for this silly charge, see this blog:

Apple’s Policy on Satire: 16 Apps Rejected for “Ridiculing Public Figures” [Cloud Four]

If there was an app rejected before September 2008 for political satire, we’d like to hear about it; please post in the comments below.

The interesting thing about the Mark Fiore case is that Apple has apparently reconsidered their rejection, and asked Fiore to resubmit his app. That’s great news, but does it really mean Apple is finally reconsidering their rather draconian policy? Or are they just trying to avoid the bad publicity that’s likely to escalate when the content is associated with the winner of a Pulitzer? I guess we’ll have to wait till the next rejection (or approval) to find out.

John Gruber of Daring Fireball makes the point that what’s most frustrating to developers is the grey area of ill-defined rules. Developers trying to navigate App Store policy plays out like trying to divine the will of a god, who is without a doubt omnipotent, but  rarely seems omniscient, and appears to mortals as vindictive and capricious at times. Or perhaps a closer amalgam could be a Kafka-esque bureaucracy, layers of obscure rules unseen by citizens, wheels moving cruelly behind the scenes towards some irreversible and arbitrary concept justice so thickly wrapped in red tape as to be impenetrable?

But back to the heart of it, what’s really so awful about demeaning public figures? Most of them need a swift kick in the ass. If it’s done in a way that’s not illegal or obscene,  that threatens violence or makes a patently untrue claim, then why the censorship? One possible answer might be that that’s it’s just wide cover for one public figure who is sacrosanct in the Apple canon, in which case I would like to suggest the following amendment to the satire rule:  No application may include images, text, or sound that demeans Steven P. Jobs.

At least that way we could still satirize everything else under the sun, and the rule would kind of be a parody of itself.

Posted in App Store, Freedom Time | Tagged , , , , , , , , , , , | Leave a comment

Juggleware app mentioned on NPR

NPR ran a story yesterday about Apple’s new iPad which just hit stores, but critics say that the “walled garden” approach (just like the iPhone) makes the Internet a less free place and could spell the end of the net as we know it. Freedom Time, our first app, was mentioned by Harvard Law professor Jonathan Zittrain as an example of corporate censorship in the App Store. Listen here:

http://www.npr.org/templates/story/story.php?storyId=125561844

You can also read more from Mr Zittrain on the subject in this piece from the Financial Times.

Posted in App Store, Freedom Time | Tagged , , , , , , | Leave a comment