我想用ASIHTTPRequest重现这个http标头调用.我怎么能这样做?
Host www.host
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.2.17) Gecko/20110420 Firefox/3.6.17
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 115
Proxy-Connection keep-alive
Cookie fe_typo_user=71
Run Code Online (Sandbox Code Playgroud) 这是我的代码:
enum SymptomPeriod {
case Day
case Night
}
enum SymptomType {
case Breathing(SymptomPeriod)
case Breathlessness(SymptomPeriod)
case Opression(SymptomPeriod)
case Cough(SymptomPeriod)
case ActivityLimited()
case SecureTreatment()
}
struct Symptom {
let type: SymptomType
let date: NSDate
}
Run Code Online (Sandbox Code Playgroud)
我有一系列的症状.
let symptomList: [Symptom] = ...
Run Code Online (Sandbox Code Playgroud)
我需要使用SymptomPerion标准过滤症状列表,我尝试这样做:
let daySymtoms = symptomList.filter { (symptom) -> Bool in
return symptom.type = ???
}
Run Code Online (Sandbox Code Playgroud)
我的问题在于过滤功能.
(我的目标是使用过滤功能而不是循环)
我见过一些iOS开发人员使用这样的代码:
- (void)setupWebView:(UIWebView**)aWebView {
UIWebView *webview = [[UIWebView alloc] init];
.....
if (*aWebView) {
[*aWebView release];
}
*aWebView = webview;
}
Run Code Online (Sandbox Code Playgroud)
你知道这是什么意思,为什么我们用它?谢谢
我有一个源文件来放置我的所有常量(constant.h)像这样:
#define MY_URL @"url"
#define SECOND_URL @"url2"
...
Run Code Online (Sandbox Code Playgroud)
我的问题是用这样的条件来定义一个常量:
if (ipad)
#define MY_CONSTANT @"ipad"
else
#define MY_CONSTANT @"iphone"
Run Code Online (Sandbox Code Playgroud)
我怎么能这样做并把它放进去constant.h?
我已经提交了一个带有应用内购买功能的 iphone 应用,但我的二进制文件被拒绝了,我收到了来自 Apple 的以下消息
来自苹果。缺少 IAP
我们无法完成对您的应用的审核,因为您的一项或多项应用内购买尚未提交审核。
请务必采取行动并提交您的应用内购买并在 iTunes Connect 中上传新的二进制文件。在 iTunes Connect 开发人员指南中了解有关提交应用内购买以供审核的更多信息。
一旦您提交了您的应用内购买并上传了一个新的二进制文件,我们就可以继续您的审核。
我的问题是我应该创建一个新的二进制文件并上传它,还是我可以重新提交应用程序内购买被拒绝的二进制文件?
我正在开发一个ios应用程序,我正在使用gdataxml解析我的xml,但我做错了,我的nslog为null
NSError *error = nil;
GDataXMLDocument *xmlResult = [[GDataXMLDocument alloc] initWithData:data options:0 error:&error];
if (error) {
NSLog(@"%@",error);
}
Run Code Online (Sandbox Code Playgroud)
的NSLog(@ "%@",xmlResult.rootElement); 我的根元素是完美的,错误是tempArray
NSArray *tempArray = [xmlResult nodesForXPath:@"//message/error/value" error:&error];
Run Code Online (Sandbox Code Playgroud)
NSLog(@"mon array%@",tempArray);
我的数组是null,
我的xml是这样的:
<message xmlns="http://.....Api" xmlns:i="http://www.w3.org/....">
<error i:nil="true"/>
<value>
Run Code Online (Sandbox Code Playgroud)
我觉得我的问题与命名空间有关,但我不知道如何做到这一点?
感谢您的回答
我在Apple文档中读到我们可以在Objective c方法调用中使用可选参数.Apple文档中的示例:
采用可变数量参数的方法也是可能的,尽管它们有点罕见.在方法名称结束后,使用逗号分隔额外参数.(与冒号不同,逗号不被视为名称的一部分.)在下面的示例中,假想的makeGroup:方法传递一个必需参数(组)和三个可选参数:
[receiver makeGroup:group, memberOne, memberTwo, memberThree];
Run Code Online (Sandbox Code Playgroud)
有人能说出何时使用此功能以及如何使用?Apple API中有任何示例吗?
谢谢
我有一个带有对象的NSArray:
NSArray *array = [NSArray arrayWithObjects:@"Saturday",@"Sunday",@"Monday",@"tuesday",@"Wednesday",@"thursday",nil];
Run Code Online (Sandbox Code Playgroud)
有时像这样:
array = [NSArray arrayWithObjects:@"Tuesday",@"Monday",nil];
Run Code Online (Sandbox Code Playgroud)
我想要一个像这样的字符串:
dinner : sunday, monday,tusday, wednesday, thurs...
Run Code Online (Sandbox Code Playgroud)
要么
dinner : tuesday, monday.
Run Code Online (Sandbox Code Playgroud)
我怎么能用stringWithFormat做到这一点?
谢谢
我有一个iOS应用程序巫婆使用用户的当前位置.我这样做:
-(void)startGeoloc{
NSLog(@"start geoloc");
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy=kCLLocationAccuracyHundredMeters;
[locationManager startUpdatingLocation];
}
#pragma mark - CLLocationManagerDelegate methods
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
[locationManager stopUpdatingLocation];
AppDelegate *apDelegate =(AppDelegate *)[UIApplication sharedApplication].delegate;
apDelegate.modeGeoloc = YES;
[self callWebService:locationManager.location];
}
Run Code Online (Sandbox Code Playgroud)
问题是,我的方法callWebService:locationManager.location被调用两次,我只想称它为一次.我怎么能这样做?谢谢你的回答
我有这样的代码:
- (NSArray *)executeSqlWithParameters:(NSString *)sql, ...
{
va_list argumentList;
va_start(argumentList, sql);
NSMutableArray *arguments = [NSMutableArray array];
id argument;
while(argument == va_arg(argumentList, id))
{
[arguments addObject:argument];
}
va_end(argumentList);
NSLog(@"arguments %@",arguments); // here i have an empty array
return [self executeSql:sql withParameters:arguments];
}
Run Code Online (Sandbox Code Playgroud)
我这样称呼这个方法:
NSArray *results = [self.dataBaseManager executeSqlWithParameters:@"SELECT * from InfoTable number = ?",[NSNumber numberWithInt:5], nil];
Run Code Online (Sandbox Code Playgroud)
但是当我在executeSqlWithParameters方法中记录arguments数组时,它是emty.我做错了什么?谢谢