this is my screenshot [我搜索了这个解决方案,但没有得到任何解决方案。为什么它会在屏幕截图中显示错误。请帮帮我。
NSURL *url=[NSURL URLWithString:@"http://www.gourmet7.com/auth"];
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%lu", (unsigned long)[postData length]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:url];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
NSError *error = [[NSError alloc] init];
NSHTTPURLResponse *response = nil;
NSData *urlData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSLog(@"Response code: %ld", (long)[response statusCode]);
NSString *responseData = [[NSString alloc]initWithData:urlData encoding:NSUTF8StringEncoding];
] 2
答案 0 :(得分:1)
这只能是一个疯狂的猜测,但是因为你的代码编译得很好,我认为你的目标是低于8.0的iOS版本。
不幸的是,<LinearLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<com.stack.line.CustomView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/custom"
/>
</LinearLayout>
属性仅在8.0之后可用。因此,您必须将最低iOS版本提升至至少8.0或使用其他机制。