我想创建一个网页,如果iPhone没有安装应用程序,将iPhone重定向到应用程序商店的页面,但如果iPhone安装了应用程序,我希望它打开应用程序.
我已经在iPhone应用程序中实现了一个自定义URL,所以我有一个应用程序的URL,如下所示:
myapp://
Run Code Online (Sandbox Code Playgroud)
如果此网址无效,我希望该网页重定向到应用商店.这有可能吗?
如果我没有在手机上安装应用程序并在safari中编写myapp:// url,我得到的只是一条错误消息.
即使存在javascript的丑陋黑客,我真的想知道吗?
for (Tweet tweet : tweets) {
for(long forId : idFromArray){
long tweetId = tweet.getId();
if(forId != tweetId){
String twitterString = tweet.getText();
db.insertTwitter(twitterString, tweetId);
}
}
}
Run Code Online (Sandbox Code Playgroud)
我的代码将不会通过{}循环的第一个传递,这就是为什么idFromArray是空的,因为我没有添加任何内容,直到已将tweet添加到数据库.
即使数组中有某些内容,它也会将整个内容循环两次(DUH!因为我有两个循环),这使得数据库在相同的推文中非常臃肿.
这不是两个推文id的简单比较,而是简单地忽略具有相同id的那些.
我很确定这个问题有一个非常简单的解决方案,但我仍然无法解决这个问题.任何人?
更新:
我想要的是忽略数据库中已有的tweetId的代码.只需插入不在数据库中的推文.
我不认为我应该有两个for循环,我认为第二个循环应该被替换为什么?(或者我错了?)
我HttpResponse在检查用户名或密码是否正确时从服务器获取.当我加载url一个webview我想要webView有cookie(我得到的答案postData()存储在webView.我希望webView获取cookie并加载存储在webview中的cookie的URL.
我正在收到回应.
public HttpResponse postData() {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("https://example.com/login.aspx");
try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("txtUsername", "user"));
nameValuePairs.add(new BasicNameValuePair("txtPassword", "123"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
String responseAsText = EntityUtils.toString(response.getEntity());
Log.v(TAG , "Response from req: " + responseAsText);
return responseAsText;
} catch (ClientProtocolException e) {
} catch (IOException e) {
}
return null;
}
Run Code Online (Sandbox Code Playgroud)
我用loadUrl:
webView.loadUrl("http://a_page.com/getpage.aspx?p=home");
Run Code Online (Sandbox Code Playgroud)
我想我不是真正管理一个cookie,我不知道该怎么做.任何建议或解决方案?
我正在尝试使用Android Studio中的Gradle制作应用程序,但我得到的是此错误消息:
java.lang.IllegalArgumentException: Argument 0 for @NotNull parameter of com/android/tools/idea/jps/builder/AndroidGradleBuilder.createBuildTask must not be null: Argument 0 for @NotNull parameter of com/android/tools/idea/jps/builder/AndroidGradleBuilder.createBuildTask must not be null
Run Code Online (Sandbox Code Playgroud)
我试过调试这个,实际上我无法弄清楚问题是什么.
有想法的人吗?
我以为我已经弄明白但是我无法让它发挥作用.我有一个方法,在数组中的每个URL上调用.此方法具有应在Application Support文件夹中的特定路径中下载以供脱机使用的图片的URL.但也许我误解了AFNetwork库中的方法.我的方法看起来像这样:
- (void) downloadImageInBackground:(NSDictionary *)args{
@autoreleasepool {
NSString *photourl = [args objectForKey:@"photoUrl"];
NSString *articleID = [args objectForKey:@"articleID"];
NSString *guideName = [args objectForKey:@"guideName"];
NSNumber *totalNumberOfImages = [args objectForKey:@"totalNumberOfImages"];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:photourl]];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
operation.inputStream = [NSInputStream inputStreamWithURL:[NSURL URLWithString:photourl]];
[operation setShouldExecuteAsBackgroundTaskWithExpirationHandler:^{
DLog(@"PROBLEMS_AF");
}];
DLog(@"URL_PHOTOURL: %@", photourl);
DLog(@"indexSet: %@", operation.hasAcceptableStatusCode);
[operation response];
NSData *data = [args objectForKey:@"data"];
NSString *path;
path = [NSMutableString stringWithFormat:@"%@/Library/Application Support/Guides", NSHomeDirectory()];
path = [path stringByAppendingPathComponent:guideName];
NSString *guidePath = path;
path = …Run Code Online (Sandbox Code Playgroud) 我在Android中创建了自定义ToggleButtons,因为所有按钮都继承自相同的xml,我想根据状态更改它们的行为方式,所以当检查状态时我想改变阴影颜色,但这似乎不可能当前的SDK.
我创建了一个包含button_colors的xml文件:
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_checked="true"
android:color="#FFFFFF" />
<item
android:color="#000000" />
</selector>
Run Code Online (Sandbox Code Playgroud)
但这似乎只适用于文本颜色而不是文本上的阴影颜色.有什么我想念的吗?而不是在代码中手动为每个按钮执行此操作,因为我希望将其应用于应用程序中的每个按钮.
更新编辑:
我的选择器目前看起来像这样
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_checked="true"
android:drawable="@drawable/button_gradient_selected" />
<item
android:drawable="@drawable/button_gradient" />
</selector>
Run Code Online (Sandbox Code Playgroud)
但正如我在下面的评论员中所提到的,我似乎无法从这里改变样式/文本颜色阴影,因为它似乎只能采用可绘制的颜色.
当我尝试在此处按钮上放置不同的样式时,它会强制关闭或根据状态不改变样式.当我只尝试在这里放置样式并且在样式中设置drawable它强制关闭.无论哪种方式,它似乎都不起作用.
我有一项活动可让您登录页面.在下一个活动中,如果登录成功,它应该显示基于cookie的网页.cookie被重新启动,我尝试使用以下代码将其放在webView上:
Cookie sessionCookie = LoginWebView.cookie;
CookieSyncManager.createInstance(webview.this);
CookieManager cookieManager = CookieManager.getInstance();
if (sessionCookie != null) {
cookieManager.removeSessionCookie();
String cookieString = sessionCookie.getName() + "=" + sessionCookie.getValue() + "; domain=" + sessionCookie.getDomain();
Log.v(TAG, "COOKIE SYNC: " + cookieString);
cookieManager.setCookie(domain, cookieString);
CookieSyncManager.getInstance().sync();
}
webView.setWebViewClient(new MyWebViewClient ());
webView.loadUrl("http://a_page.com/getpageiphone.aspx?p=home");
Run Code Online (Sandbox Code Playgroud)
这是基于StackOverflow上其他问题的代码而丢失的,但是当我加载网页时它似乎不起作用.似乎我的代码有些问题,但我看不到哪里,我开始认为我做错了.
一个简单的问题,我无法找到答案.我有一个字符串,它是一个时间戳,我想把它变成一个日历对象,所以我可以在我的Android应用程序中显示它.
到目前为止,我所拥有的代码显示了1970年代的一切:s.
String timestamp = parameter.fieldParameterStringValue;
timestampLong = Long.parseLong(timestamp);
Date d = new Date(timestampLong);
Calendar c = Calendar.getInstance();
c.setTime(d);
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH);
int date = c.get(Calendar.DATE);
dateTextView.setText(year + "-" + month + 1 + "-" + date);
Run Code Online (Sandbox Code Playgroud)
更新: 仅供参考,时间戳来自服务器是:1369148661,可能是错的?
我最近上传了一个应用程序,该应用程序因应用内购买而被Apple拒绝,该应用程序在应用内购买之前有一个登录页面,这是不允许的.
现在我想从应用程序中删除应用程序内购买,所有代码都已注释掉,但如何在iTunes Connect中取消激活应用程序内购买.
我知道在iTunes Connect的Manage In-App Purchase部分有一个名为"Cleared for Sale"的开关,但我的问题是,这是否足以将该开关设置为否.
这是否会取消激活该应用程序的任何应用内购买参考,并且无需应用内购买即可审核该应用?
或者,如果没有应用程序内购买,我必须考虑通过审核来获取应用程序.
来自Apple的消息引发了拒绝:
17.2我们发现您的应用要求客户注册个人信息以访问非基于帐户的功能,这些功能不符合App Store审核指南.具体而言,用户必须注册才能购买其他内容.在允许访问与用户无关的应用功能和内容之前,应用不需要用户注册.需要共享个人信息的用户注册必须是可选的或与帐户特定功能相关联.此外,请求的信息必须与功能相关.
我在Ubuntu服务器上安装了GitLab.一切似乎工作正常,除了我不能推/拉/克隆到服务器/从服务器.
当我按下时,我收到一般错误消息:
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
我已经尝试了几个小时的谷歌搜索,但我似乎无法找到问题.
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
Run Code Online (Sandbox Code Playgroud)
运行良好,全面运行!
我可以通过SSH连接到git@adress.adress我得到:
PTY allocation request failed on channel 0
Welcome to GitLab, Anonymous!
Run Code Online (Sandbox Code Playgroud)
当我做:
ssh git@adress.adress "ls /location/of/git/dir"
Run Code Online (Sandbox Code Playgroud)
我明白了:
Not allowed command
Run Code Online (Sandbox Code Playgroud)
网站正在运行,当我在网站上创建一个存储库时,它出现在/ home/git/repository /
但我仍然无法推动它.
我按照这个指南:
https://github.com/gitlabhq/gitlabhq/blob/5-0-stable/doc/install/installation.md
以及让它在apache上运行的指南:
http://shanetully.com/2012/08/running-gitlab-from-a-subdirectory-on-apache/