刚刚安装了本机,并尝试启动并运行Hello World.过去几个小时内收到此错误:
"No bundle URL present.Make sure you're running a packager server
or have included a .jsbundle file in your application bundle."
Run Code Online (Sandbox Code Playgroud)
我已经提到了这一点:反应原生中没有捆绑URL的含义是什么?和其他类似的问题,并尝试了一切:使用我的IP地址,反应本机run-iso和npm安装的不同组合,在运行和不运行时,尝试删除构建,清理项目,重启Xcode,模拟器多次,尝试反应原生-upgrade,编辑into.plist以允许任意加载,手动设置我的index.ios.js的路径,一切,什么都不起作用.
我注意到许多人试图在他们的设备上构建时遇到了这个问题.我不是想做任何花哨的事情,只是让'hello world'开始运行.
我不知道的任何其他解决方案?
我正在将我的项目更新为Swift 3.当我将一些cocoapods更新为swift 3时,我在运行pod install后在终端中收到以下消息:
Analyzing dependencies
[!] The following pods are integrated into targets that do not have the same Swift version:
- AWSCore required by myApp (Swift 3.0.1), myApptests (Swift 3.0)
- AWSS3 required by myApp (Swift 3.0.1), myApptests (Swift 3.0)
- Alamofire required by myApp (Swift 3.0.1), myApptests (Swift 3.0)
Run Code Online (Sandbox Code Playgroud)
这里有一个很长的线程:https://github.com/CocoaPods/CocoaPods/issues/5864关于这个问题,我尝试了建议的解决方案,但是当我运行pod安装时,我仍然得到相同的消息.
这是我的pod文件:
在给定链接之外,我在这个问题上找不到多少.其他人遇到过同样的问题?有解决方案吗 我上周末刚刚安装了Xcode 8.1和Swift 3.0.1.
我正在尝试向Imgur API发出HTTP请求.我正在尝试检索与标签"cats"相关的所有图像.根据Imgur API,网址为:https://api.imgur.com/3/gallery/t/cats
Imgur API声明了以下有关获取请求所需的授权:
对于公共只读和匿名资源,例如获取图像信息,查找用户评论等,您只需要
client_id在您的请求中发送授权标题.如果您想要匿名上传图像(图像
不附加到帐户),或者您想要创建匿名
相册,这也适用.这让我们知道哪个应用程序正在访问API.Run Code Online (Sandbox Code Playgroud)Authorization: Client-ID YOUR_CLIENT_ID
我看了下面的问题,并尝试了那里的建议,但没有一个有帮助.
如何在Swift中创建一个Http get并设置httpHeader?
我目前的代码是这样的:
let string = "https://api.imgur.com/3/gallery/t/cats"
let url = NSURL(string: string)
let request = NSMutableURLRequest(URL: url!)
request.setValue("clientIDhere", forHTTPHeaderField: "Authorization")
//request.addValue("clientIDhere", forHTTPHeaderField: "Authorization")
request.HTTPMethod = "GET"
let session = NSURLSession.sharedSession()
let tache = session.dataTaskWithRequest(request) { (data, response, error) -> Void in
if let antwort = response as? NSHTTPURLResponse {
let code = antwort.statusCode
print(code)
}
}
tache.resume() …Run Code Online (Sandbox Code Playgroud) 我在Android中使用最近由设计库25中的谷歌引入的底部布局导航样式.在我看到的所有教程和问题中,图标中的图像是正常大小,但是我的图像是非常小的,尽管事实是我保存到drawable文件夹的图像是72x72.这是一个截图:
图标应至少为2,甚至可能是该尺寸的3倍.我该怎么做?这是我在bottom_layout.xml中的代码:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu_home"
android:title="test"
android:icon="@drawable/tabbarglossary"
app:showAsAction="always|withText"
/>
<item
android:id="@+id/menu_search"
android:title="test2"
android:icon="@drawable/mediationtabbar"
app:showAsAction="always|withText"
/>
<item
android:id="@+id/menu_notifications"
android:title="test3"
android:icon="@drawable/ic_action_name"
app:showAsAction="always|withText"
/>
</menu>
Run Code Online (Sandbox Code Playgroud)
在我的activity_main.xml中:
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:layout_marginBottom="0dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:focusable="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
design:menu="@menu/bottom_layout" />
Run Code Online (Sandbox Code Playgroud)
谢谢
我正在使用Android应用程序的底部导航视图.我增加了图标的大小,但现在图标会在文本上运行.这是我看到的:
这是根据谷歌设计文档的底部导航视图的图表:
数字10,我想改变那个填充,但当我查看导航栏的属性时,我看不到我能做到的地方.如何将其更改为较小的数字?在我的bottom_layout.xml中,我正在设置我的项目,如下所示:
<item
android:id="@+id/menu_notifications"
android:title="Professionals"
android:icon="@drawable/ic_action_name"
app:showAsAction="ifRoom"
/>
Run Code Online (Sandbox Code Playgroud)
如何更改底部文本填充?
谢谢
我正在使用 VCR 记录与外部 API 的 http 交互。这是我的(工作)代码:
it 'does xyz....' do
hook_payload = {ruby_hash: 'here'}
VCR.use_cassette('my_folder/create_project') do
VCR.use_cassette('my_folder/get_project') do
update = Update.new(hook_payload)
expect { update.call }.to change { Projects.count }.by(1)
end
end
end
Run Code Online (Sandbox Code Playgroud)
上面的代码有效,但组织不好,因为我更喜欢expect{}在块外调用。所以,我试过这个,但下面的代码不起作用:
context 'my context', vcr: { group: 'my_folder', cassettes: %w[create_project get_project] } do
it 'does xyz....' do
hook_payload = {ruby_hash: 'here'}
update = Update.new(hook_payload)
expect { update.call }.to change { Projects.count }.by(1)
end
Run Code Online (Sandbox Code Playgroud)
但是,此代码不起作用,并且出现以下错误:
VCR is currently using the following cassette: - /Users/me/this_project/spec/fixtures/vcr/my_folder/create_project.yml.
Under the …
我有2个字符串数组.例如,让我们这样说:
let array1 = ["string1", "string2", "string3", "string4", "string5"]
let array2 = ["string8", "string4", "string3", "string367", "string5"]
Run Code Online (Sandbox Code Playgroud)
我想比较并查看2个数组是否包含任何相同的元素,然后将结果放入bool数组中.就像说"array1中的第一个元素是"string1",现在让我们看看array2中的任何元素是否与"string1"相同,如果它们是,则boolArray中的第一个元素将为true,如果不是,则为将是假的." 执行此操作以将array1与array2进行比较的结果将产生boolArray
var boolArray = [false, false, true, true, true]
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?我试过这个:
for y in array1 {
for z in array2 {
if y == z {
self.boolArray.append(true)
}
else {
self.boolArray.append(false)
}
}
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用,因为boolArray包含25个元素,它应该只包含5.也许有一些我不知道的快速功能对我们有很多这样的功能?
我有一个分支,我想合并到远程,最新的master.我的电脑上有一个本地的,过时的主人.我跑了git pull upstream master,它检索了遥控器master,这很棒,正是我想要的.然后,我不假思索地在切换到另一个分支时意外丢弃了这些更改.
虽然在我的本地主人,我已经运行git pull,而git pull upstream master现在许多次,它总是说"已经是最新的." 当它显然不是.起初git pull upstream master工作得很好,但现在它没有,并且机器认为它不是最新的.如何让我的本地主人再次与远程主人一样?
我已经看了很多这样的问题,并尝试了很多解决方案,但这种情况有点不同.我正在使用AVCaptureVideoDataOutputSampleBufferDelegate,以便我可以将CIFilters应用于实时视频源.我正在使用以下方法来更改相机:
func changeCameras() {
captureSession.stopRunning()
var desiredPosition: AVCaptureDevicePosition?
if front {
desiredPosition = AVCaptureDevicePosition.Back
} else {
desiredPosition = AVCaptureDevicePosition.Front
}
let devices = AVCaptureDevice.devicesWithMediaType(AVMediaTypeVideo) as? [AVCaptureDevice]
for device in devices! {
if device.position == desiredPosition {
self.captureSession.beginConfiguration()
do {
let input = try AVCaptureDeviceInput(device: device)
for oldInput in self.captureSession.inputs {
print(oldInput)
self.captureSession.removeInput(oldInput as! AVCaptureInput)
}
print(input)
self.captureSession.addInput(input)
self.captureSession.commitConfiguration()
dispatch_async(dispatch_get_main_queue(), { () -> Void in
self.captureSession.startRunning()
})
} catch { print("evic failed")}
}
}
front = !front
}
Run Code Online (Sandbox Code Playgroud)
我用来设置摄像头(在viewDidLoad中调用)并从委托接收sampleBuffer的方法在这里:https …
我正在尝试将 pr-processor 宏添加到我的 Xcode 项目中。这个项目共享 Swift 和 Objective-C 代码,所以我不能使用Swift Compiler -> Other Swift Flags,因为那样我就无法从 Objective-C 代码中读取它们。
我在我的应用程序的主要目标和项目中都设置了以下内容:
然后,在我的应用程序的第二个目标(我的今日扩展)下,我设置了 IS_MAIN=0。
但是,当我运行此代码时:
#if IS_MAIN
print("main: true")
#else
print("main: false")
#endif
Run Code Online (Sandbox Code Playgroud)
它永远不会打印正确的。
我如何添加这个预处理器标志,以便我的 Swift 和 Objective-c 文件都遵守它?现在它在两种类型中都有效。
ios ×4
swift ×4
android ×2
xcode ×2
arrays ×1
avfoundation ×1
cocoapods ×1
core-image ×1
git ×1
github ×1
imgur ×1
nsurlsession ×1
react-native ×1
swift3 ×1
vcr ×1