小编Vai*_*eri的帖子

如何在Swift中实现密码验证的正则表达式?

我想在Swift中为密码实现正则表达式验证?我试过以下正则表达式,但没有成功

([(0-9)(A-Z)(!@#$%ˆ&*+-=<>)]+)([a-z]*){6,15}
Run Code Online (Sandbox Code Playgroud)

我的要求如下:密码必须超过6个字符,至少有一个大写字母,数字或特殊字符

regex validation ios swift

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

将我的iOS应用程序检测为Web浏览器

我正在构建一个浏览器应用程序.我希望iOS将其检测为浏览器.我尝试添加http到URL Schemes但是徒劳无功.

我试过这个答案.

browser xcode ios swift

7
推荐指数
1
解决办法
711
查看次数

在缓存中保存视频

有没有办法将视频保存在缓存中,然后在需要时将其恢复?

NSCache *memoryCache; //assume there is a memoryCache for images or videos
NSString *urlString = @"http://blog.jimdo.com/wp-content/uploads/2014/01/tree-247122.jpg";
NSString *path = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"A"] ofType:@"mov"];
NSURL *url = [NSURL fileURLWithPath:path];

NSData *downloadedData = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlString]];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^
{
    if (downloadedData)
    {
        // STORE IN FILESYSTEM
        NSString* path = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject];
        NSString *file = [path stringByAppendingPathComponent:@"B.mov"];
        [downloadedData writeToFile:file options:NSDataWritingAtomic error:nil];
        NSLog(@"Cache File : %@", file);

        // STORE IN MEMORY
        [memoryCache setObject:downloadedData forKey:@"B.mov"];
    }
    // NOW YOU CAN CREATE …
Run Code Online (Sandbox Code Playgroud)

xcode caching objective-c ios

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

通过iOS App在Twitter上分享视频

是否可以使用SLRequest共享视频?

我可以使用相同的方式共享图像

SLRequest *postRequest = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodPOST URL:requestURL parameters:message];

if (isImage)
{
    NSData *data = UIImagePNGRepresentation(imgSelected);
    [postRequest addMultipartData:data withName:@"media" type:@"image/png" filename:@"TestImage.png"];
}

postRequest.account = account;

[postRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error)
{
    if (!error)
    {
        NSLog(@"Upload Sucess !");
    }
}];
Run Code Online (Sandbox Code Playgroud)

twitter video objective-c ios social-framework

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

iOS - 应用内购买 - 无效的产品标识符

我正在尝试在我的项目中集成应用内购买。我使用了第三方库SwiftyStoreKit作为 IAP 助手。

我正在尝试获取我的应用内产品的信息,但总是得到响应 Invalid Product Identifiers

我所有的协议都有效(付费和免费)。此外,我的应用内产品状态显示Waiting for Upload。我的应用程序尚未发布,因此我正在沙盒模式下对其进行测试。

在我的代码中遵循:

import UIKit
import StoreKit
import SwiftyStoreKit

override func viewDidLoad() {
    super.viewDidLoad()
}

override func viewDidAppear(_ _animated: Bool) {
    super.viewDidAppear(_animated)

    if dataModel.lists.count >= 2 {
        getInfo()
    }
}

func getInfo() {

    NetworkActivityIndicatorManager.NetworkOperationStarted()

    SwiftyStoreKit.retrieveProductsInfo([productIdentifier], completion: { result in

        NetworkActivityIndicatorManager.networkOperationFinished()

        self.showAlert(alert: self.alertForProductRetrievalInfo(result: result))

    })
}
Run Code Online (Sandbox Code Playgroud)

storekit in-app-purchase ios swift app-store-connect

5
推荐指数
2
解决办法
9708
查看次数

iOS Swift 4:如何使用 DES-ECB-PKCS5Padding 执行加密/解密?

我想在 iOS Swift 中使用DES-ECB-PKCS5Padding执行加密/解密。

我有一些来自服务器端的代码(很可能在 ActionScript 中)可以提供帮助,如下所示:

private static const type:String='simple-des-ecb';

public static function encrypt(txt:String, salt:String): String
{
    var key:ByteArray = Hex.toArray(Hex.fromString(salt));
    var data:ByteArray = Hex.toArray(Hex.fromString(txt));
    var pad:IPad = new PKCS5;
    var mode:ICipher = Crypto.getCipher(type, key, pad);
    pad.setBlockSize(mode.getBlockSize());
    mode.encrypt(data);
    data.position = 0;
    return Base64.encodeByteArray(data);
}

public static function decrypt(txt:String, salt:String): String
{
    var key:ByteArray = Hex.toArray(Hex.fromString(salt));
    var data:ByteArray = Base64.decodeToByteArray(txt);
    var pad:IPad = new PKCS5;
    var mode:ICipher = Crypto.getCipher(type, key, pad);
    pad.setBlockSize(mode.getBlockSize());
    try
    {
        mode.decrypt(data);
    } …
Run Code Online (Sandbox Code Playgroud)

encryption cryptography ios swift4

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

如何使用正则表达式验证Javascript中的数字字段?

以下是否正确?

var z1=^[0-9]*\d$;
{
    if(!z1.test(enrol))
    {
        alert('Please provide a valid Enrollment Number');
        return false;
    }
} 
Run Code Online (Sandbox Code Playgroud)

它目前没有在我的系统上工作.

javascript

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

在UISearchResultsTableView中获取"断言失败"

当我开始在SearchBar中键入搜索文本时,我收到以下错误

Assertion failure in -[UISearchResultsTableView _configureCellForDisplay:forIndexPath:]
Run Code Online (Sandbox Code Playgroud)

我的cellForRowAtIndexPath代码Search Display Controller如下:

if(tableView == self.searchDisplayController.searchResultsTableView)
{
    static NSString *CellIdentifier = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if(cell == nil)
    {
        cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    }

    cell.textLabel.text = [search objectAtIndex:indexPath.row];

    return cell;
}
Run Code Online (Sandbox Code Playgroud)

uisearchbar uisearchdisplaycontroller ios

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