我有一个包含不同对象的Mutable数组,如字符串,UIImage等.它们的排序方式如下:
例:
BugData *bug1 = [[BugData alloc]initWithTitle:@"Spider" rank:@"123" thumbImage:[UIImage imageNamed:@"1.jpeg"]];
...
...
NSMutableArray *bugs = [NSMutableArray arrayWithObjects:bug1,bug2,bug3,bug4, nil];
Run Code Online (Sandbox Code Playgroud)
所以基本上它是一个包含不同属性的对象的数组.
我尝试使用下一个代码将单个字符串保存到文件中并且它工作正常但是当我尝试使用对象保存数组时,我得到一个空的plist文件.
NSString *docsDir = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSString * path = [docsDir stringByAppendingPathComponent:@"data.plist"];
NSLog(@"%@",bugs); //Making sure the array is full
[bugs writeToFile:path atomically:YES];
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
我有一个带有5个标签的TabBar的应用程序(常规标签栏没有自定义类).当我启动应用程序时,左侧选项卡打开.我希望它首先打开中间的一个.我试过试试
[self.tabBarController setSelectedIndex:3];
Run Code Online (Sandbox Code Playgroud)
在ViewController的ViewDidLoad中,首先打开但是选项卡没有切换.
我可以看到它突出显示但未选中.如果我把上面的代码放在viewWillAppear它下面就会在第一次运行时被选中,但是当我不时地选择左边的标签时它会跳到中间的那个.
也尝试了这个没有成功:
DetailsViewController* vc = [self.storyboard instantiateViewControllerWithIdentifier:@"DetailsViewController"];
[self.navigationController pushViewController:vc animated:true];
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
我需要续订我的开发和分发证书.它很快到期,我有点担心这样做,然后才100%确定我做的是正确的事情.(这些证书附带的应用程序商店有20个应用程序)任何方式,我在网上阅读了一些指南,但是在我从我的钥匙串请求新的CSR之后找不到答案,我是否应该使用相同的certSigningRequest文件既包括开发和发行,还是我应该在每个之前创建一个新的?
如果我去年没有保存CSR,我是否需要上传新的pems文件以获取我的应用程序的推送通知?
EKEventStore *eventStore = [[UpdateManager sharedUpdateManager] eventStore];
if ([eventStore respondsToSelector:@selector(requestAccessToEntityType:completion:)])
{
[eventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error)
{
if (granted)...
Run Code Online (Sandbox Code Playgroud)
我想要求用户允许将事件添加到他的日历中.在我被授予后,我需要再次请求权限,例如我想删除一个事件(在应用程序关闭并重新打开后的另一个会话中)或者它只是一个想要的时间吗?
如果这是一次性的事情,我可以在第一次午餐时把它放在ViewDidLoad中,只是为了"摆脱它"吗?
我正在尝试显示一个满载的webview.我不希望用户在加载过程中看到webview.我一次处理几个webview并使用webViewDidFinishLoad它对我来说更复杂,所以我试图做这样的事情:
while(_lastWebView.isLoading)
{
_lastWebView.hidden=YES;
}
_lastWebView.hidden=NO;
Run Code Online (Sandbox Code Playgroud)
但是我得到了这个消息:void SendDelegateMessage(NSInvocation*):委托()在等待10秒后无法返回.主运行循环模式:kCFRunLoopDefaultMode
我不明白为什么进入循环因为isLoading加载完成后返回0.
void push(struct node** head_ref, int new_data)
{
/* allocate node */
struct node* new_node =
(struct node*) malloc(sizeof(struct node));
/* put in the data */
new_node->data = new_data;
/* link the old list off the new node */
new_node->next = (*head_ref);
/* move the head to point to the new node */
(*head_ref) = new_node;
}
Run Code Online (Sandbox Code Playgroud)
如果我没记错的话,在指针上放一个括号意味着调用一个函数?如果这是真的我真的不明白为什么*head_ref上有括号.我喜欢*head_ref这个代码中我为什么需要括号的一点解释.
A = 110000000 - 384 Blue+Red
B = 011000010 - 194 Green+Black+Red
A & B = C = 010000000 - 128 Red
Run Code Online (Sandbox Code Playgroud)
如何检查B是否包含A中的所有位以及其他位?在上面的情况下,我想得到"假".
我正在使用XCode和objective-c但据我所知这应该不重要
struct node* new_node =
(struct node*) malloc(sizeof(struct node));
Run Code Online (Sandbox Code Playgroud)
我不明白*这里:...(struct node*) malloc(siz...
首先,*属于node或malloc?这是什么意思?指针如何与内存函数malloc有关?我真的很困惑*位置
谢谢
我已经在线搜索并在stackoverflow上搜索但是找不到一个好的答案如何做到这一点.我读过
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section`
Run Code Online (Sandbox Code Playgroud)
但那里没有任何东西可以帮助我.
最接近标题图像背景的是:
headerView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"myBackground.png"]];
Run Code Online (Sandbox Code Playgroud)
但它将图片显示为无法控制其大小的图案.
该行deviceToken = deviceToken.replace(' ','').decode('hex')正在崩溃我的脚本.这是设备令牌:(更改了一些数字)
deviceToken = '9cdcb815 d93e11ce 52baaf6c 14e27cc8 31d5ce62 2e51ce6d f75692c2 3617cadb'
第一个推送通知发送正常,所以我确定设备令牌是好的,但在第一个事件后,我收到此错误:
['"INBOX" (UNSEEN 12)']
Sent Push alert.
Got an event!
['"INBOX" (UNSEEN 13)']
Exception in thread Thread-4:Exception in thread Thread-4:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 530, in __bootstrap_inner
self.run()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 483, in run
self.__target(*self.__args, **self.__kwargs)
File "server.py", line 111, in idle
self.dosync()
File "server.py", line 118, in dosync
sendPushNotification(numUnseen)
File "server.py", line 54, in sendPushNotification
deviceToken = deviceToken.replace(' ','').decode('hex') …Run Code Online (Sandbox Code Playgroud) objective-c ×6
ios ×5
c ×3
cocoa-touch ×3
pointers ×2
arrays ×1
binary ×1
brackets ×1
c++ ×1
certificate ×1
csr ×1
plist ×1
python ×1
python-2.7 ×1
struct ×1
tabbar ×1
uitableview ×1
uiwebview ×1
xcode ×1