Objects disappearing from Xcode Object Library Palette - ios

I am relatively new to iPhone development.
When I open Xcode, my object library palette contains an "Address Book People Picker View" and other objects that disappear when I select a .xib file. This seems to be consistent with the behavior mentioned here: XCode Developer API - Object Library - Objects Disappearing
The above answer suggests that the Xcode palette is initially populated with all iOS and Mac objects, but then amends the list appropriate to the target when the XIB file is selected. I thought that the AddressBook framework/objects were supported in iOS so if only iOS objects remain then why are the AddressBook objects disappearing?
Thanks in advance

I don't believe you can use the AddresBookUi framework objects in Interface Builder, but must instantiate them programmatically. Some of them used in specific ways to function correctly, for example ABUnknownPersonViewController must be embedded in a navigation controller.
Since many of these views cannot be used in a generic fashion they are not exposed in interface builder to prevent confusing users.
For example:
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;
[self presentModalViewController:picker animated:YES];
[picker release];

Related

MPMediaPickerController fails to announce controls with VoiceOver

I'm debugging an app that requires full accessibility using VoiceOver and one feature ask the user to select songs to play. The app uses MPMediaPicker. The problem is that MPMediaPicker does not really meet VoiceOver accessibility requirements, for example it does not announce whether an element of the list is selected or not, it does not clearly announce when the user select an element, when searching it does not announce the number of selected elements in the list as the list get pruned down and, worse of all cases, it does not announce anything at all when the button Add All Song is selected (it just stay silent).
It seems to me that these are pretty big oversights for a standard component so widely used and i'm wondering what can i do to fix these for my client as it explicitly says in the Apple documentation that i can't subclass MPMediaPickerController nor manipulate its private view hierarchy.
Of concern is also the fact that the my app also uses the standard component to select contacts which also seems to have similar issues.
Thank you.
Edit:
The app present the MPMediaPickerViewController using this code, which i believe it is fairly standard (perhaps a bit outdated since it still uses retain/releases)
MPMediaPickerController *picker = [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeAnyAudio];
[picker setDelegate: self];
[picker setAllowsPickingMultipleItems: YES];
picker.prompt = NSLocalizedString (#"...", "...");
[[myAppDelegate instance] presentModalViewController: picker animated: YES];
[picker release];
where presentModalViewController is this:
- (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated {
UIViewController *c = self.window.rootViewController;
while ([c presentedViewController]) {
c = [c presentedViewController];
}
[c presentModalViewController:modalViewController animated:animated];
}
The missing announcements in the voice over belong to components shown as part of the selection process and in the hierarchy of MPMediaPickerController, so i don't know how to access them.
The above code is called inside the IBAction of a simple (+) right bar button of a ViewController that belongs to a NavigationController.
Further note:
Minimal proof of concept: create a default single page iOS application in Xcode. Add #import MediaPlayer; and then add this code to the ViewController.
- (void)viewDidAppear:(BOOL)animated {
MPMediaPickerController *picker = [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeAnyAudio];
[picker setDelegate: self];
[picker setAllowsPickingMultipleItems: YES];
picker.prompt = NSLocalizedString (#"...", "...");
[self presentViewController:picker animated:true completion:^{
}];
}
Launch the app with VoiceOver activated, then select or navigate to the cell "Add All Song": the item is not announced by VoiceOver in any way.
I think this summarize things pretty well. From Apple Documentation in reference to the MPMediaPickerController:
This is a preliminary document for an API or technology in development. Apple is supplying this information to help you plan for the adoption of the technologies and programming interfaces described herein for use on Apple-branded products. This information is subject to change, and software implemented according to this document should be tested with final operating system software and final documentation. Newer versions of this document may be provided with future betas of the API or technology.
This control is not complete, and probably never will be complete, given that this has been considered a "beta" API since iOS 3.0.
Also, to summarize my findings, it is not possible to make this control accessible. I was able to play around with its views a bit, and every time I was able to add additional labelling it was soon overridden and reset. Finding the correct callbacks to reset the labels every time they were overridden by the controls default behaviors would be difficult (impossible) and obviously we cannot override the UIAccessibilityProtocol methods of the individual elements, because they are not controls we instantiated. We have instantiated the global control, and it is drawing everything for us. Finally, this would be considered by a reviewer to be accessing private APIs and so would not be allowed on the App Store regardless.
Conclusion: In order to provide the accessibility support you wish, you will have to implement a similar control manually.

Skobbler how i can download a custom map?

I'm using skmaps in a ios app, in this app i have to work offline with cities map and so i have to download the maps the user select. I have implemented the code in the example:
#import "MapJSONViewController.h"
#import "MapDownloadViewController.h"
The mapJsonViewController is initialized with this block of code:
AppDelegate *appDelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
NSArray *packages = [appDelegate.skMapsObject packagesForType:SKTPackageTypeContinent];
MapJSONViewController *mapXMLVC = [[MapJSONViewController alloc]initWithNibName:#"MapJSONViewController" bundle:nil withSKMapPackages:packages];
[self.navigationController pushViewController:mapXMLVC animated:YES];
With :
SKTPackageTypeContinent or SKTPackageTypeCity ecc...
I'm able to start the controller with the desired hierarchy level of elements but selecting the cities hierarchy i have found that many cities are missing... The documentation is a little bit poor about this detail but, how i can create a download for a city that isn't in that list? Maybe i can create a custom area to download setting some viewport coordinate (that's the best solution)?
Currently the only way of "adding" cities/regions to the list is to email the Scout/skobbler team directly and they will create the new map cuts for you (you cannot do it yourself via the SDK, programmatically).

Aviary ios SDK memory not released after dismiss

I am using Aviary SDK 3.0 in my app, I put the Aviary code in a popover like this, but after I dismissed the popover using [popover dismissPopoverAnimated], the Aviary is still in the memory Heap, this is even true, even after I dismissed the parent viewcontroller. is it expected that the Aviary code is cleaned up after I dismiss?
in the action when use tap the photo. I present it here
AFPhotoEditorController *editorController = [[AFPhotoEditorController alloc] initWithImage:imageToEdit];
[editorController setDelegate:self];
if (popover == nil)
popover = [[UIPopoverController alloc] initWithContentViewController:editorController];
else
[popover setContentViewController:editorController animated:YES];
https://dl.dropboxusercontent.com/u/23238574/Screenshots/aviarypopover.png
From the docs:
"Note that pushing the controller onto a UINavigationController's stack is not recommended, since the Photo Editor itself uses a subclass of UINavigationController."
try presenting it modally, then what I do just to make me feel better about all memory getting cleaned is to make a strong property and go through the checklist
[editorController removeFromParentViewController];
editorController.delegate = nil;
editorController = nil;
something about clearing the delegate seems to clear my memory better, although, I don't think you need it.
also, don't forget:
"By default, Aviary keeps a small number of OpenGL objects loaded to optimize launches of Aviary products."
[AFOpenGLManager requestOpenGLDataPurge];
// to request a clear,
// "Calls to requestOpenGLDataPurge only apply to the currently loaded OpenGL data,"
You can set it to clear regularly with
[AFPhotoEditorCustomization purgeGPUMemoryWhenPossible:YES];
if you're doing this, it's a good idea to preload some of the editor if you know they'll be using it soon
[AFOpenGLManager beginOpenGLLoad];
This memory leak has been addressed in subsequent releases of the SDK. Please visit developers.aviary.com to get the latest version.

Generating a view programmatically in iOS

Update:
Thanks for all the tips, everyone. The tutorial mentions that a XIB file is provided (which I don't have) so I'm doing something wrong in how I'm creating the the project.
I am following Apple's Core Data Tutorial for iOS. This tutorial has not been updated for ARC—apparently for Xcode 4, since it asks to "create a new project using the Window-Based Application template in the iOS section."
Since that option doesn't exist under Xcode 4.4.1, I looked around Stack Overflow and read that I should create an empty application. As per the tutorial instructions, I created no Storyboard or NIB file.
Other than updating the code for ARC (using strong in place of retain and not implementing the provided dealloc method), I'm confident that the code in my project matches that of the tutorial up to the end of the chapter "The Table View Controller." At this point, the tutorial says I should be able to run the project and get a view.
Instead, I get a blank, black screen.
Maybe my problem is too vague to solve here, but should I perhaps be using a different project template? Which one?
I have only two classes: a RootViewController and an AppDelegate. AppDelegate imports RootViewController and contains a UIWindow property. Again, there is no Storyboard or NIB in the project.
I can provide any code too if there's someplace specific to look.
If you want to check if your setup is correct do the following:
add a background color to your window
self.window.backgroundColor = [UIColor whiteColor];
make sure you tell the window to display itself
[self.window makeKeyAndVisible];
make sure your view controller is the window's rootViewController
self.window.rootViewController = myViewControllerInstance;
Choose Single View Application, and uncheck 'Use storyboards" field. The rest should go the same.

How to integrate the InAppSettingsKit?

I have just downloaded the InAppSettingsKit and I'm trying to integrate it with my app however I'm having some issues with it since I can't find any documentation to help me out. So far I've done the following steps...
I added the InAppSettingsKit directory to my Xcode project.
I created a new UIViewController class for my settings (which I named settingViewController).
At this point I have become a bit stuck as I'm not sure what needs to be done. If someone could offer some steps on how to integrate this it would be really really helpful as I can't find any up to date documentation online.
Usually, you don't need 2. You just configure a button action to display IASKAppSettingsViewController. This could look like this (in this case for a modal presentation):
appSettingsViewController = [[[IASKAppSettingsViewController alloc] initWithNibName:#"IASKAppSettingsView" bundle:nil] autorelease];
appSettingsViewController.delegate = self;
appSettingsViewController.showDoneButton = YES;
UINavigationController *aNavController = [[[UINavigationController alloc] initWithRootViewController:appSettingsViewController] autorelease];
[self presentModalViewController:aNavController animated:YES];
Check MainViewController.m in the sample app for different ways to present it (navigation push, tabBarItem, etc.).

Resources