cn的yahoo.cn邮箱登陆登不上iphone?

iphone&通过经纬度获取城市yahoo天气预报(最新)
注:原来的版本不可以用了,yahoo改了写东西,现在只有通过yql来实现对天气的获取woeid的值,请大家注意看看:改法如下:
URL_LOCATION @"/geocode?
location=%f+%f&gflags=R&appid=yourappid"
(用宏定义的转义字符,居然在新浪博客显示不出来,只有裁图了,不裁图显示这个:#define
URL_LOCATION&@"&*
from geo.placefinder where text="%f,%f" and
gflags="R"",晕),但这样做还是会出错,解决方法请看下面的:
- (void)xmlReadConnect函数
首先声明一下:由于大陆的GPS定位的经纬度有误差,导致你所在的位置的经纬度有偏差,但能确定是在你当前所在的城市,因为我们只要所在城市,再通过城市获取yahoo天气预报,因此只要你在的城市是正确的即可。
&UIKit/UIKit.h&
@interface Weather : UIViewController&CLLocationManagerDelegate,NSXMLParserDelegate,NSURLConnectionDelegate,NSURLConnectionDataDelegate&{
CLLocationManager *&
&&&NSXMLParser *xmlP
NSURLConnection *urlC
NSMutableData
NSURLRequest
@property (assign)
CLLocationManager *
@property (nonatomic,retain) & NSString *getCurrentE
@property (nonatomic,retain) & NSDictionary *Dic_weathF
@property (nonatomic,retain)
& NSString *getwoeidV
- (void)xmlReadC
-(void)mapLocationPreL
Weather.m 文件
#import "Weather.h"
@implementation Weather
@synthesize
@synthesize
getCurrentE
@synthesize Dic_weathF
@synthesize getwoeidV
#define URL_FORECAST
@"http://xml./forecastrss?w=%@&u=%@"
//以前的版本用:
//#define URL_LOCATION
@"/geocode?location=%f+%f&gflags=R&appid=yourappid"
// 现在用yql,这里用到宏定义的转意字符
\ ,这里只有裁图了
//被新浪拦截了转义字符后是这样的,#define
URL_LOCATION&@"&*
from geo.placefinder where text="%f,%f" and
gflags="R""&,但这样做还是会出错,原因请看下面的 -
(void)xmlReadConnect函数方法
-(void)mapLocationPreLoad{
lma = [[CLLocationManager alloc]
lma.delegate = self;
lma.desiredAccuracy = kCLLocationAccuracyBest;
lma.distanceFilter = 5;
- (void)xmlReadConnect
//被注释的部分,是之前的版本&&
//CLLocationCoordinate2D coordinate =
[lm.location coordinate];& &
//NSString *URLString =
[NSString stringWithFormat:URL_LOCATION,coordinate.latitude, coordinate.longitude];//通过经纬度获取城市的woeid
//request = [NSURLRequest requestWithURL:[NSURL
URLWithString:URLString]cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];
urlConn = [[NSURLConnection alloc] initWithRequest:request delegate:self];
//if (urlConn)&
//& & webData = [[NSMutableData alloc] init];
//(改成这样了)改动之后注意:首先你要启动你的GPS,获取你所在地的经纬度,如果经纬度获取成功之后,然后通过经纬度获取woeid,之前的方法现在用不了了,现在yahoo通过经纬度获取woeid的方法改了,需要用yql来获取,yql的使用可以参考yahoo的yql用法。&
//URL编码中&表示空格符
,&&&表示双引号&,不懂的请自己去查询
URL编码手册啊&
&&//本来URLString =
from geo.placefinder where text="%f,%f" and gflags="R""
就可以了,但这样写会出错,因为这写%f参数和双引号的原因,所以要用URL编码来处理,方法如下:
//改动之后是:
//上面的方法只有通过三个字连接起来的
//这里只能用插图了,不好意思,因为新浪博客会拦截URL编码
- (void)viewDidLoad
[self&mapLocationPreLoad];
[self&xmlReadConnect];
- (void)connection:(NSURLConnection *)connection
didReceiveResponse:(NSURLResponse *)response
& [webData
setLength:0];
- (void)connection:(NSURLConnection *)connection
didReceiveData:(NSData
& [webData
appendData:data];
- (void)connection:(NSURLConnection *)connection
didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge
*)challenge
- (void)connection:(NSURLConnection *)connection
didFailWithError:(NSError
&&[urlConn release];
- (void)connection:(NSURLConnection *)connection
didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge
*)challenge
- (void)connection:(NSURLConnection *)connection
willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge
*)challenge
- (void)connectionDidFinishLoading:(NSURLConnection
*)connection
NSString *xmlString = [[[NSString alloc] initWithBytes:[webData mutableBytes] length:[webData length] encoding:NSUTF8StringEncoding] retain];&
if (xmlParser)
& & [xmlParser release];
xmlParser = [[NSXMLParser alloc] initWithData:webData];
[xmlParser
setDelegate:self];
[xmlParser
setShouldResolveExternalEntities:YES];
[xmlParser parse];
bool flagNow = YES;
- (void)parser:(NSXMLParser *)parser
didStartElement:(NSString
*)elementName namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qName
attributes:(NSDictionary
*)attributeDict
getCurrentElement =
elementN &
[getCurrentElement retain];
if ([elementName isEqualToString:@"yweather:condition"])//获取天气的信息
& & self.Dic_weathCondition =
attributeD
& & currentWeatherValue = [[[NSString stringWithFormat:@"%@",[attributeDict objectForKey:@"text"]] uppercaseString] retain];
& & currentTempValue& & =
[[[NSString
stringWithFormat:@"%@",[attributeDict objectForKey:@"temp"]] uppercaseString] retain];
NSLog(@"currentWeatherValue&=
%@,&currentTempValue&=
%@",[attributeDict&objectForKey:@"text"],[attributeDict&objectForKey:@"temp"]);
if ([elementName isEqualToString:@"yweather:forecast"])
& & if (flagNow == YES)&
& self.Dic_weathForecast =
attributeD& &
& flagNow =
& NSString
*stringWeather& = [NSString stringWithFormat:@"%@",[attributeDict objectForKey:@"text"]];
& NSString
*stringHighTemp = [NSString
stringWithFormat:@"%@",[attributeDict objectForKey:@"high"]];
& NSString
*stringLowTemp& = [NSString stringWithFormat:@"%@",[attributeDict objectForKey:@"low"]];
&NSLog(@"stringWeather= %@,stringHighTemp =
%@,stringLowTemp =
%@",stringWeather,stringHighTemp,stringLowTemp);
& flagNow =
- (void)parser:(NSXMLParser *)parser
didEndElement:(NSString
*)elementName namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString
if (qName)
& & elementName =
- (void)parser:(NSXMLParser *)parser
foundCharacters:(NSString
if ([[getCurrentElement
lowercaseString]
isEqualToString:@"woeid"])
& & getwoeidValue =&
//获取woeid的值 &
& & if (getwoeidValue.length&0)&
& NSString
*URLString = [NSString
stringWithFormat:URL_FORECAST,getwoeidValue, @"c"];& &
& request&= [NSURLRequest requestWithURL:[NSURL
URLWithString:URLString]cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];
& urlConn&= [[NSURLConnection alloc] initWithRequest:request&delegate:self];
(urlConn)&
webData = [[NSMutableData alloc] init];
& & [getwoeidValue
//内存泄漏问题大家自己改了,我只提高实现获取yahoo天气方法
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。最后登录11-1-22在线时间1380 小时赞0 注册时间10-2-9积分27帖子精华0UID143880
注册日期: 10-2-9
帖子: 20|积分: 27
赞助商广告
在mac的mail里面设置.cn的邮箱。
设置完后只能发件,不能收件,始终有一个惊叹号提示有问题。
同样是这个.cn的邮箱,在iphone和ipad里面设置都一切正常,能收能发。
请问这是哪里出了问题?谢谢!
最后登录16-6-22在线时间8043 小时赞0 注册时间13-10-7积分1201帖子精华0UID31532
( ☆☆☆ )
分享于 11-1-21 22:46:00
雅虎是这个样子的了,mail用要收费的[em03]
最后登录15-9-6在线时间1007 小时赞0 注册时间10-12-2积分758帖子精华0UID194535
( ☆☆☆ )
分享于 11-1-22 01:17:00
我用的一切正常能帮我注册一iphone ID,邮箱.cn ,谢谢_百度知道
能帮我注册一iphone ID,邮箱.cn ,谢谢
我有更好的答案
简单,但里面要有你的VISTA的卡,电脑 -设置-appstore里可以注册一个,会扣去1美元的注册费用
你能帮我注册吗
其他类似问题
为您推荐:
iphone的相关知识
下载知道APP
随时随地咨询
出门在外也不愁

我要回帖

更多关于 yahoo.cn邮箱登录 的文章

 

随机推荐