您好,我有每个产品的产品表和产品详细信息视图我有许多图像下载并缓存在磁盘和内存上每次用户选择产品检查其详细信息我正在尝试检索缓存的图像并为我的四个设置它在UITableViewController中的自定义单元格内的UIImageView我无法设置图像,虽然我可以通过NSLog()函数记录它我正在使用此代码:
int index = 0;
int indexOfImages = 1;
self.imageCache = [[SDImageCache alloc] initWithNamespace:@"menuImage"];
for ( UIImageView *currentImageView in cell.contentView.subviews)
{
NSLog(@"the imageindex is: %d",indexOfImages);
NSLog(@"the index is: %d",index);
NSLog(@"the count is: %lu",(unsigned long)[self.currentProduct.mirsaProductUrlImage count]);
if (index < [self.currentProduct.mirsaProductUrlImage count] ) {
[self.imageCache queryDiskCacheForKey:self.currentProduct.mirsaProductUrlImage[indexOfImages]
done:^(UIImage *image, SDImageCacheType cacheType) {
if (image) {
currentImageView.image = image;
}
}];
indexOfImages++;
index++;
}
else
{
break;
}
}
Run Code Online (Sandbox Code Playgroud)
如果我试图改变循环方式到这个
for ( UIImageView *currentImageView in self.tableView.subViews)
Run Code Online (Sandbox Code Playgroud)
我收到此错误UITableViewWrapperView setImage:]:无法识别的选择器发送到实例 …
在将部署目标从7.1更改为8.2后,我刚刚收到警告,告诉我UIBarButton已弃用.
这是我使用的代码:
UIToolbar* numberToolbar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];
numberToolbar.items = [NSArray arrayWithObjects:
[[UIBarButtonItem alloc]initWithTitle:@"Done" style:UIBarButtonItemStyleBordered target:self action:@selector(nextButton)],
[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil], nil];
self.numberOfGuestsTextField.inputAccessoryView = numberToolbar;
Run Code Online (Sandbox Code Playgroud)
有什么我可以使用而不是UIBarButtonItem
在部署FCM云消息传递之后,这是GCM云消息传递的升级版本,如https://developers.google.com/cloud-messaging/ios/client所述,因此我们使用pod将https集成到我们的应用中,如上所述https:// firebase.google.com/docs/cloud-messaging/notifications我跟进本教程中的每一步都是在状态背景状态和活动状态下收到远程通知的情况,但我遇到的主要问题是通知确实出现在通知栏中这里是我正在使用的代码
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
float ver = [[[UIDevice currentDevice] systemVersion] floatValue];
if(ver >= 8 && ver<9)
{
if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)])
{
[[UIApplication sharedApplication] registerForRemoteNotifications];
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
}
}else if (ver >=9){
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else{
//iOS6 and iOS7 specific code
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeAlert];
} …Run Code Online (Sandbox Code Playgroud) 谷歌推出自己的新的后FCM SDK与iOS能力我是阿贝尔接收来自控制台的通知以及任何应用程序在后台或激活状态,现在我试图让我的服务器发送所提到的推送通知这里我跟进文档步骤如https://firebase.google.com/docs/cloud-messaging/server中所述,但结果如下:
{ "multicast_id":XXXXXXXXXXXXXXX, "成功":0, "失败":1, "canonical_ids":0 "结果":[{ "错误": "InvalidRegistration"}]}
PHP脚本
<?php
define( 'API_ACCESS_KEY', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
$registrationIds = array('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
$msg = array
(
'message' => 'here is a message. message',
'title' => 'This is a title. title',
'subtitle' => 'This is a subtitle. subtitle',
'tickerText' => 'Ticker text here...Ticker text here...Ticker text here',
'vibrate' => 1,
'sound' => 1,
'largeIcon' => 'large_icon',
'smallIcon' => 'small_icon'
);
$fields = array
(
'registration_ids' => $registrationIds,
'data' => …Run Code Online (Sandbox Code Playgroud) 在搜索堆栈上的许多解决方案后,谷歌地图无法缩放到当前位置,例如放大到对象c中地图上的当前位置,但我发现一个解决方案可以帮助我,但它是用快速写入谷歌地图中的快速 当前位置
码
.h文件
#import <UIKit/UIKit.h>
@import GoogleMaps;
@interface BranchesViewController : UIViewController <GMSMapViewDelegate,CLLocationManagerDelegate>
@property (weak, nonatomic) IBOutlet GMSMapView *mapView;
@property (nonatomic, retain) CLLocationManager *locationManager;
@end
Run Code Online (Sandbox Code Playgroud)
.m文件
//
// BranchesViewController.m
// Geeks Diner
//
// Created by Zakaria Darwish on 5/15/16.
// Copyright © 2016 CodeBee. All rights reserved.
//
#import "BranchesViewController.h"
#import "infoWindow.h"
#import "SplashViewController.h"
#import "sharedVariables.h"
#import"AFNetworking.h"
#import "UIWebView+AFNetworking.h"
#import "SDWebImageCompat.h"
#import "SDWebImageDownloaderOperation.h"
#import "SDWebImageDownloader.h"
#import "MyGeeksTableViewController.h"
#import "GeeksLocations.h"
#import "BranchDetailsViewController.h" …Run Code Online (Sandbox Code Playgroud)