小编use*_*195的帖子

框架项目仅构建设备不能用于运行此目标

它是一个仅限框架项目(SWIFT),它构建一个库(.framework模块),与项目链接以及单元测试,最终会出现以下错误.

** BUILD SUCCEEDED **
xcodebuild: error: Failed to build project HelloWorld with scheme HelloWorld.
    Reason: A build only device cannot be used to run this target.
The command "xcodebuild clean build test -project HelloWorld.xcodeproj -scheme HelloWorld CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO" exited with 70.
Run Code Online (Sandbox Code Playgroud)

我的travis yml文件是

language: objective-c

branches:
 only:
 - master

xcode_project: HelloWorld.xcodeproj
xcode_scheme: HelloWorld
osx_image: xcode7.2 

script:
- xcodebuild clean build test -project HelloWorld.xcodeproj -scheme HelloWorld CODE_SIGN_IDENTITY=""
  CODE_SIGNING_REQUIRED=NO
Run Code Online (Sandbox Code Playgroud)

continuous-integration travis-ci swift xcode7

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

go中的子类型超类型

来自 OOP 范式并从 OOP 语言移植代码,我现在遇到了一个问题,该问题通过抽象在 OOP 中解决,所以我想知道如何在 Go 中解决以下问题,该问题遵循组合而不是继承。

在这种情况下,我的 ValueObjects(DTO、POJO 等)由其他 ValueObjects 组成。我通过返回 json 的 Web 服务调用来填充它们,所以基本上我的函数/方法调用对于所有类型和子类型都是通用的。

我的超级类型EntityVO

type EntityVO struct {
    EntityName    string
    EntityType    string
    PublicationId string
    Version       string
}
Run Code Online (Sandbox Code Playgroud)

由 EntityVO 组成的子类型 1

type ArticleVO struct {
    EntityVO
    ContentSize string
    Created     string
}
Run Code Online (Sandbox Code Playgroud)

由 EntityVO 组成的子类型 2,具有自己独特的字段集

type CollectionVO struct {
    EntityVO
    ProductId string
    Position string
}
Run Code Online (Sandbox Code Playgroud)

我正在调用 Web 服务来检索数据并填充这些 VO。

早些时候,我有一个函数来调用 Web 服务并填充数据,但现在我正在为每个 VO 复制代码。

type Article struct{}

