我在google和stackoverflow上看到了几个与此错误相关的帖子,我已经阅读了所有这些帖子但仍然提到了问题,我很乐意找到解决方案.这是我在编译时收到的错误消息...
找不到选项'-L/Users/somefolder/Documents/Bharat/MyApp copy/GoogleAdMobAdsSDK'重复符号_OBJC_CLASS _ $ _ AppDelegate:/ Users/madept/Library/Developer/Xcode/DerivedData/Alpha-dvvymdlmzseytagllsmbbrxdgutz/Build/Intermediates/Alpha.build/Debug-iphonesimulator/Alpha.build/Objects-normal/i386/AppDelegate-56890B6B994A4284.o
谢谢.
我在表头上添加搜索栏并将其浮动在scrollViewDidScroll
方法中,但是当我滚动时没有点击搜索栏(即我转到视图并滚动),然后搜索栏不会保持在顶部但它向上滚动表然而,一旦我点击搜索栏并点击搜索栏上的取消按钮,然后如果我滚动表格,搜索栏将保持在顶部.我的代码是 -
-(void)viewDidLoad {
[super viewDidLoad];
UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
searchBar.delegate = self;
searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self];
searchDisplayController.delegate = self;
searchDisplayController.searchResultsDataSource = self;
searchDisplayController.searchResultsDelegate = self;
UIView *tableHeaderView = [[UIView alloc] initWithFrame:searchDisplayController.searchBar.frame];
[tableHeaderView addSubview:searchDisplayController.searchBar];
[tableView setTableHeaderView:tableHeaderView];
isSearching = NO;
}
-(void)scrollViewDidScroll:(UIScrollView *)scrollView {
UISearchBar *searchBar = searchDisplayController.searchBar;
CGRect searchBarFrame = searchBar.frame;
if (isSearching) {
searchBarFrame.origin.y = 0;
} else {
searchBarFrame.origin.y = MAX(0, scrollView.contentOffset.y + scrollView.contentInset.top);
}
searchDisplayController.searchBar.frame = searchBarFrame;
} …
Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我要设置重复UILocalNotification
.我可以通过执行每日,每周等设置repeatInterval
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.repeatInterval = NSDayCalendarUnit; // or any other calendarUnit
Run Code Online (Sandbox Code Playgroud)
好的..没关系,但我要每14天设置一次repeatInterval.我从这个链接中了解到,我们只能使用其中一个NSCalendarUnit重复间隔.因此,您可以重复间隔为一分钟或一小时或一天但不是五分钟或三小时或14天.关于iOS 5或更高版本中此限制的任何想法(该文章是为iOS 4.0编写的)?
我正在开发一个在本地存储用户数据的应用程序。我已经使用Room
数据库将用户创建的数据存储在 Android 设备中。现在,如果用户拥有不止一台设备,那么数据应该可以在他们的所有 (Android) 设备上使用,而无需任何中央数据库或 Web 服务。
注意:对于 iOS 端,我曾经CloudKit
在 iOS 设备之间同步数据。有没有办法对 Android 设备做同样的事情?请注意,我不想将数据存储在任何中央数据库或网络服务器或任何中央云存储上。它应该只归用户所有。(即它应该通过用户的谷歌帐户同步)。
注意:我想要一个原生的 android 解决方案,不需要跨平台(Android 到 iOS)同步。
更新:到目前为止,我发现了一些选项,如Firestore和实时数据库,一些 AWS 服务也提供同步工具,但所有这些的问题在于它们都将用户数据存储在中央云位置。
所以我的问题仍然是一样的 - 有没有办法在使用Google Drive
或类似的东西的android 设备之间同步数据,我们可以利用用户自己的云存储,而不是将用户数据存储在中央数据库中。
我正在开发一个 iOS 应用程序,它从像这个图像这样的 URL 加载图像,它在我办公室的所有测试设备上(以及在模拟器上)都能完美运行。但客户说,只要有任何图像出现,应用程序就会崩溃,其他一切都按预期工作。现在的问题是,除了它在我这边的工作方式之外,是否还有其他问题?有什么方法(任何应用程序或任何东西)通过使用它们客户端可以向我发送崩溃报告以便我可以检查?
注意:-我们在相同的 iOS 版本(7.x)上进行测试
编辑:-他们如何获取日志并将其发送给我的一些方法
May 20 22:48:47 iPhone-5S com.apple.launchd[1] (UIKitApplication:com.Ba-cha[0xfbd1][287]) <Warning>: (UIKitApplication:com.Ba-cha[0xfbd1]) Job appears to have crashed: Segmentation fault: 11
May 20 22:48:47 iPhone-5S backboardd[31] <Warning>: Application 'UIKitApplication:com.Ba-cha[0xfbd1]' exited abnormally with signal 11: Segmentation fault: 11
Run Code Online (Sandbox Code Playgroud)
我搜索了相同的内容并尝试过,NSZombieEnabled
但在我的设备(iPhone 4 和 iPhone5)中,它运行良好,没有日志?现在的问题是如何在我的设备上重现该问题?
我SDWebImage
用来从服务器上异步下载图像。服务器上的某些图像大小约为1.5至2 MB。我正在上显示这些图像UICollectionView
。多次运行后,我收到内存警告并且应用程序崩溃。有时是在第一次下载图像时发生的,有时是在我上下滚动集合视图时发生的。这是我的代码-
-(void)setImageWithUrl:(NSURL*)imgurl onImageView:(UIImageView*)image prograssive:(BOOL)progressive
{
__block UIActivityIndicatorView *activityIndicator;
__weak UIImageView *weakImageView = image;
SDWebImageOptions opt;
if (progressive) {
opt = SDWebImageProgressiveDownload;
}
else
opt = SDWebImageRetryFailed;
[image sd_setImageWithURL:imgurl placeholderImage:[UIImage imageNamed:@"default_image"] options:opt progress:^(NSInteger receivedSize, NSInteger expectedSize)
{
if (!activityIndicator)
{
[weakImageView addSubview:activityIndicator = [UIActivityIndicatorView.alloc initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]];
activityIndicator.center = CGPointMake(weakImageView.frame.size.width /2, weakImageView.frame.size.height/2);
// activityIndicator.center = weakImageView.center;
[activityIndicator setBackgroundColor:[UIColor clearColor]];
[activityIndicator startAnimating];
}
}
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL)
{
[activityIndicator removeFromSuperview];
activityIndicator = nil;
}]; …
Run Code Online (Sandbox Code Playgroud) 我想实现拉来刷新我的UITableViewController
使用UIRefreshControl
.这是我到目前为止尝试过的.
- (void)viewDidLoad
{
.....
////********* Pull to refresh ************/
UIRefreshControl *refresh = [[UIRefreshControl alloc] init];
refresh.attributedTitle = [[NSAttributedString alloc] initWithString:@"Pull to Refresh"];
refresh.tintColor = [UIColor magentaColor];
// [self.tableView addSubview:refresh];
// [self.refreshControl setEnabled:YES];
[refresh addTarget:self action:@selector(pullToRefresh:) forControlEvents:UIControlEventValueChanged];
self.refreshControl = refresh;
}
-(void)pullToRefresh:(UIRefreshControl *)refresh {
[refresh beginRefreshing];
refresh.attributedTitle = [[NSAttributedString alloc] initWithString:@"Refreshing.."];
[self loadRecentActivities];
}
Run Code Online (Sandbox Code Playgroud)
但是当我拉出tableview时,活动指示器和标题都不可见,但是pullToRefresh
会调用并刷新表.我的应用程序支持iOS7.0 +.我错过了什么?任何帮助,将不胜感激?
编辑:我试过 [self.refreshControl setEnabled:YES];
和 [self.refreshControl setEnabled:YES];
编辑过的代码一样,但仍然没有运气.当我把它拉到刷新时,这就是我的tableview的样子 -
最终解决方案:对于我正在使用的表视图背景
UIImageView *imageView = …
Run Code Online (Sandbox Code Playgroud) 我命名的两个实体
Expenses
,并ExpensesCategory
在Expenses
有关系CategoryExpenses
具有以下属性-名称expenseCategory,目的地- ExpensesCategory,逆-费用.它ExpensesCategory
有一个名为expenseCategory的字符串类型Expenses
的属性,并具有名为amount的属性.现在我想获取由expenseCategory分组的费用和金额总和.这是我的代码
NSSortDescriptor *sortTitle =[NSSortDescriptor sortDescriptorWithKey:@"addedTimestamp"
ascending:YES];
NSArray *sortDescriptors = [NSArray arrayWithObjects:sortTitle, nil];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Expense"
inManagedObjectContext:context];
NSPredicate *predicate;
predicate =[NSPredicate predicateWithFormat:@"(addedTimestamp <= %@) AND (addedTimestamp >= %@)",currentDate, endDate];
NSAttributeDescription* amtDescription = [entity.attributesByName objectForKey:@"amount"];
NSRelationshipDescription* nameDesc = [entity.relationshipsByName objectForKey:@"expenseCategory"];
NSExpression *keyPathExpression = [NSExpression expressionForKeyPath: @"amount"];
NSExpression *countExpression = [NSExpression expressionForFunction: @"sum:"
arguments: [NSArray arrayWithObject:keyPathExpression]];
NSExpressionDescription *expressionDescription = [[NSExpressionDescription alloc] init]; …
Run Code Online (Sandbox Code Playgroud) 我知道这个问题在这里一次又一次地被问到,但没有找到任何解决我的问题的方法.我正在通过xib创建一个自定义UITableViewCell并尝试加载它.在我的VC中称为ACSummaryVC
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"SimpleTableCell";
AcSummaryCell *cell = (AcSummaryCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"AcSummaryCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
}
Run Code Online (Sandbox Code Playgroud)
AcSummaryCell是一个子类,UITableViewCell
它有一个UILabel
名为acLabel 的IBOutlate.当我编译项目时,我得到以下错误 -
`Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ACSummaryVC 0x71465c0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key acLabel.'`
Run Code Online (Sandbox Code Playgroud)
我在AcSummayCell类中创建了acLabel的连接,但我从ACSummaryVC收到错误?我做错了什么?
编辑: -根据Mani的答案,我正在连接到文件所有者,这是错误的而是我要连接到自定义单元格.但是当我尝试这个我没有得到我的支出连接而不是我得到喜欢这张图片 -
现在的问题是如何将我的支出与自定义单元格连接? 这是我的AcSummayCell.h
@interface AcSummayCell : UITableViewCell …
Run Code Online (Sandbox Code Playgroud) 我已使用此代码将事件添加到iphone日历中
-(void)setEvent:(NSString *)title withStartDate:(NSDate *)startDate withEndDate:(NSDate *)endDate completion:(void (^)(void))completionBlock
{
EKEventStore* store = [[EKEventStore alloc] init];
[store requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {
if (!granted)
{
return;
}
EKEvent *event = [EKEvent eventWithEventStore:store];
event.title = title;
event.startDate = startDate;
event.endDate = endDate;
[event setCalendar:[store defaultCalendarForNewEvents]];
NSError *err = nil;
[store saveEvent:event span:EKSpanThisEvent commit:YES error:&err];
// NSString *savedEventId = event.eventIdentifier;
NSString* alertTitle;
NSString* msg;
if (err) {
alertTitle = @"Calendar was not set";
msg = @"Please set default calendar in settings."; …
Run Code Online (Sandbox Code Playgroud) 在IB中,我们可以使用command =
将图片的大小调整UIImageView
为原始大小。我需要以编程方式进行操作。我曾经使用过,contentMode
但是它会调整图像本身的UIImageView
大小以匹配IB中设置的大小。
编辑: 我试过
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"ScanToVerifyCell" forIndexPath:indexPath];
STOScanToVerifyCell * verifyCell = (STOScanToVerifyCell *)cell;
[verifyCell.scanStatusImage setHidden:NO];
[verifyCell.scanStatusImage setImage:[UIImage imageNamed:@"point.png"]];
[verifyCell.scanStatusImage sizeToFit];
Run Code Online (Sandbox Code Playgroud)
但这不起作用。我在干什么?
ios ×9
objective-c ×9
iphone ×2
admob ×1
android ×1
android-room ×1
cloudkit ×1
core-data ×1
ekevent ×1
ios5 ×1
ios7 ×1
sdwebimage ×1
uisearchbar ×1
uitableview ×1