小编die*_*ego的帖子

如何解决React Native中“folly/Portability.h”和“File .../main.jsbundle不存在”的问题?

当我想编译生产我的IOS应用程序,我有这样的错误出现:'folly/Portability.h' file not foundecho 'error:this File .../main.jsbundle does not exist. This must be a bug with 我已经在网上搜索来解决这个问题,但我解决不了

这里是 react-native 的信息:

  React Native Environment Info:
System:
  OS: macOS 10.14.4
  CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
  Memory: 38.35 MB / 8.00 GB
  Shell: 3.2.57 - /bin/bash
Binaries:
  Node: 10.15.0 - /usr/local/bin/node
  npm: 6.9.0 - /usr/local/bin/npm
  Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
  iOS SDK:
    Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
  Android SDK:
    API Levels: 21, …
Run Code Online (Sandbox Code Playgroud)

javascript ios reactjs react-native

6
推荐指数
1
解决办法
2373
查看次数

Laravel中如何在没有连接数据库的情况下模拟模型

index()我尝试测试控制器的方法。在这个方法中,有一个模型。

class UserController extends Controller
{        
     public function index()
     {
        return User::all();
     }
}
Run Code Online (Sandbox Code Playgroud)

在测试课上,我有以下内容。

class UserControllerTest extends TestCase
{
    public function testIndex():void
    {
        $user = factory(User::class)->make();
        $mock = Mockery::mock(User::class);
        $mock->shouldReceive('all')->andReturn($user);
        $this->app->instance('User', $mock);
        $response = $this->json('GET', 'api/users');
        dd($response->getContent()); // error : [2002] Connection refused
    }

}
Run Code Online (Sandbox Code Playgroud)

当我运行测试时,与数据库的连接出现错误。这很奇怪,因为我模拟了该模型,这意味着我不需要建立与数据库的连接。我该如何解决这个错误?

错误

SQLSTATE[HY000] [2002] 连接被拒绝(SQL:select * from users where users.deleted_at为空)

phpunit mocking laravel laravel-6

5
推荐指数
1
解决办法
3659
查看次数

UITextView : 链接属性的前景颜色不改变 (NSAttributedStringKey)

我有 NSAttributedStringKey 和 UITextView 的问题

事实上,我正在尝试这样做:

在此处输入图片说明

这是理论上应该工作的代码

class ViewController: UIViewController,UITextViewDelegate {
 @IBOutlet weak var txtView: UITextView!
 override func viewDidLoad() {
    super.viewDidLoad()
    txtView.delegate = self;
    let linkAttributes : [NSAttributedStringKey : Any] = [
            .link: URL(string: "https://exemple.com")!,
            .font:UIFont.boldSystemFont(ofSize: 18),
            .foregroundColor: UIColor.blue] ;
    let attributedString = NSMutableAttributedString(string: "Just 
     click here to do stuff...")
    attributedString.setAttributes(linkAttributes, range: 
    NSMakeRange(5, 10))
     txtView.attributedText = attributedString;
}}
Run Code Online (Sandbox Code Playgroud)

但此代码显示此

在此处输入图片说明

所以我试图通过添加两行代码来解决这个问题:

 let linkAttributes : [NSAttributedStringKey : Any] = [
            .link: URL(string: "https://exemple.com")!,
            .font:UIFont.boldSystemFont(ofSize: 18),
            .foregroundColor: UIColor.blue,
            .strokeColor : UIColor.black,//new line
            .strokeWidth …
Run Code Online (Sandbox Code Playgroud)

xcode textview nsattributedstring swift swift4

2
推荐指数
1
解决办法
457
查看次数