func (a *Article) RequestList(articleVO *valueObject.ArticleVO) (*valueObject.ArticleVO, error) { …
Run Code Online (Sandbox Code Playgroud)

go

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

没有结构的json解组

我正在关注 json

[{"href":"/publication/192a7f47-84c1-445e-a615-ff82d92e2eaa/article/b;version=1493756861347"},{"href":"/publication/192a7f47-84c1-445e-a615-ff82d92e2eaa/article/a;version=1493756856398"}]
Run Code Online (Sandbox Code Playgroud)

根据给定的答案,我试过以下

var objmap map[string]*json.RawMessage
err := json.Unmarshal(data, &objmap)
Run Code Online (Sandbox Code Playgroud)

我得到了以下错误的空数组。有什么建议?

json:无法将数组解组为 map[string]*json.RawMessage 类型的 Go 值

json go

6
推荐指数
2
解决办法
9791
查看次数

node.js与statemachine

我知道node.js是一个单独的线程,并且是内存中的单个进程,我正在研究一个使用状态机的项目,并想知道在这种情况下它是如何工作的.我觉得状态将在用户之间共享,因为它是单个线程或单个进程.提出指示/建议.

假设我说状态A,状态B,状态C.

应用程序只能按此顺序转换,A - > B - > C.

初始状态是A,

用户1请求并且因此状态机移动到状态B然后最终状态C.

用户2请求,这个新用户的状态机是处于状态A还是状态C?

state-machine node.js

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

socket.io错误 - 在建立连接之前关闭Web套接字连接

我从这个页面学到了一点 - > https://github.com/Automattic/socket.io/issues/1846

我需要SSL才能使套接字工作吗?

在此输入图像描述

我一直在努力解决这个错误很长一段时间没有解决方案到目前为止,是否有任何天才可以解决这个难题?

我的应用代码

var express = require("express");
var app = express();
var http = require('http').Server(app);
var io = require('socket.io')(http);

app.use(express.static(__dirname + '/html'));

http.listen(process.env.PORT || 3000, function(){
    console.log('listening on *:', process.env.PORT || 3000);
    new shell.Shell(app, io);
});


app.use(function(request, response, next){
        response.header("Access-Control-Allow-Origin", "*");
        response.header("Access-Control-Allow-Methods", "GET,PUT,POST,DELETE,OPTIONS");
        response.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, X-Auth-Token");
        request.id = self.id++;
        next();
    }); 

    var self = this;

    app.get("/", function(request, response) {
        response.end("");
    });

    app.get("/entitlement/:uri", function(request, response){
        self.delegate.entitlement(request, response);
    });

    app.get("/speakers", function(request, response) {
        self.delegate.speaker(request, response); …
Run Code Online (Sandbox Code Playgroud)

sockets chat node.js

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

用于链接异步操作的GCD模式,同时管道结果

来自JavaScript世界使用async javascript promises,我相信在Swift中使用GCD异步队列也是如此.

你可以点我到2至3个异步函数在一个队列中指定的示例,其中一个异步操作馈送结果至第二,和第二馈送结果至所述第三(俗称管道的结果),然后最后一个结果和错误处理程序.

所有函数都按设计限制为单个参数.

如果在函数2期间出现任何错误,则跳过函数3并将错误直接传递给错误处理程序.

寻找原生解决方案,而不是任何第三方PromiseMonad库.

欣赏swift 3.0代码.

编辑.还从示例中了解到,步骤更像是GCD中的手动线性路径,其中开发人员是下一次的输入结果并且每次都检查错误,使用函数组合可以进行任何功能编程吗?

我想避免使用Pyramid of Doom并寻找线性异步编程.

cocoa cocoa-touch asynchronous grand-central-dispatch swift

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

测试对象是否实现协议

使用单元测试框架,

var car: IVehicle = Vehicle.getInstance("mycar") //dictionary

XCTAssertNotNil(car, "Expecting instance not null")
Run Code Online (Sandbox Code Playgroud)

不起作用,不知道为什么(导致“IVehicle 不符合协议 AnyObject”编译器错误)。

car as Car有效:

XCTAssertNotNil(car as Car, "Expecting instance not null")
Run Code Online (Sandbox Code Playgroud)

这不起作用说测试总是正确的,不确定我们如何测试协议的一致性?

XCTAssertTrue(car is IVehicle, "Expecting instance implements IVehicle")
Run Code Online (Sandbox Code Playgroud)

swift

4
推荐指数
1
解决办法
4286
查看次数

没有找到目标的伞头

堆栈溢出有答案,但没有一个对我有用.

这是一个Swift 2.0项目,我正在使用Xcode 7.2.1

重现问题的步骤

  1. 创建单视图项目
  2. 转到Project Navigator中的Targets
  3. 添加一个名为Common的框架模块
  4. 添加另一个名为Logger的框架模块

你会看到一个警告.

Warning: no umbrella header found for target 'Logger', module map will not be generated

请指教

测试项目链接 - > https://www.dropbox.com/s/cvgjls70ielnriy/Test.zip?dl=0

xcode ios swift

4
推荐指数
1
解决办法
4161
查看次数

declaring generic type object in go

Is there a generic type Object in golang similar to other languages that can be assigned any kind of payload?

type Foo struct {
    data object
}
Run Code Online (Sandbox Code Playgroud)

object go

4
推荐指数
2
解决办法
3271
查看次数

使用角度ui路由器的多步形式

我浏览了这篇文章http://scotch.io/tutorials/javascript/angularjs-multi-step-form-using-ui-router#building-our-angular-app-app.js

和plunkr链接是http://plnkr.co/edit/M03tYgtfqNH09U4x5pHC?p=preview

我的问题是如何在此过程中合并表单验证,比如说我们有姓名和电子邮件的第一个表单,我们如何首先验证它并限制移动到下一个表单如果字段为空等等或电子邮件无效.

// create our angular app and inject ngAnimate and ui-router 
// =============================================================================
angular.module('formApp', ['ngAnimate', 'ui.router'])

// configuring our routes 
// =============================================================================
   .config(function($stateProvider, $urlRouterProvider) {

$stateProvider

    // route to show our basic form (/form)
    .state('form', {
        url: '/form',
        templateUrl: 'form.html',
        controller: 'formController'
    })

    // nested states 
    // each of these sections will have their own view
    // url will be nested (/form/profile)
    .state('form.profile', {
        url: '/profile',
        templateUrl: 'form-profile.html'
    })

    // url will be /form/interests
    .state('form.interests', { …
Run Code Online (Sandbox Code Playgroud)

javascript validation angularjs angular-ui-router

3
推荐指数
1
解决办法
6534
查看次数