小编Ben*_*Ben的帖子

Electron-packager - “路径”参数必须是字符串类型。接收类型未定义

我一直在努力解决这个问题,无法弄清楚。发布了类似的问题,哪些解决方案建议节点版本有故障或软件包版本应该降级/升级。我已经尝试修改节点版本,重新验证 npm 缓存和许多其他小提琴,但没有一个对我有用。(它发生在运行应用程序-> 电子期间)

未捕获的异常:TypeError [ERR_INVALID_ARG_TYPE]:“路径”参数必须是字符串类型。在 Command.parse (/Users/ben.izadi/Documents/Developer/gsa-cloud-portal/ui/electron_app) 在 basename (path.js:1299:5) 处收到类型未定义的 assertPath (path.js:39:11) /publishTest2-mas-x64/publishTest2.app/Contents/Resources/app/node_modules/commander/index.js:462:30) 在 dispatchUploadFileMessageFromArgs (/Users/ben.izadi/Documents/Developer/gsa-cloud-portal/ui /electron_app/publishTest2-mas-x64/publishTest2.app/Contents/Resources/app/index.js:38:4) 在 WebContents.win.webContents.on (/Users/ben.izadi/Documents/Developer/gsa-cloud -portal/ui/electron_app/publishTest2-mas-x64/publishTest2.app/Contents/Resources/app/index.js:11:5) 在 WebContents.emit (events.js:182:13)

在我的 index.js 中:

const { app, BrowserWindow } = require('electron')
var program = require('commander');
path = require('path');

var win = null;

function createWindow() {
  win = new BrowserWindow({ width: 1024, height: 768 })
  win.loadFile('./app/index.html');
  win.webContents.on('did-finish-load', () => {
    dispatchUploadFileMessageFromArgs(process.argv);
  })
}

const instanceLock = app.requestSingleInstanceLock();
if (!instanceLock) {
  app.quit()
} else {
  app.on('second-instance', (event, …
Run Code Online (Sandbox Code Playgroud)

node.js electron electron-builder electron-packager

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

在iOS中下载zip文件

尝试从给定的URL下载一个zip文件,因为zip文件每天更新​​我在ApplicationDidFinishLunching方法中编写了代码,但它不起作用.我的代码有什么问题吗?

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    NSString *stringURL = @"http://webspace.apiit.edu.my/intake-timetable/download_timetable/timetableXML.zip";
    NSURL  *url = [NSURL URLWithString:stringURL];
    NSData *urlData = [NSData dataWithContentsOfURL:url];
    //Find a cache directory. You could consider using documenets dir instead (depends on the data you are fetching)
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
    NSString *path = [paths  objectAtIndex:0];

    //Save the data
    NSString *dataPath = [path stringByAppendingPathComponent:@"timetableXML.zip"];
    dataPath = [dataPath stringByStandardizingPath];
    [urlData writeToFile:dataPath atomically:YES];
    return YES;
}
Run Code Online (Sandbox Code Playgroud)

objective-c ios

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

修剪NSDate仅显示日期

我已经经历了所有类似的问题,不幸的是非解决我的问题所以我问了.我需要我的函数返回一个NSDate唯一的日期,但我的返回值也包含时间,我已经尝试了setTimeStyle noStyle以及我能提出的每个可能的解决方案,这里是代码:

-(NSDate*)stringToDate{
    NSString *dateString = @"01-02-2010";
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"dd-MM-yyyy"];
    NSDate *date;
    date = [dateFormatter dateFromString:dateString];
    NSLog(@"%@",date);
    return date;
} 
Run Code Online (Sandbox Code Playgroud)

输出是: 2010-01-31 16:00:00 +0000

我想要的是: 2010-01-31

iphone objective-c nsdate nsdateformatter ios

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