I'm having problem with my UIAlertView, Here is how I show it,
UIAlertView *message = [[UIAlertView alloc] initWithTitle:#"エラー"
message:#"Oneスロットに何も画像が設定されていません"
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[message show];
But then the preview looks like this:
What I wanted is to make it just 1 Line, but I have read in some thread/question that it shouldn't be done, what is the best way to do this without making my app being rejected? I Have read about changing its width, but is this allowed?
Related
For the first time I am playing with APNS, I tried to run a proof of concept, with an iOS 5.0.1 device, and the didFailToRegisterForRemoteNotificationsWithError is fired. I know it has been fired because I show an UIAlertView to notify the error:
- (void)application:(UIApplication*)application
didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
// Inform the user that registration failed
NSString* failureMessage = #"There was an error while trying to \
register for push notifications.";
UIAlertView* failureAlert = [[UIAlertView alloc] initWithTitle:#"Error"
message:failureMessage
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[failureAlert show];
[failureAlert release];
}
How can I get more info about the error?
Try doing something like NSLog(#"%#", error.userInfo");, that should output some info into the terminal.
I ended up with this code, which works and lets me progress a bit:
NSString* failureMessage = error.localizedDescription;
UIAlertView* failureAlert = [[UIAlertView alloc] initWithTitle:#"Error"
message:failureMessage
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil];
[failureAlert show];
Sorry, iObjectiveC noob here.
Looking for some help again...
I've currently got 2 sections of my app that need internet connection, 1 is a photo gallery through Flickr and the other a Twitter Feed, I was wondering if this is the correct code for the UIAlertView... I can get it working from a button but thats all!
{
-(void)didTap_roundedRectButton1:(id)sender forEvent:(UIEvent *)event {
UIAlertView *alertView = [[UIAlertView alloc] init];
alertView.title = #"You are not connected to the Internet!";
alertView.message = #"Please check your connection and try again...";
[alertView addButtonWithTitle:#"Ok"];
[alertView show];
[alertView release];
}
i think you need to use this example as i have used it to check is there any network is available and device is connected to any one of the network it is alos available on the apple's developer example site
example link is this
You should try this:
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:#"You are not connected to the Internet!"
message:#"Please check your connection and try again..."
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles: nil];
[alertView show];
[alertView release];
and can you post the code how do you create the UIButton?
i want to add a alter if the user is not connected to the internet and clicks on a webview link.
-(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Error" message:#"Can't connect. Please check your internet Connection" delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
Problem is here:
Void (-) gives error:(!)Invalid argument type 'void' to unary expression
Very possibly the problem does not lie with the -(void)webView:didFailLoadWithError method itself; rather, it seems you are using it in an incorrect way, i.e.. within an expression that requires a unary operator (e.g., negation, increment, etc.).
In other words, it seems you are trying to use the method's return value somewhere, but there is no return value from that method.
Check the code where you call -(void)webView:didFailLoadWithError...
This is very simple you dont have to code in any delegate method for check weather the user is connected to internet,for example the there is a login page for you and the user logs in but network is not connectd ,so we have to give an alert to user that the network is not connectd right?just simply add the
if(responce == nil)ie,responce from the url
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Error" message:#"Can't connect. Please check your internet Connection" delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil];
[alert show];
[alert release];
} else you code
Every 10 min I synchronize my app with server, and when something wrong with server, I show UIAlertView.
NSString *alertTitle = #"Sync failed";
NSString *alertMessage = #"Something wrong with server"
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:alertTitle
message:alertMessage
delegate:nil
cancelButtonTitle:NSLocalizedString(#"OK", #"OK button title")
otherButtonTitles:nil];
[alertView show];
[alertView release];
If to shoot down server and do not touch phone, in hour there will be 6 Alert Dialogs, and I supposed to close 6 AlertDialogs. How to fix that ? Can AlertView check if its already shown to user or something like that ? Thanks...
I'm reading some content from database using SQLite.
It then will be shown in a UIAlertView.
The content contains some new line symbol "\n".
However, it doesn't create a new line in the alert. Instead, the "\n" is shown.
Following is portion of my code:
description = [[NSString alloc] initWithUTF8String:(char *)sqlite3_column_text(selectStatementE, 0)];
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:#"something" message:description delegate:nil cancelButtonTitle:#"Cancel" otherButtonTitles:nil];
[alert show];
Is there anything I can do to make it recognisable?
Thanks in advance!
string with new line character will work without any spl implementation
example
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:#"Print " message:#"line1\nline2\nline3\nline4" delegate:nil cancelButtonTitle:#"Ok" otherButtonTitles:nil];
[alert show];
[alert release];
just Print and check whether your description belongs to following format