我有这个代码在我的应用程序中通过默认的Apple 实现OSM :
dispatch_async(dispatch_get_main_queue(), ^{
NSString *template = @"http://tile.openstreetmap.org/{z}/{x}/{y}.png";
MKTileOverlay *overlay = [[MKTileOverlay alloc] initWithURLTemplate:template];
overlay.canReplaceMapContent = YES;
[self.mapView addOverlay:overlay level:MKOverlayLevelAboveLabels];});
Run Code Online (Sandbox Code Playgroud)
和:
- (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id<MKOverlay>)overlay {
if ([overlay isKindOfClass:[MKTileOverlay class]]) {
return [[MKTileOverlayRenderer alloc] initWithTileOverlay:overlay];
}
else return nil;
}
Run Code Online (Sandbox Code Playgroud)
在iOS 7中它很好,但现在它返回多次并且根本没有加载地图:
<Error>: ImageIO: CGImageSourceCreateWithData data parameter is nil
Run Code Online (Sandbox Code Playgroud)
我该如何解决?我试图重构我的代码,所以现在第一块代码:
dispatch_queue_t fetchTiles = dispatch_queue_create("fetcher", NULL);
dispatch_async(fetchTiles, ^{
NSString *template = @"http://tile.openstreetmap.org/{z}/{x}/{y}.png";
MKTileOverlay *overlay = [[MKTileOverlay alloc] initWithURLTemplate:template];
overlay.canReplaceMapContent = YES;
dispatch_async(dispatch_get_main_queue(), ^{
[self.mapView addOverlay:overlay level:MKOverlayLevelAboveLabels];});});
Run Code Online (Sandbox Code Playgroud)
但这似乎并没有解决问题.
我正在编写一个程序,它接受一个元素列表(这样的列表必须采用整数和小数)并给出一个减少的总和列表:
到目前为止我的结果是:
cuttingSum :: Num a => [a] -> [a]
cuttingSum l =
let
cuttingSum_iter [] res = reverse (res)
cuttingSum_iter ll res =
cuttingSum_iter (tail ll) ((foldl (+) 0 ll) :: res)
in
cuttingSum_iter l []
main = do
print $ cuttingSum [1,2,3]
Run Code Online (Sandbox Code Playgroud)
我收到错误:
ERROR "task9-02-1.hs":5 - Inferred type is not general enough
*** Expression : foldl (+) 0 ll
*** Expected type : a
*** Inferred type : _26
Run Code Online (Sandbox Code Playgroud)
我正在使用Hugs,因为它是任务要求,但ghci也显示出某种类似的错误.有什么问题?
我有以下代码,它采用十六进制格式的数字并打印出其十进制格式.
这个程序在Turbo Debugger中运行得很好,但是当我在DOS下运行它时,在输出数字后输出中会看到一些额外的符号:
.model small
.stack 100h
.486
.code
save proc
itm:
xor dx,dx
mov bx,10
div bx
add dl,30h
inc cx
pop bx
push dx
push bx
cmp ax,0
jne itm
ret
save endp
start:
mov ax, 0FFFFh
call save
mov ah, 02
print:
pop dx
int 21h
loop print
int 20h
end start
Run Code Online (Sandbox Code Playgroud)
输出:
C:\TASM>lab31
65535 ò ??? 9°????UWSîÄPA÷0ó?????ê$?ó????ê$ó??ê?ë?ó???sÄ÷?t? ? ÷??8sê¬ê²?&mî??????÷ t<sÿ????I?>?b!??4&Gê&_ë?î?[?é?
z?? ?\?? ?f?[?3¡ïA1èG????uè ç???é????ëX?????Y^?Z?
?tÇ5????á???? ?
??! C?(A?1?:?ÿ?ƒ??[%??C????
1357 46$??
如你所见,65535打印正常,但随后出现垃圾.当我在Turbo Debugger中运行程序时,它在写出65535之后挂起.
我想这是一个非常基本的问题,但我真的不明白,为什么我会得到不同的结果.在function(data)
地图内部填充并显示为已填充.当我离开时,它会冲洗.出了什么问题?奇怪的是,我在Chrome JS控制台中收到的第一件事是console.log(map)
来自内部功能,而不是最后一个,因此它们似乎以相反的顺序打印出来.
var map = {};
var deps = $.get("#####", function (data) {
$.each(data, function (tag, data) {
$.each(data, function (param, info) {
if (param == 'name')
map[tag] = param;
});
});
console.log(map)
});
console.log(map)
Run Code Online (Sandbox Code Playgroud)