iphone

Testing a iPhone app in iOS 3.0

I have a program that ran in iOS 2.0 and now am making some updates to it. I don't think I have done anything that won't be available in 3.0, but I don't have a 3.0 device around to test it on. I do know that I updated one deprecated function addTimeInterval to the new version dateByAddingTimeInterval a few questions - 1) Is there ...

Why is the UILabel text only on the first page of the UIScrollView

My scrollView shows images downloaded from a server. Now i want to show additional information in an UILabel. However this is only shown under the first image. When scrolling the UILabel is not shown :-( (void)populateImageArray:(NSNotification *)notif { NSUInteger i; CGFloat contentOffset = 0.0f; for (i = 0; i <= [items c...

How to get a main (window?) UIView in iOS?

I'm developing a PhoneGap app, extending it with native stuff. I can make an UIView like this: [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] and show some stuff like ActionSheets here. But the MBProgressHUD doesn't show up in this view. So how do I get the main view (or the PhoneGap's WebView)? ...

iPad application out of memory after only 5MB

I've looked carefully at leaks and I have none (very few - all under 400 bytes). I've read a few posts about not using imageNamed calls as they cache the images. I'm not using any of those. I'm using imageWithContentsOfFile. I AM using lots and lots of images. Mostly rendered myself using graphics contexts. I'm releasing everything and ...

why I can receive the old app's push notification when the iphone app reinstall?

uninstall the app first, then reinstall, I can receive the push notification normally. here is my analysis: client uninstalls app, but my provider server has the devicetoken. then reinstall,APNS delivers the same devicetoken to iphone,so when a new push item comes to APNS,it successly delivers the item to the client. my app has syn...

Implementing NSCoding for NSKeyedArchiver and memory leaks

I have a custom object that I am using NSKeyedArchiver to convert to NSData so my custom object implements the NSCoding protocol. But when I run the Instruments tool, it tells me that my initWithCoder method has a number of leaked NSCFString objects inside initWithCoder. What is the correct way to implement the NSCoding protocol? My c...

NSString in webview iPhone and objective-C

Hi, i have an NSString and a webView in my project (Objective-C for iPhone), i have called index.html in webView and in index.html i have written my script (javascript) How can i pass the NSString as a var in my script and viceversa? http://developer.apple.com/library/safari/#documentation/AppleApplications/Conceptual/SafariJSProgTopics/...

provisioning profile hell

once in a while I run across a problem with provisioning a device with a dev version of an app . The error message is usually "a valid provisioning profile for this executable was not found". I have followed all the Apple instructions: I have a valid dev certificate, the developer provisioning profile includes the device ID of the devi...

How to activate @2x high res graphics for retina display?

I have an old app and created @2x high res images for it. Now I've incorporated all these into my project, but when I build and run the app on the retina display test device I do not see the high res images. To be sure, I made some of them with strange colors so I know exactly if @2x is used or not. I also tried to clean my build and al...

How to use the new UIKeyboardTypeDecimalPad feature in iOS 4.1 SDK

Hi there, Right now I am using learning to program for the iphone and I am using a sample application that has the standard numeric keypad. I need to enter decimal points too but the numeric keypad does not have any. The SDK 4.1 supports this feature but I cannot set the keyboard type to be UIKeyboardTypeDecimalPad, at least I do not see...

Authenticating GKLocalPlayer with Game Center

I am trying to authenticate a GKLocalPlayer with Game Center. However, the code supplied by Apple - (void) authenticateLocalPlayer { [[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error) { if (error == nil) { // Insert code here to handle a successful authentication. ...

How to easily persist application state upon exit

Let's say that my application state is extracted into an object (so that all information specific to app instance is contained in one object) and that object supports nscoding protocol. How can i easily persist it and load it on exit/launch of my application? My current code looks like this - (BOOL)application:(UIApplication *)applicat...

Only White Fill Color is Transparent in UIView

I've got a UIView that is set to opaque = NO and it all works nicely. In the drawRect I'm doing custom drawing, and this works CGContextSetFillColor(context, CGColorGetComponents([UIColor blueColor].CGColor)); CGContextFillRect(context, labelOutside); CGContextAddRect(context, labelOutside); but this CGContextSetFillColor(context, C...

Xcode - Is there a way to get the extension of a resource?

Hey all, this should be pretty simple to answer: Is there a property of a NSURL such as lastPathComponent and StringByDeletingPathExtension that actually gives you just the extension instead? If so, what is it? Thanks! ...

iOS with JSON, PHP

I'm rather new to ios and json. I've managed to create a db in mysql and used php to create a basic read and write php pages. I'm using the TwitterHelper class from cs193p class for the presence assignment from Stanford to acces the php interface online and tie it to my ios code. I am getting an error which I can't solve. Update: O...

picking items from array that contains integers

i am trying to have an array that contains 5 integers(0,1,2,3,4) called questionNumber the questionNumber is supposed to end up with 4 so therefore i am trying to make a function to call randomly numbers 0-3 and go from one to another (add 1 to prevoius number) until they reach 4. How would this be implemented? many thanks ...

ASIHTTPRequest Unable to create request (bad url?) Error

I keep getting: Unable to create request (bad url?) error message on a request like: - (void)grabURLInBackground :(id)sender { NSURL *url= [NSURL URLWithString:@"http://api.website.com/api_requests/standard_request/getItemRequest={\"Id\":\"Logic\"}"]; ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; [request ...

How to get all the UITableViewCell from UITableView?

Hi Guys, I have a list reusable UItableViewCells. As what I want: after selecting one of the cells, the app should update the images on each Cell. For solving this requirement, I use method visibleCells to fetch all the cells from UITableView, and update the images in each cell by iterating the returned cell array. But the problem is:...

iPhone/iPad SimpleTableViewCells: What replaces the deprecated setImage setText on table cells?

iPhone/iPad SimpleTableViewCells: What replaces the deprecated setImage setText on table cells? The below code gives warnings that setImage and setText are deprecated. So what replaced them? What is the new better way to get this simple behavior? static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier"; UITableViewCell *cel...

Is there something special I must know when drawing images in core graphics?

Before the retina display came to iOS, I've developed some controls which are drawn using stretchable images and lots of core graphics code. Now I tested it on a retina display device, and the graphics are misplaced and distorted. Everything else that's loaded with @2x suffix and UIImage imageNamed works fine. I assume there must be so...