![](/img/trans.png)
[英]Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: -[__NSCFString scheme]: unrecognized selector sent to instance
[英]Terminating app due to uncaught exception 'NSInvalidArgumentException' unrecognized selector sent to instance
我是xcode的新手,請幫助我糾正下面的錯誤,
-(void)XYZ:(NSString *)id1
{
id2 = [id1 intValue];
[self Vehicles:id2];
}
-(NSArray *)Vehicles:(NSInteger) id2
{
NSString *urlString=[NSString stringWithFormat:@"http://www.xxxx.com/xxxx/vehiclelist.php?uid=%d&format=json",id2];
NSURL *url=[NSURL URLWithString:urlString];
NSData *data=[NSData dataWithContentsOfURL:url];
NSError *error;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
NSArray *results = [json valueForKey:@"posts"];
return results;
}
我從登錄競爭控制器傳遞ID值,代碼是,
if(stat!=0&&id2!=0&&[Username length]!=0&&[Password length]!=0)
{
Services *loc = [[Services alloc] initWithNibName:@"Services" bundle:nil];
loc.modalPresentationStyle = UIModalPresentationCurrentContext;
loc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentViewController:loc animated:YES completion:Nil];
MyVchicle *about = [[MyVchicle alloc] initWithNibName:@"MyVchicle" bundle:nil];
about.modalPresentationStyle = UIModalPresentationCurrentContext;
about.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentViewController:about animated:YES completion:Nil];
[loc XYZ:id1];
}
提前致謝。
要將數據從一個ViewController發送到另一個,請按照以下步驟操作:
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { DestinationViewController *destController = [segue destinationViewController]; destController.varName = @"passThisValue"; }
這應該可以幫助您。 希望這可以幫助。
您可以參考此鏈接。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.