Skip to main content

Posts

Showing posts with the label ios

iOS UI elements porting on Android

ladies and gentlemen! Very often on my job I meet the following requirement from the client, when developing android applications: "make it look like and iPhone app". Yes, I know, that the best way is to offer him canonical Android design with all these patterns like dashboard, using menu button etc... But sometimes this is not the case, as instead, I have to make it look and animate just the same. It's frustrating. Can you guys, please advice me an android library (if there is one) with iOS-like UI elements? Many thanks in advance, I'm looking forward to hearing from you! Source: Tips4all

Check for private API "usage” yourself?

So, we all know Apple forbids using private or undocumented APIs in iOS apps. I have no problem with this, as there are sound technical reasons for why this is a good idea. However, twice now I've had an app rejected for using private APIs, when this was not actually the case. It's not difficult -- the private APIs include symbols like connectionState , setThumbnail , setOrder and so on. Any calls you make to methods named as such will be flagged as a private API use, even if the method being called is something you have defined yourself. For a program doing something with connections, thumbnails or the order of things, the above mentioned method names aren't all that unlikely. Getting rejected for this and having to rename a method and resubmit delays everything by at least a week while you wait for a new review. So is there a way, using nm , class dumps of the iOS frameworks, etc to find out for yourself if your method names conflicts with anything in there? If s

Get launch orientation of iPad app

In my iPad app, I need to run some layout code to set the proper layout depending on the orientation. By default, the layout is configured for the landscape orientation, so in the case that the app starts in portrait mode, I need to take extra action to configure the views properly for display in portrait. In my -application:didFinishLaunchingWithOptions: method, I check the orientation using [[UIDevice currentDevice] orientation] . The problem here is that it always returns portrait even if the app is starting in landscape. Is there any way around this?

Looking for a graph layout framework for iOS

For an iOS application I'm making I need to show groups of elements grouped together according to their type, and different groups of types separated from each other in a nicely done layout. I thought of using an undirected graph, with the grouped nodes all pointing to each other in a sort of circular reference, and then each group as another "meta-graph" with their nodes point at each other in a circular reference as well, hoping that together with a good graph layout framework this could be displayed nicely. Unfortunately, the only framework I keep hearing of is graphviz , but that doesn't seem to have an available port for iOS. So my question is either: Other ideas for how to implement what I need? A good implementation of graph layout for the iOS? An available port of graphviz for the iOS? Update : Please note, I am not looking for graph plotting frameworks, which are the frameworks used to draw graphs and charts (such as pie charts etc)

UIDocumentInteractionController adding custom actions to menu (eg email, save to photos)

I've started using UIDocumentInteractionController for a new app but I'm wondering how to add additional actions to the action menu that you get on the preview screen? It seems that the menu only lists apps that have registered for a given url type plus I'm seeing PRINT showing up on iOS4.2. I would like to add send by email and save to photos but don't see a way of extending this menu. I can code the actions I want OK, it's just adding them into the menu that seems impossible? Am I missing something obvious?

What causes (and how can I fix) this odd Core Location error?

ERROR,Generic,Time,320195751.128,Function,"void CLClientHandleRegistrationTimerExpiry(__CFRunLoopTimer*, void*)",Registration timer expired, but client is still registering! There are only a few mentions of this problem that I was able to dig up in the wider Internet, and nobody has useful info. Here's the context: I have an app that monitors the device's location via CLLocationManager's startUpdatingLocation method. It starts monitoring, runs for a little while, then this message pops up in the debug output. From that point forward, no more location updates are delivered. This error is killing the location functionality of the app, and I'm at a loss as to what may be causing it. It even has an exclamation point at the end, which means it's clearly an exciting error. Update: Though I never found a solution to the problem, or figured out why it happens in the first place, I've also lost the ability to reproduce it. This seems to have h

How do I replace weak references when using ARC and targeting iOS 4.0?

