使用我的应用程序,我尝试使用下面的代码从Firestore分页我的数据(每页10个帖子),
import UIKit
import FirebaseFirestore
class Home: UITableViewController {
var postArray = [postObject]()
let db = Firestore.firestore()
var page : DocumentSnapshot? = nil
let pagingSpinner = UIActivityIndicatorView(activityIndicatorStyle: .gray)
override func viewDidLoad() {
super.viewDidLoad()
loadFirstPage()
}
func loadFirstPage(){
// Get the first 10 posts
db.collection("POSTS").limit(to: 10).addSnapshotListener { (snapshot, error) in
if snapshot != nil {
self.postArray = (snapshot?.documents.flatMap({postObject(dec : $0.data())}))!
// Save the last Document
self.page = snapshot?.documents.last
self.tableView.reloadData()
}
}
}
func loadNextPage(){
// get the next 10 posts
db.collection("POSTS").limit(to: …Run Code Online (Sandbox Code Playgroud) 我今天想检查 IOS 和 Android 的 Lottie lib,我在 After Effect 中制作了一个简单的指示器动画并将其导出到 .json 文件,它在 IOS 上完美运行,当我在 Android 版本上测试相同的文件时,我得到以下结果错误,我真的不知道我是否遗漏了什么?
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.lottietest/com.test.lottietest.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.airbnb.lottie.LottieAnimationView.setAnimation(java.lang.String)' on a null object reference
Run Code Online (Sandbox Code Playgroud)
这是我的活动 XML
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.mtids.lottietest.MainActivity">
<view
class="com.airbnb.lottie.LottieAnimationView"
id="@+id/animationView"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="133dp"
android:layout_marginTop="20dp"
android:onClick="animate"
android:text="animate" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
活动代码
public class MainActivity extends AppCompatActivity {
LottieAnimationView anim;
@Override
protected void onCreate(Bundle savedInstanceState) …Run Code Online (Sandbox Code Playgroud) 我是网络服务器领域的新手,我不希望我的网站仅提供 https 服务(对于 IPV4 和 IPV6),因此我实施了以下步骤,
sudo certbot --nginx certonly -d maarath.com -d www.maarath.com
4.在etc/nginx/site-available/main中手动配置我的站点配置文件,如下所示,
server {
listen 80 ;
listen [::]:80 ;
root /var/www/main/;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name maarath.com www.maarath.com;
location / {
try_files $uri $uri/ =404;
}
# HTTPS
listen 443 ssl;
server_name maarath.com www.maarath.com;
ssl_certificate /etc/letsencrypt/live/maarath.com/cert.pem;
ssl_certificate_key /etc/letsencrypt/live/maarath.com/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$; …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的项目中使用HMS Map Kit,地图已加载但从未渲染
摇篮:应用程序
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.huawei.agconnect:agconnect-core:1.4.1.300'
implementation 'com.huawei.hms:maps:5.0.2.300'
}
apply plugin: 'com.huawei.agconnect'
Run Code Online (Sandbox Code Playgroud)
构建:摇篮:
repositories {
google()
jcenter()
maven { url 'http://developer.huawei.com/repo/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.huawei.agconnect:agcp:1.4.1.300'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {url 'http://developer.huawei.com/repo/'}
}
Run Code Online (Sandbox Code Playgroud)
显现 :
<uses-permission android:name="android.permission.INTERNET"/> …Run Code Online (Sandbox Code Playgroud) 我有类Router有路由属性的类
<?php
class Router
{
private $routes = [];
function setRoutes(array $routes)
{
$this->$routes = $routes;
}
}
?>
Run Code Online (Sandbox Code Playgroud)
在其他文件routes.php中:
<?php
$routes = [
'users' => 'users.php',
'comments' => 'comments.php'
];
?>
Run Code Online (Sandbox Code Playgroud)
我用它像:
<?php
require __DIR__ .'/Data.php';
require __DIR__ .'/Router.php';
require __DIR__ .'/../routes.php';
$router = new Router;
$router->setRoutes($routes);
$url = $_SERVER['REQUEST_URI'];
?>
Run Code Online (Sandbox Code Playgroud)
但我得到了
注意:数组转换为字符串 /../XAMPP/xamppfiles/htdocs/TestPro/core/Router.php
为什么会出现这种错误?