InAppSettingsKit multi value not showing options - iphone

I have just managed to create my settings.bundle and set up a selection of different settings. However when I run my app and view the settings via InAppSettingsKit, the multi value options aren't displayed. I see the title and I can select it, then when it should display the options it just shows n empty cells (except for the tick).
The odd thing is that if I go into the Apple Settings app and check out the multi value settings they all show up as expected. Does anyone have any idea whats going on?
This is the code I'm using in my .h file:
#import <UIKit/UIKit.h>
#import "IASKAppSettingsViewController.h"
#interface myViewController : UIViewController <IASKSettingsDelegate, UITextViewDelegate>
{
IASKAppSettingsViewController *appSettingsViewController;
}
And in the .m file I have the following:
- (IBAction)optionsButtonSelected:(id)sender
{
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];
}
Below is a screenshot of a portion of my settings bundle (showing on of the problematic multi-value options):
And here is a screenshot showing what is displayed in the in app settings section when I click on Style:

I managed to resolve this issue by resetting the iPhone simulator. It seems it was getting confused between some old and new plist settings for some reason.

sorry it won't allow me to vote up. I also fixed a similar problem by quitting the simulator and running the app again (also try to delete the app?).

Related

objective-c : How to move from AppDelegate in Universal app?

I am developing a Universal app where I have
imageTracker_iPhone.xib
imageTracker_iPad.xib
imageTracker.h
imageTracker.m
I want to move from AppDelegate_iPhone to imageTracker. I am doing this in didFinishLaunchingWithOptions but its not working before this code I was using
imageTracker *vRDi = [[imageTracker alloc] initWithNibName:#"imageTracker_iPhone" bundle:nil];
[self.view addSubview:vRDi.view];
but it gave error request for member 'view' in something not a structure or union
. Even if code is like
[window addSubview:vRDi.view];
now The function is like below and its not working. I want to move from AppDeligate to imageTracker. please help
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[window addSubview:imageTracker.view];
[self.window makeKeyAndVisible];
return YES;
}
In this case It does not move to imageTracker_iPhone because did not tell any where to move to this file, so want to know that HOw to tell that which file to move either imageTracker_iPhone or imageTracker_iPad.
You probably want to set the delegate window's rootViewController to make your first controller active. (If you create a new test app from a single controller, non-storyboard template, you can see the kind of code that's needed in didFinishLaunchingWithOptions:.)
Edit: Actually, it's even easier than that. If you specify a universal app when creating a single view controller project, it creates the exact code to test which kind of device and load the matching .xib file. (Xcode 4.2, at least.)
your code should be something like this
imageTracker *vRDi;
Bool isiPhone = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone;
if(isiPhone)
vRDi = [[imageTracker alloc] initWithNibName:#"imageTracker_iPhone";
else
vRDi = [[imageTracker alloc] initWithNibName:#"imageTracker_iPad";
and make sure that your connect view outlet in both xib's and the file owner is "imageTracker" Class.

Puzzling Error on Iphone AddSubView function

if(popup != nil) {
[popup.view removeFromSuperview];
[popup release];
}
popup = [[OfferPopup alloc] initWithNibName:#"OfferPopup" bundle:nil];
popup.offer = offer1;
popup.delegate = self;
[self.view addSubview:popup.view];
1)The App crashed when trying to do the addSubView popup.view
2)I stepped through the code and checked offer1 is valid, popup is valid has a memory address. popup is a view controller.
3)The current module is a viewcontroller too.
4)The App crashed due EXEC_BAD_ACCESS.
5)I used performance tool and enabled Zombie checking, and ran it, again the app crashed without the performance tool indicate where the reference count goes wrong.
I am puzzled as how to troubleshoot.
Check if Popup xib file exists, or see if you are naming it right in your initialisation code. See if the viewController class is correctly assigned in File Owner in IB.

How to start an iphone app so that it doesnt use any nib files?

