小编Mel*_*cuk的帖子

检查iOS上的位置服务权限

如何检查我的应用是否启用了位置服务?

我有2个故事板,我想检查位置服务.如果为我的应用启用了位置服务,我想启动带位置的地图故事板.否则,我想发布另一个故事板.我该如何以编程方式完成?

objective-c cllocationmanager ios

49
推荐指数
7
解决办法
7万
查看次数

crypto/bcrypt:hashedPassword不是给定密码的哈希值

我加密用户的密码并保存到db.然后到用户登录,比较哈希密码和普通密码,我收到crypto/bcrypt: hashedPassword is not the hash of the given password错误.怎么了 ?

func encryptPassword(password string) (string, error) {
    bytePass := []byte(password)
    hashedPassword, err := bcrypt.GenerateFromPassword(bytePass, bcrypt.DefaultCost)
    if err != nil {
        log.Printf("ERROR:EncryptPassword: %s", err.Error())
    }
    return string(hashedPassword), err
}

func (i *Impl) Register(user User) bool {
    hashedPass, err := encryptPassword(user.Password)
    if err != nil {
        return false
    }

    user.Password = hashedPass

    if err := i.DB.Create(&user).Error; err != nil {
        log.Printf("ERROR:Register: %s", err.Error())
        return false
    }
    return true
}

func …
Run Code Online (Sandbox Code Playgroud)

hash go bcrypt

8
推荐指数
2
解决办法
1571
查看次数

从iOS上的.net Web服务获取数据

我有一个.Net网络服务,我将它用于移动应用程序.我在Windows手机和Android应用程序上使用它,但我还没有从iOS上获取数据.例如,我的Web服务中有一个方法,它需要一个参数.如何从返回值中获取数据?我在互联网上找到了一个例子,我编辑了它,但我无法获取数据.所有代码都在这里.在这种情况下,我需要一个示例代码.谢谢你的关注.

网络服务的信息:

namespace:http ://tempuri.org url:http://www.example.com/webservice1.asmx方法名称:FirmaGetir参数名称:firID(string)

Web服务请求:

    POST /webservice1.asmx HTTP/1.1
Host: example.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <FirmaGetir xmlns="http://tempuri.org/">
      <firID>string</firID>
    </FirmaGetir>
  </soap12:Body>
</soap12:Envelope>
Run Code Online (Sandbox Code Playgroud)

返回数据:

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <FirmaGetirResponse xmlns="http://tempuri.org/">
      <FirmaGetirResult>
        <Firma>
          <firma_adi>string</firma_adi>
          <adres>string</adres>
          <telefon>string</telefon>
          <id>string</id>
          <sektor>string</sektor>
          <alt_sektor>string</alt_sektor>
          <alt_sektor_adi>string</alt_sektor_adi>
          <servis>string</servis>
          <map>string</map>
          <slogan>string</slogan>
          <sayfaGosterimi>int</sayfaGosterimi>
          <gpsilce>string</gpsilce>
          <gpssemt>string</gpssemt>
          <gpspk>string</gpspk>
          <duyuru>
            <baslik>string</baslik>
            <icerik>string</icerik>
            <link>string</link>
            <image>string</image>
          </duyuru> …
Run Code Online (Sandbox Code Playgroud)

iphone web-services objective-c xml-parsing ios

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

Asp.NET Web API中的控制器和类列表

我想访问我的web api中的所有控制器.假设我有2个控制器和2个类;

Foo:

string fooId

string fooName
Run Code Online (Sandbox Code Playgroud)

酒吧:

string barId

string barName
Run Code Online (Sandbox Code Playgroud)

Sample1Controller:

Get(int fooId)

Post([FromBody] Foo foo)
Run Code Online (Sandbox Code Playgroud)

Sample2Controller:

Get(int barId)

Post([FromBody] Bar bar)
Run Code Online (Sandbox Code Playgroud)

我想列出我的控制器,Foo和Bar类的属性.我怎样才能做到这一点 ?

更新:

我想为移动应用程序创建请求和响应类.例如,如果我远程访问这些详细信息,我可以为java或objective-c创建请求和响应类.

c# asp.net wsdl service-discovery asp.net-web-api

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

禁用TouchableHighlight onPress?

如果其中一组按下,如何禁用TouchableHighlight组?可能吗 ?例如,我有listview,并且每一行都有两个TouchableHighlights。如果其中之一被按下,我想禁用这两个可触摸对象的onPress功能。

reactjs react-native

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

C#对象列表到字符串列表

对象列表

List<object>似乎在上面,我想将其转换为List<string>.

我怎么转换它?

我需要List<string>它有6项(11:00,13:45,......等)

c# casting object type-conversion

3
推荐指数
2
解决办法
2万
查看次数

NSURL总是返回零

我有WCF服务,我想从我的网络服务获取数据.但URL始终返回nil.为什么?我想将参数发送到来自文本字段值的WCF.例如;

txtfield.text = @"ATA?EH?R";
Run Code Online (Sandbox Code Playgroud)

怎么了 ?

NSString *request = [NSString stringWithFormat:@"http://www.xxxxxxxx.com/CCWCF.svc/MethodName/%@",txtfield.text];
NSURL *URL = [NSURL URLWithString:[request stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
Run Code Online (Sandbox Code Playgroud)

我尝试了不同的东西,但结果并没有改变.

NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.xxxxxxxx.com/CCWCF.svc/MethodName/%@",txtfield.text]];
Run Code Online (Sandbox Code Playgroud)

要么:

NSURL *URL = [[NSURL alloc] initWithString:[request stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
Run Code Online (Sandbox Code Playgroud)

iphone nsurl ios

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

如何在iOS上获取当前位置?

我无法获得当前位置.当我在不同的地方启动我的应用程序时,App可以获得最后的位置.但我不想最后的位置.如果您关闭应用并重新启动它,现在应用可以获取当前位置.即使首次启动应用程序,我如何获得当前位置?

- (void)viewDidLoad
{
    [super viewDidLoad];

    [locationManager startUpdatingLocation];

    self.mapView.delegate = self;
    [self.mapView setShowsUserLocation:YES];

    locationManager.delegate=self;

    locationManager = [[CLLocationManager alloc] init];

    locationManager.delegate=self;
    locationManager.desiredAccuracy=kCLLocationAccuracyBest;
    locationManager.distanceFilter=kCLDistanceFilterNone;

    location = [locationManager location];

    CLLocationCoordinate2D coord;
    coord.longitude = location.coordinate.longitude;
    coord.latitude = location.coordinate.latitude;
    lat = coord.latitude;
    longt = coord.longitude;
}
Run Code Online (Sandbox Code Playgroud)

iphone objective-c core-location cllocationmanager ios

0
推荐指数
1
解决办法
1万
查看次数

golang struct 数组转换

我有如下结构:

type Foo struct{
  A string
  B string
}

type Bar struct{
  C string
  D Baz
}

type Baz struct{
  E string
  F string
}
Run Code Online (Sandbox Code Playgroud)

可以说我有[]Bar,如何将其转换为[]Foo

A 应该 C

B 应该 E

arrays struct go

0
推荐指数
1
解决办法
2542
查看次数