好吧所以我只是将Xcode更新为7.3,现在我收到了这个警告:
'var'参数已弃用,将在Swift 3中删除
当我需要在此函数中使用var时,如何解决这个问题:
public func getQuestionList(var language: String) -> NSArray {
if self.data.count > 0 {
if (language.isEmpty) {
language = "NL"
}
return self.data.objectForKey("questionList" + language) as! NSArray
}
return NSArray()
}
Run Code Online (Sandbox Code Playgroud) 解决方案:使用SDWebImage:https://github.com/rs/SDWebImage
我有一个UITableView,在滚动时变得非常迟钝.我发现当我正在使用的图像重新出现在屏幕上时会出现延迟.
我正在使用自定义UITableViewCell.这也是它滞后的原因吗?
我的自定义UITableViewCell:

我的代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *CellIdentifier = [NSString stringWithFormat:@"Cell%d%d",indexPath.row,indexPath.section];
tableViewCellActiviteiten *cell = (tableViewCellActiviteiten *)[self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"tableViewCellActiviteiten" owner:self options:nil];
cell = (tableViewCellActiviteiten *)[nib objectAtIndex:0];
}
cell.thetitle.text = [self.alletitels objectAtIndex:indexPath.row];
cell.thesubtitle.text = [self.allesubtitels objectAtIndex:indexPath.row];
NSString * imagePath = [self.alleimages objectAtIndex:indexPath.row];
NSURL * imageURL = [NSURL URLWithString:imagePath];
NSData * imageData = [NSData dataWithContentsOfURL:imageURL];
UIImage * image = [UIImage imageWithData:imageData];
cell.image.image = image; …Run Code Online (Sandbox Code Playgroud) 每当我用Xcode打开我的应用程序时,我都会收到此错误:
ld: library not found for -lGoogleAnalyticsServices
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)
然后我需要取消标记libGoogleAnalyticsServices.a文件上的目标并再次标记它.取消选中/检查目标后,应用程序正常运行...
发生这种情况时我会收到另外两个警告:
ld: warning: directory not found for option '-L/Users/vision/Documents/Apps/Mijn Cijfers/Mijn'
ld: warning: directory not found for option '-LCijfers'
Run Code Online (Sandbox Code Playgroud)
现在看起来Xcode无法读取空格并查找名为Cijfers的新目录.我的应用程序被称为:Mijn Cijfers,但我之前在项目名称中使用空格时从未遇到此问题.
每次检查/取消选中libGoogleAnalyticsServices.a"库搜索路径" 的目标时,都会添加新行:
我认为这两种情况都必须对我得到的警告和错误做些什么.删除库搜索路径并选中/取消选中目标以让我的应用程序正常运行真的很烦人.-.-
有谁知道解决这个奇怪的bug的解决方案?
我是新手UICollectionView,我正在按照我在Youtube上找到的教程,但我遇到了一个我无法弄清楚的错误.
当我使用此代码运行应用程序时:
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
return 1;
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return [self.array count];
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
CollectionCell *aCell = (CollectionCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"myCell" forIndexPath:indexPath];
aCell.title.text = self.array[indexPath.row];
return aCell;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.array = @[@"First", @"Second", @"Thirth", @"Fourth"];
}
Run Code Online (Sandbox Code Playgroud)
而在.h:
@property (strong, nonatomic) NSArray *array;
Run Code Online (Sandbox Code Playgroud)
在控制台中,我收到以下错误:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'UICollectionView must be initialized with a non-nil layout parameter'
Run Code Online (Sandbox Code Playgroud)
我没有使用故事板,自定义了CollectionView你可以在这里看到:

有没有人有任何想法,为什么我收到此错误?一切都是受欢迎的!
编辑:
- (void)viewDidLoad
{
[super …Run Code Online (Sandbox Code Playgroud) xcode ×3
ios ×2
objective-c ×2
xcode7 ×2
iphone ×1
swift ×1
swift3 ×1
target ×1
uitableview ×1