I've begun developing my first iOS app with Xcode 4.2, and was targeting iOS 5.0 with a "utility application" template (the one that comes with a FlipsideViewController). I read that since ARC is a compile-time feature, it should be compatible with iOS 4 as well, so I attempted to target my app to 4.3, and try compiling it. When I do so, I get this error: FlipsideViewController.m: error: Automatic Reference Counting Issue: The current deployment target does not support automated __weak references It is referencing this line: @synthesize delegate = _delegate; That variable is declared as: @property (weak, nonatomic) IBOutlet id <FlipsideViewControllerDelegate> delegate; I understand that "weak references" are not supported in iOS 4, but I don't really understand why I would want to use a weak reference to begin with, nor can I figure out how I would rewrite things to avoid using it, while still taking advantage of ARC (after all, it's su

Linker Error in Xcode 4.2 Developer Preview

d /Users/yariksmirnov/Library/Developer/Xcode/DerivedData/Goozzy-cugjuvvsrzjqwvfiicxtykbqagux/Build/Products/Debug-iphonesimulator/Goozzy.app/Goozzy normal i386 cd /Users/yariksmirnov/Desktop/Goozy/branches/new setenv MACOSX_DEPLOYMENT_TARGET 10.6 setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/yariksmirnov/Library/Developer/Xcode/DerivedData/Goozzy-cugjuvvsrzjqwvfiicxtykbqagux/Build/Products/Debug-iphonesimulator -F/Users/yariksmirnov/Library/Developer/Xcode/DerivedData/Goozzy-cugjuvvsrzjqwvfiicxtykbqagux/Build/Products/Debug-iphonesimulator -filelist /Users/yariksmirnov/Library/Developer/Xcode/DerivedData/Goozzy-cugjuvvsrzjqwvfiicxtykbqagux/Build/Intermediates/Goozzy.build/Debug-iphonesimulator/Goozzy.build/O

iOS UIImagePickerController result image orientation after upload

I am testing my iPhone application on an iOS 3.1.3 iPhone. I am selecting/capturing an image using a UIImagePickerController : UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; [imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera]; [imagePicker setDelegate:self]; [self.navigationController presentModalViewController:imagePicker animated:YES]; [imagePicker release]; - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { self.image = [info objectForKey:UIImagePickerControllerOriginalImage]; imageView.image = self.image; [self.navigationController dismissModalViewControllerAnimated:YES]; submitButton.enabled = YES; } I then at some point send it to my web server using the ASI classes: ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"http://example.com/myscript.php"]]; [request setDelegate:self]; [request setStringEnc

Where is set the active build configuration in Xcode 4

I have 3 configurations in my project (Debug, Distribution_AdHoc and Distribution_AppStore). In Xcode 3 we had a list to choose device, version, configuration and target before build and run. Now with Xcode 4 we only have the device kind and version in this list. This bring my two questions: So where is defined the configuration used ? Is that the configuration defined in "Project > Info > Command-line builds use: Debug" ? And now the "Project" menu is replaced by "Product" So where can we create (or duplicate and edit) a Configuration ? Thank you.

UISegmentedControl change event not firing in iOS5

I have a UISegmentedControl whose "Value changed" event is wired up in Interface Builder to call my controller's -(IBAction)segmentChangeAction:(id)sender; When the user taps on the control to change the selected segment, as expected segmentChangeAction is called whether in iOS4 or iOS5. When I programmatically change the selected segment through segmentedControl.selectedSegmentIndex = newIndex; , on iOS4 segmentChangeAction is called and the segment reflects the new selection. However on iOS5 segmentChangeAction is not called, yet the segment does reflect the new selection. Is this a change in iOS5? Is there anything I can do to get segmentChangeAction called on iOS5 when I programmatically change the selection?

Force a WebView link to launch Safari?

I have a UIWebView embedded within an iPhone app of mine. I want to be able to have certain links within that webview open into the full Mobile Safari app (i.e. not my embedded version of it). Is there a simple way to structure some of my hrefs to force this, instead of every link opening within my embedded webview? Thanks.

"No previous prototype for function&rdquo; warning

i use shareKit to myself program . but in the FBConnectGlobal, there are some warning, NSMutableArray* FBCreateNonRetainingArray() { CFArrayCallBacks callbacks = kCFTypeArrayCallBacks; callbacks.retain = RetainNoOp; callbacks.release = ReleaseNoOp; return (NSMutableArray*)CFArrayCreateMutable(nil, 0, &callbacks); } like this method, it warning:"No previous prototype for function FBCreateNonRetainingArray"

Why is UIBezierPath faster than Core Graphics path?

I was playing around with drawing paths, and I noticed that in at least some cases, UIBezierPath outperforms what I thought would be a Core Graphics equivalent. The -drawRect: method below creates two paths: one UIBezierPath, and one CGPath. The paths are identical except for their locations, but stroking the CGPath takes roughly twice as long as stroking the UIBezierPath. - (void)drawRect:(CGRect)rect { CGContextRef ctx = UIGraphicsGetCurrentContext(); // Create the two paths, cgpath and uipath. CGMutablePathRef cgpath = CGPathCreateMutable(); CGPathMoveToPoint(cgpath, NULL, 0, 100); UIBezierPath *uipath = [[UIBezierPath alloc] init]; [uipath moveToPoint:CGPointMake(0, 200)]; // Add 200 curve segments to each path. int iterations = 200; CGFloat cgBaseline = 100; CGFloat uiBaseline = 200; CGFloat xincrement = self.bounds.size.width / iterations; for (CGFloat x1 = 0, x2 = xincrement; x2 < self.bounds.size.width; x1

Best way to use RestKit in an iPhone Application

I am writing an iPhone application and I have finally decided to use RestKit as the framework for connecting to REST Services. The way I am thinking of building is to have the Controllers in my application be completely agnostic to RestKit. For eg. If I had a login screen, in the usual RestKit scenario (based on example programs as well as few blog entries created by the RestKit developers) you will have the controller implement the RKRequestDelegate protocol and use the RKClient to call the service in the Controller passing self ( the controller) as the delegate. I would like to hide that from the User developing the Controllers and views. What I am thinking of is the following. I will have a LoginService which will login the user. There will be protocol LoginServiceDelegate which has two methods for success and failure. And the Controller can implement the LoginServiceDelegate and call the login Method in LoginService and get a success or failure callback. However to do this,

Json-RPC Method from iOS to Android

I have a java webservice, with some method. The webservice methods are in this form: @Webservice(paramNames = {"email", "password", "stayLogged", "idClient"}, public Response startSession(String email, String password, Boolean stayLogged, String idClient) throws Exception { boolean rC = stayLogged != null && stayLogged.booleanValue(); UserService us = new UserService(); User u = us.getUsersernamePassword(email, password); if (u == null || u.getActive() != null && !u.getActive().booleanValue()) { return ErrorResponse.getAccessDenied(id, logger); } InfoSession is = null; String newKey = null; while (newKey == null) { newKey = UserService.md5(Math.random() + " " + new Date().getTime()); if (SessionManager.get(newKey) != null) { newKey = null; } else { is = new InfoSession(u, rC, newKey); if (idClient != null && id

Json-RPC Method from iOS to Android

I have a java webservice, with some method. The webservice methods are in this form: @Webservice(paramNames = {"email", "password", "stayLogged", "idClient"}, public Response startSession(String email, String password, Boolean stayLogged, String idClient) throws Exception { boolean rC = stayLogged != null && stayLogged.booleanValue(); UserService us = new UserService(); User u = us.getUsersernamePassword(email, password); if (u == null || u.getActive() != null && !u.getActive().booleanValue()) { return ErrorResponse.getAccessDenied(id, logger); } InfoSession is = null; String newKey = null; while (newKey == null) { newKey = UserService.md5(Math.random() + " " + new Date().getTime()); if (SessionManager.get(newKey) != null) { newKey = null; } else { is = new InfoSession(u, rC, newKey); if (idClient != null && id