朋友我有简单的音频播放器(MPMoviePlayerController),可以播放音频流.在iOS 11上我有非常麻烦的麻烦,一千次我有错误,我的流被停止:
NSURLConnection finished with error - code -1002
Run Code Online (Sandbox Code Playgroud)
我粘贴这段代码(我在stackowerflow上看到这段代码),但这对我没有帮助:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>cast.mysite.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
</dict>
Run Code Online (Sandbox Code Playgroud)
也许你知道最好的解决方案
我有一些项目,我必须从JSON粘贴图像.我试图找到关于这个的任何教程,试着看看这个主题的任何视频,但没有.所以我的问题有:
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSDictionary *allDataDictionary = [NSJSONSerialization JSONObjectWithData:webdata options:0 error:nil];
NSDictionary *playlist =[allDataDictionary objectForKey:@"playlist_data"];
for (NSDictionary *diction in playlist) {
NSString *name = [diction objectForKey:@"text1"];
NSString *namesong = [diction objectForKey:@"text2"];
NSString *images = [diction objectForKey:@"image"];
NSLog(@"%@", images);
[array addObject:text1];
[array2 addObject:text2];
}
[[self tableTrack]reloadData];
}
Run Code Online (Sandbox Code Playgroud)
我添加了文本1到单元格也文本2它的工作完美,但如何将图像添加到数组3(我的tableView中的单元格中的图像)?我也尝试添加图像,但它对我不起作用:
NSURL *imageURL = [NSURL URLWithString:[appsdict objectForKey:@"image"]];
NSData *imageData = [NSData dataWithContentsOfURL:imageURL];
UIImage *imageLoad = [[UIImage alloc] initWithData:imageData];
cell.imageView.image = imageLoad;
Run Code Online (Sandbox Code Playgroud)
请帮助解决我的问题,或者给JSON提供一些解析图片的教程,youtube也没有JSON解析的完美教程.谢谢!
我有一些有趣的问题我的Xcode 6.1.1蓝色图标就像在xcodeproj文件上消失了,我已经安装了新版本千次,但它不是解决方案.此外,我试图找到一些关于它的主题,但真的没有!

我需要获取当前用户位置(纬度、经度),但我找不到解决方案,因为所有解决方案仅适用于 iOS 6,7,8。例如,我有这段代码,但在 iOS 11.3.1 上它仍然无法工作。
#import <CoreLocation/CoreLocation.h>
@interface ViewController () <CLLocationManagerDelegate>
@property (weak, nonatomic) IBOutlet UILabel *latitudeValue;
@property (weak, nonatomic) IBOutlet UILabel *longtitudeValue;
@property (nonatomic,strong) CLLocationManager *locationManager;
- (void)viewDidLoad
{
[super viewDidLoad];
if ([CLLocationManager locationServicesEnabled]) {
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
[self.locationManager startUpdatingLocation];
} else {
NSLog(@"Location services are not enabled");
}
}
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
CLLocation *location = [locations lastObject];
self.latitudeValue.text = [NSString stringWithFormat:@"%f", location.coordinate.latitude];
self.longtitudeValue.text = [NSString stringWithFormat:@"%f", location.coordinate.longitude];
}
Run Code Online (Sandbox Code Playgroud) 我有问题.我有动态tableview.所以我需要在textLabel中更改文本大小.我试过了:
一:
cell.textLabel.font = [UIFont systemFontOfSize:30.0f];
Run Code Online (Sandbox Code Playgroud)
二:
cell.textLabel.font = [UIFont boldSystemFontOfSize:12.0];
Run Code Online (Sandbox Code Playgroud)
三:
UIFont *myFont = [ UIFont fontWithName: @"Arial" size: 30.0 ];
cell.textLabel.font = myFont;
Run Code Online (Sandbox Code Playgroud)
但我的文字标签没有改变.所以detailtextlabel - 完全改变但文本标签 - 没有.我做错了什么?谢谢
我有UIImageView就像简单的Gallery,可以从JSON获取数据.
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSDictionary *allDataDictionary = [NSJSONSerialization JSONObjectWithData:webdata options:0 error:nil];
NSArray *tmp =[allDataDictionary objectForKey:@"gallery"];
if (tmp.count>0){
for (NSDictionary *diction in tmp) {
[self.patternImagesArray addObject:diction];
}
NSLog(@"%@", self.patternImagesArray);
// [loading stopAnimating];
}
[self.collectionView reloadData];
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
PatternView *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"PatternCell" forIndexPath:indexPath];
NSString *myPatternString = [[self.patternImagesArray objectAtIndex:indexPath.row] valueForKey:@"thumb"];
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:myPatternString]];
cell.patternImageView.image = [UIImage imageWithData:data];
return cell;
}
Run Code Online (Sandbox Code Playgroud)
为了给出完整的图像我使用这个:
-(void)viewDidLoad{
NSString *path=[_newsData valueForKey:@"bigimg"];
NSData* imageData = [NSData dataWithContentsOfURL: [NSURL URLWithString: path]];
UIImage* image …Run Code Online (Sandbox Code Playgroud) ios ×4
xcode ×3
json ×2
uitableview ×2
icons ×1
ios11 ×1
mkmapview ×1
objective-c ×1
osx-yosemite ×1
parsing ×1