iOS Faultless to avoid any warnings

mikezang

macrumors 6502a
Original poster
May 22, 2010
772
1
Tokyo, Japan
I want to avoid any warnings when compiling my App, now I got some warnings from Open Source as below, there is a warning in initWithRootViewController, because it needs a class UIViewController as parameter, what can I do?

Code:
@interface InAppSettingsModalViewController : UIViewController {
}
@end

@implementation InAppSettingsModalViewController

- (id)init{
    InAppSettingsViewController *settings = [[InAppSettingsViewController alloc] init];
    self = [[UINavigationController alloc] initWithRootViewController:settings];
    [settings addDoneButton];
    [settings release];
    return self;
}
@end
 
Last edited by a moderator:

mikezang

macrumors 6502a
Original poster
May 22, 2010
772
1
Tokyo, Japan
What are you #importing?
Code:
#import "InAppSettings.h"
#import "InAppSettingsSpecifier.h"
#import "InAppSettingsConstants.h"
#import "InAppSettingsPSMultiValueSpecifierTable.h"
 
Last edited by a moderator:

jnoxx

macrumors 65816
Dec 29, 2010
1,343
0
Aartselaar // Antwerp // Belgium
Are you sure you want to init the InAppSettingsViewController in your InAppSettingsModalViewController.
rather then reusing the parentViewController?
also, why would you assign a navigationController to your self, what kind of context is this in?
Are you talking bout your app delegate when it concerns the warning or what?
 

mikezang

macrumors 6502a
Original poster
May 22, 2010
772
1
Tokyo, Japan
some other warnings are here:

warning1:
'NSObject' may not respond to 'connection:didReceiveResponse:'

Code:
#pragma mark NSURLConnection Delegate methods

- (void)connection:(NSURLConnection *)aConnection didReceiveResponse:(NSURLResponse *)response{
	assert(aConnection = connection);
	NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
	if ([response respondsToSelector: @selector(allHeaderFields)]){
		self.contentType = [[(NSHTTPURLResponse*)response allHeaderFields] valueForKey: @"Content-Type"];
		encoding = [NSString encodingForContentType: contentType];
		if ([contentType rangeOfString: @"html" options: NSCaseInsensitiveSearch].location != NSNotFound)
			parser.mode = ElementParserModeHTML;
		else
			parser.mode = ElementParserModeXML;
	}
	if ([connectionDelegate respondsToSelector:@selector(connection:didReceiveResponse:)])
		[COLOR="Red"][connectionDelegate connection:connection didReceiveResponse: response];[/COLOR]
	[pool release];
}

warning2:
Declaration of 'struct sockaddr_in' will not be visible outside of this function

Code:
// Use to check the reachability of a particular IP address. 
+ (Reachability *) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;
Are you sure you want to init the InAppSettingsViewController in your InAppSettingsModalViewController.
rather then reusing the parentViewController?
also, why would you assign a navigationController to your self, what kind of context is this in?
Are you talking bout your app delegate when it concerns the warning or what?
This code is from a Open Source InAppSettings at https://bitbucket.org/keegan3d/inappsettings/src/0d2d8574de9f/InAppSettings/InAppSettings.m

By the way, the code can be used and Modal View Controller can be shown.
 
Last edited by a moderator: