当我尝试使用以下代码在设备中运行应用程序时:
ionic cordova build android
它会生成一个APK,并且我已将其安装在设备中。当我使用此代码进行构建时,广告可以正常工作:
showAd() {
const bannerConfig: AdMobFreeBannerConfig = {
isTesting: true,
autoShow: true
};
this.admobFree.banner.config(bannerConfig);
this.admobFree.banner.prepare()
.then(() => {
// banner Ad is ready
// if we set autoShow to false, then we will need to call the show method here
})
.catch(e => console.log(e));
}
当我使用此其他代码进行构建时,广告不会显示:
showAd() {
const bannerConfig: AdMobFreeBannerConfig = {
id: 'MY-ID-FROM-ADMOB',
isTesting: false,
autoShow: true
};
this.admobFree.banner.config(bannerConfig);
this.admobFree.banner.prepare()
.then(() => {
// banner Ad is ready
// if we set autoShow …
我正在使用 Go 中的 RWMutex 进行实验,我意识到可以使用以下代码实现这种行为:
package main
import (
"fmt"
"sync"
"time"
)
type RLockAndLockStruct struct {
mu sync.RWMutex
mapEx map[string]string
}
func main() {
r := &RLockAndLockStruct{}
r.mapEx = make(map[string]string)
go r.RLockAndLockTest("test", "goroutine 1 - ")
go r.RLockAndLockTest("test", "goroutine 2 - ")
time.Sleep(4000 * time.Millisecond)
}
func …Run Code Online (Sandbox Code Playgroud)