I've been reading about pros/cons of programming with/without an interface builder and i want to try writing an app from scratch. however, even with a window based application it creates a xib file and i would like to remove this but not sure what to do after. just really need that jump start. Thanks!
Fundamentally you have to specify the appDelegate in UIApplicationMain() (in main.m), that is... from:
int retVal = UIApplicationMain(argc, argv, nil, nil);
to:
int retVal = UIApplicationMain(argc, argv, nil, #"MyAppDelegate");
then in MyAppDelegate's method application:didFinishLaunchingWithOptions: you have to manually create your UI:
// initialize application's window
_window = [[UIWindow alloc] initWithFrame:MAIN_FRAME];
// activate and display application's window
[_window makeKeyAndVisible];
...and so on
There are few ways, one of the simple ones:
Go to the project files navigator, look for
"Supporting Files -> XXX-info.plist",
then look for this:
Main nib file base name:
Remove this.
Hope this help
You can create any project and while you add new viewController just uncheck the checkbox which says "With XIB for UserInterface" (shown below with a red arrow).
This would allow you to create viewControllers without the XIB.
But then you will have to put all the controls programmatically for the viewController
Dont use the viewController which comes in by default and add newViewController with the method mentioned above.
Then start creating controls you want like UIButton, UILabel, etc using its allocation(alloc) and initialization(init) methods and set its frames.
Then you need to set any attributes as per your requirement and then just add it as a subview to your main view of the viewwController. So it would be something like say adding a textField dynamically would be:
UITextField *txtField = [[UITextField alloc] initWithFrame:CGRectMake(150,30,40,24)];
txtField.textColor = [UIColor blueColor];
[self.view addSubview:txtField];
Hope this helps you.
Hopefully following step will be useful.
Open ProjectNameInfo.plist file and then remove the property called Main nib file base name (toward the bottom of the Information Property List). You can remove a property by clicking to select it and then pressing the Delete key.
Under Other Sources, open main.m, and change the last argument of the call to UIApplicationMain from nil to the name of your application delegate class (for example, #"ProjectNameAppDelegate").
Do following changes in AppDelegate class didFinishLaunchingWithOptions: method
//Get Rects of screen
CGRect screenBounds = [[UIScreen mainScreen] bounds];
//Allocate Window
m_window = [[UIWindow alloc] initWithFrame: screenBounds];
//Allocate custom Views
m_view = [[MyView alloc] initWithFrame: screenBounds];
//Add View And make window visible
[m_window addSubview: m_view];
[m_window makeKeyAndVisible];
return YES;
-> I learned it from book iPhone 3D programming: Philip Rideout : O'Reilly publication.
You should find above in goole books and read some pages for further understanding because only above explanation may not be enough.
Moreover, After doing above steps you can make any number of view controllers and views without using xib...so refer to various programming guide documents provided by apple.
Good Luck
I've made some nib-less project templates for Xcode 4: MinimalisticXcodeTemplates (GitHub).

What does "WARNING: Input manager failed to load static dictionary for: nl_NL" mean?

I've been working on a dutch localization of a xib file. When I run my app in the simulator, I get the following message in the log console:
WARNING: Input manager failed to load static dictionary for: nl_NL
I've tried to reset the simulator, I've deleted the app, I removed the localization stuff and added it again, I've cleaned my project, but nothing seems to work. I keep getting this warning message.
My questions:
- can I ignore it?
- how can I get rid of this warning?
I've searched the web, but can't seem to find any answer.
If it happens only in the simulator and doesn't cause any other issues, I wouldn't worry too much about it. I just saw this warning for the first time today too.
Some follow-up questions may help:
Which SDK are you using?
Does it happen if you create a new Xcode project from a template?
Is your app still loading the localized nib correctly?
I get the same message when I localise to Spanish (es_ES), but not when I localise to Japanese and to Simplified Chinese (or English for that matter).
I haven't been able to trace the cause or fix this. However in my case this is definitely not the localised xib files, but it arises when I call:
- (NSString *)language {
NSSet *supported_languages = [NSSet setWithObjects: #"en", #"es", #"ja",
#"zh-Hans", nil];
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
NSArray *languages = [defs objectForKey:#"AppleLanguages"];
NSString *primary_language = [languages objectAtIndex:0];
if ([supported_languages containsObject:primary_language]) {
return primary_language;
}
return #"en";
}
But this is only in the simulator.
On the device it works just fine as far as I can tell and I'm ignoring it.
I'm using the 4.2 SDK. I've created the project from a template. It's still loading the localized nib correctly.
What I did find out was the following: it seems to happen only if I run the following code in the didFinishLaunchingWithOptions selector inside the AppDelegate.m file:
AboutViewController *controller = [[AboutViewController alloc]
initWithNibName:#"AboutViewController" bundle:nil];
[self.window addSubview:controller.view];
[self.window makeKeyAndVisible];
If I comment out these lines, and replace it with another subview, it doesn't happen. The AboutViewController nib was the one which was localized. If I display the same view when the user clicks on an (i) information button, it just works and without the warning. It just gives me the warning when I do it from the AppDelegate.

iOS4 ABNewPersonViewController Loses Data Entered when attempting to add a Photo iPhone 4

I have implemented a basic add contact feature to an iOS 4 application. Following the documentation from Apple, I have created a navigation controller, and set its root view to the ABNewPersonViewController. I have implemented the delegate as well. The basic mechanics all work.
The problem I am having is when you add a photo to the new person that is very large (taking a photo or picking one from the library), the ABNewPersonViewController form returns empty when the camera controls are dismissed. No photo is in the add photo box either. If I pick a small image (say a screenshot from the iPhone), everything works. I can see from the debug output: Received memory warning. Level=1
Has anyone else run into this? Is there a way to set the photo quality to a lower setting for the ABNewPersonViewController? Any help appreciated.
ABNewPersonViewController *abNewPersonView = [[ABNewPersonViewController alloc] init];
abNewPersonView.newPersonViewDelegate = self;
UINavigationController *newNavigationController = [UINavigationController alloc];
[newNavigationController initWithRootViewController:abNewPersonView];
[self presentModalViewController:newNavigationController animated:YES];
[abNewPersonView release];
[newNavigationController release];
If ABNewPersonViewController does not handle memory warnings correctly, file a bug with apple.