我目前正在寻找具有属性的UILabel addMessageLabel.layer.cornerRadius = 5.0f;
在安装了iOS 7.0的设备上,它有圆角.在安装了iOS 7.1的设备上,它没有圆角.
这只是iOS 7.1的一个错误吗?
我正在尝试实现后台推送通知处理,但是我在确定用户是否从发送的推送通知中打开应用程序时遇到了问题,而不是从图标打开它.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
//************************************************************
// I only want this called if the user opened from swiping the push notification.
// Otherwise I just want to update the local model
//************************************************************
if(applicationState != UIApplicationStateActive) {
MPOOpenViewController *openVc = [[MPOOpenViewController alloc] init];
[self.navigationController pushViewController:openVc animated:NO];
} else {
///Update local model
}
completionHandler(UIBackgroundFetchResultNewData);
}
Run Code Online (Sandbox Code Playgroud)
使用此代码,无论用户如何打开应用程序,应用程序都会打开MPOOpenViewController.我怎样才能使视图控制器只有在他们通过刷通知打开应用程序时才会被推送?
使用相同的代码,这适用于iOS 6,但使用新的iOS 7方法,它的行为并不像我想要的那样.
编辑:我正在尝试在iOS 7上运行应用程序,我们不支持iOS 7之前的任何版本.我在方法的iOS 6版本中使用了相同的确切代码(没有完成处理程序)并且它表现得很好我希望它的方式.你要刷通知,这将被调用.如果从图标打开,则永远不会调用该方法.
push-notification apple-push-notifications uiapplicationdelegate ios ios7
我正在制作教程,我正在尝试模仿Path教程的样式,如下所示:
http://www.appcoda.com/wp-content/uploads/2013/06/UIPageViewController-Tutorial-Screen.jpg
我的问题是,如果设置委托方法如此:
- (NSInteger)presentationCountForPageViewController:(UIPageViewController *)pageViewController {
// The number of items reflected in the page indicator.
return 5;
}
Run Code Online (Sandbox Code Playgroud)
然后我在点下面得到这个愚蠢的黑条:
http://i.stack.imgur.com/pUEdh.png
有没有办法让这个酒吧半透明的方式类似于将UINavigationBar设置为半透明?
我正在尝试在收到应用内推送通知时在状态栏上方添加横幅.从我一直在阅读的内容看来,动态更改iOS 7中状态栏样式的唯一方法是设置UIViewControllerBasedStatusBarAppearance
为NO
.这不仅是真的很烦不得不改变我的所有不同的视图控制器prefersStatusBarHidden
来[UIApplication sharedApplication].statusBarHidden
,但它也没有给我找的效果.
当横幅从顶部滑动时,我仍然希望状态栏提供的20个空间保留,但状态栏内容将消失,直到横幅向后滑动.有没有办法做到这一点或在状态栏上方添加子视图或窗口?
基本上我想要这样做:
这就是我所说的:
从我读过的内容来看,objc_msgSend
当你发送一个Objective-C消息时,本质上是在c级发生的事情,并且这个设置被设置为Yes
确保发送的消息具有与接收者期望的相同数量的参数.
它是否正确?也有什么优点和缺点,以将其设置为Yes
或No
?我应该只Yes
在开发和No
生产中设置它吗?
我已经看过很多关于如何与MongoDB建立多对多关系的帖子,但没有一个提到规模.例如这些帖子:
我可以通过这种设置看到的问题是MongoDB的16MB文档限制.说我有user
s,group
s和post
s.post
s有一个相关的group
和许多user
可以喜欢它的s.A中group
有很多post
s,很多user
都可以遵循它.A user
可以有许多喜欢post
的,可以跟随很多group
s.如果我用关系数据库构建它,我会这样设置:
user:
user_id
username
post:
post_id
group_id
message
group:
group_id
name
post_likes:
post_id
liked_user_id
group_followers:
group_id
follower_user_id
Run Code Online (Sandbox Code Playgroud)
从理论上讲,a group
可以有一个极小数量的post
s和user
s,a post
可以拥有无限数量的喜欢user
s,并且如果在SQL查询中正确完成分页,则user
可以拥有无限数量的喜欢post
s和group
s .
如何设置MongoDB的模式以便实现这种规模?
我为Parse Framework编写了一个异步云后台作业,根据"@"符号之前的电子邮件为每个用户生成一个显示用户名.不幸的是,当我运行这份工作时,我收到的错误是"计算操作太多".有没有办法让查询和保存串联运行而不是并行运行?我在文档中看到了promises的可能性,但我对如何使它与嵌套查询一起工作感到困惑.
Parse.Cloud.job("generateUsernameForEveryUser", function(request, status) {
// Set up to modify user data
Parse.Cloud.useMasterKey();
var counter = 0;
// Query for all users
var query = new Parse.Query(Parse.User);
query.each(function(user) {
createUsernameForUser(user, 0, {
success: function(username) {
if(username == null) {
status.error();
} else {
user.set("displayUsername", username);
user.set("displayUsernameUppercase", username.toUpperCase());
user.save();
}
},
error: function(error) {
status.error("Error: " + error.message);
}
});
}).then(function() {
// Set the job's success status
status.success("Username generation completed successfully.");
}, function(error) {
// Set the job's error …
Run Code Online (Sandbox Code Playgroud) 在测试连接到本地计算机服务器的iPhone应用程序时,我需要输入计算机的本地IP地址,而localhost
不是使用模拟器以外的设备进行测试.这会让动态IP地址和多个开发人员进行测试时变得烦人.是否有代码片段可以获取正在编译代码的计算机的IP地址,而不是IP运行应用程序的设备的地址(最好是C或Objective-C,而不是Swift)?
我有以下GoogleService-info.plist文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>TRACKING_ID</key>
<string>$(GA_tracking_id)</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
</dict>
</plist>
Run Code Online (Sandbox Code Playgroud)
我的部分构建设置如下所示:
但是,当我记录Google Analytics时,该变量不会取消引用:
VERBOSE: GoogleAnalytics 3.13 -[GAIBatchingDispatcher persist:] (GAIBatchingDispatcher.m:517): Saved hit: {
parameters = {
"&av" = "1.0.0";
"&dm" = "x86_64";
"&ds" = app;
"&sr" = 640x1136;
"&t" = screenview;
"&tid" = "$(GA_tracking_id)";
"&ul" = "en-us";
"&v" = 1;
gaiVersion = "3.13";
};
timestamp = "2015-11-04 17:38:54 +0000";
}
Run Code Online (Sandbox Code Playgroud)
我在Fabric中使用了这个策略,但那是在我的Info.plist
文件中.此外,$(PRODUCT_BUNDLE_IDENTIFIER)
工作如预期.如何将变量取消引用而不是打印出它的文字字符串值.
我已经在我的ubuntu服务器上sudo pip install psycopg2
成功运行了virtualenv
.
这是我正在尝试运行的代码:
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = "postgresql://USERNAME:PASSWORD@localhost/mydb"
db = SQLAlchemy(app)
app.debug = True
class User(db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key = True)
name = db.Column(db.String(100))
@app.route('/users/', methods = ['GET'])
def users():
query = "SELECT id, name FROM users"
results = User.query.from_statement(query).all()
json_results = []
for result in results:
d = {'id' : result.id,
'name' : result.name}
json_results.append(d)
res = jsonify(items=json_results)
res.headers['Access-Control-Allow-Origin'] = …
Run Code Online (Sandbox Code Playgroud) //Set all cancel buttons in search bars to "Done"
id searchBarButton = [UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil];
if([[[UIDevice currentDevice] systemVersion] floatValue] < 7) {
[searchBarButton setTitle:@"Done"];
} else {
//Can't do anything here or i get EXC_BAD_ACCESS
}
Run Code Online (Sandbox Code Playgroud)
viewDidLoad
仅在iOS 7 Gold Master和更新版本上调用时,才会显示EXC_BAD_ACCESS .iOS 7 beta 6及更早版本很好.
在iOS 7中有不同的方法吗?
NSLog("%@", searchBarButton)
结果在iOS7上:
2013-10-01 16:14:25.972 MP Staging[12293:a0b] <_UIBarItemAppearance:0x1aaf72d0> <Customizable class: UIBarButtonItem> when contained in (
UISearchBar
) with invocations (null)>
这在iOS 6上
<_UIBarItemAppearance: 0x1c671aa0>
var shortLocString = locationString;
console.log("Index of dash in '" + shortLocString + "': " + shortLocString.indexOf('-'));
Run Code Online (Sandbox Code Playgroud)
每次打印这个:
Index of dash in '325–333 Avenue C, New York, NY': -1
Run Code Online (Sandbox Code Playgroud)
为什么我觉得这是一个愚蠢的事情,我在漫长的一天结束时失踪了?
谢谢您的帮助!
麦克风
ios ×6
ios7 ×4
objective-c ×4
javascript ×2
xcode ×2
cornerradius ×1
flask ×1
iphone ×1
mongodb ×1
python ×1
string ×1
uilabel ×1
uisearchbar ×1
uiview ×1
uwsgi ×1