这段代码给了我一些头痛:
regions = L.mapbox.featureLayer().loadURL('somefile.geojson');
layer.on('ready', function(e) {
var regionBounds;
console.log(regions);
regions.eachLayer(function(lr) { //This function fires about one of two site loads.
if(lr.feature.properties.title == '{{ $region->name }}') {
regionBounds = lr.getBounds();
}
});
layer.eachLayer(function(lr) {
if(lr.feature.geometry.type == 'Point') {
lr.setIcon(L.divIcon(icon));
}
});
map.fitBounds(regionBounds);
}
当eachLayer()
失败时,regions
_request属性设置为XMLHttpRequest,当map正确加载时为null,但我不确定它是什么意思。如果有人可以帮我解决这个问题,我会很感激,并且显然可以在每个网站上加载此功能。
答案 0 :(得分:1)
您的regions
功能未连接到layer
,它已连接到regions.on('ready', ...)
(我猜其他地方已定义)。如果将其更改为somefile.geojson
,则在加载<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb907580375984874</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>FacebookAppID</key>
<string>907580375984874</string>
<key>FacebookDisplayName</key>
<string>Appname</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbauth</string>
<string>fbauth2</string>
<string>fb-messenger-api20140430</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>akamaihd.net</key>
<dict>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
<key>facebook.com</key>
<dict>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
</dict>
之前函数将不会执行,并且应在每次加载页面时执行。