标签: xcode4

@autoreleasepool犯错误

我尝试用MagicalRecord编译程序,我有错误

一世从编辑中打印屏幕 不知道如何解决这个问题

在较旧的sdk中,每件事都可以.

cocoa-touch ios xcode4

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

初始化View Controller变量?

这对我来说是一个天真的问题,但我的View Controller中有一些变量,我不知道应该在哪里初始化它们.我的意思是,如果这是一个自定义类,那么我通常会初始化并在init方法或自定义initWith方法中赋予它们值.

由此产生的其他问题包括:

视图控制器的init方法在哪里.而且,由于View Controller本质上是一个类,并且必须在某个地方使用alloc-init.究竟是在哪里创建View Controller的实例?

非常感谢,

Parijat Kalia

xcode objective-c xcode4

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

Admob不工作?

我之前制作了一个应用程序,这个代码在5.0.1更新之前工作但它不适用于新的应用程序.可能是什么问题呢?

这是代码:

{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
// Do any additional setup after loading the view from its nib.
// Create a view of the standard size at the bottom of the screen. 
bannerView_ = [[GADBannerView alloc] initWithFrame:CGRectMake(0.0, self.view.frame.size.height - GAD_SIZE_320x50.height, GAD_SIZE_320x50.width, GAD_SIZE_320x50.height)]; 
// Specify the ad's "unit identifier." This is your AdMob Publisher ID. 
bannerView_.adUnitID = MY_BANNER_UNIT_ID; 
// Let the runtime know which UIViewController to restore after taking 
// …
Run Code Online (Sandbox Code Playgroud)

iphone ads admob xcode4 ios5

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

你如何禁用故事板?

我用故事板为iPhone和iPad制作了一个应用程序.让我知道你是否可以在项目中禁用故事板或者我是否需要创建一个没有故事板的新项目.

iphone ipad ios xcode4

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

如何判断NSPanel何时获得焦点或成为关键?

我正在XCode4中编写一个Cocoa/Objective-C应用程序,我需要知道我的首选项面板何时打开.我需要一些像windowDidBecomeKey这样的回调 ; 我试图按照提供的解决方案这个问题,但也windowDidBecomeKey还是windowDidExpose表现为委托方法(但其他人一样windowDidLoad,windowWillLoad等做的).

为了明确我的意思,"不要作为委托方法出现",我的意思是当我开始输入方法名称时,它们不会显示在自动完成中.无论如何我确实尝试过定义它们,但它们从未被调用过.

NSPanel对象缺乏这些方法,或有更多的东西我有什么关系?

目前,我有一个界面PrefWindowController:

PrefWindowController.h:

#import <Cocoa/Cocoa.h>

@interface PrefWindowController : NSWindowController
    //Delegate methods like windowDidBecomeKey appear to not be available here
@end
Run Code Online (Sandbox Code Playgroud)

PrefWindowController.m:

@implementation PrefWindowController

- (id)initWithWindow:(NSWindow *)window
{
    self = [super initWithWindow:window];
    if (self) {
        NSAlert *alert = [[[NSAlert alloc] init] autorelease];
        [alert setMessageText:@".."];
        [alert runModal];
    }

    return self;
}

- (void)windowDidLoad
{
    NSAlert *alert = …
Run Code Online (Sandbox Code Playgroud)

cocoa objective-c nswindowcontroller xcode4 nspanel

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

编译简单的hello world文件的解析和语义问题

我使用xcode 4,我已经编译了Cocoa应用程序没有问题,但如果我选择编译一个像这样的简单命令行工具:

#import <Foundation/Foundation.h>
#import <stdio.h>

int main (int argc, const char * argv[])
{
    printf("Hello world");
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我得到了很多解析和语义问题:

_Issues_

在此输入图像描述

如果这还不够,我可以拿整个窗口的屏幕.那么这些错误可能是什么原因呢?

objective-c xcode4

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

可变长度的非POD元素类型'string'(又名'basic_string <char>')c ++

我在我的c ++代码中得到此错误非POD元素类型string(aka basic_string<char>)的可变长度数组.

string words[numWords];
Run Code Online (Sandbox Code Playgroud)

如果我摆脱numWords并输入一个数字,这工作正常,但如果我把相同的数字放在一个变量,它给我Variable length array of non-POD element type 'string' (aka 'basic_string<char>')错误,我已经这样做过,它在视觉工作室工作,但我现在在Xcode中尝试过它不起作用.我已经尝试过使用矢量,但我无法让它们存储任何数据,它们只是空白.

对于那些问我这是我的矢量代码的人应该都在那里

char ch;

ifstream repFile("//Users//bobthemac//Documents//c++asignment//c++asignment//test1.txt");

while(repFile.get(ch))
{
    if(ch == ' ' || ch == '\n' || ch == '\t')
    {
        numWords++;
    }
}

vector<string> words (numWords);

while(repFile >> x)
    words.push_back(x);
repFile.close();
Run Code Online (Sandbox Code Playgroud)

c++ arrays string xcode xcode4

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

使用模拟器的多个项目

我正在使用Xcode模拟器比较多个项目的运行.每次在运行其他项目之后我去构建一个项目时,Xcode告诉我它无法执行构建和运行,因为模拟器正在使用中.然后我必须找到另一个项目窗口,在模拟器中停止运行(Cmd-.),然后切换回上一个窗口并重建.我可以制作单个键盘快捷键来停止模拟器中的当前运行,在模拟器中构建和运行当前项目吗?

xcode xcode4 ios-simulator

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

在xcode 4中,“其他c标志”和“其他c ++标志”之间有什么区别?

此外,是否直接在相应标签的对面列出它们是否将它们设置为调试和发布版本?

c c++ compiler-flags xcode4

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

安装xCode4.3后,filemerge应用程序无法从svnX运行?

我刚刚安装了xcode 4.3,因为他们在xCode包中移动了filemerge应用程序.filemerge没有通过svnX app(我在svnX中将默认应用程序设置为filemerge)来查找差异.如何解决这个问题(Xcode4.3 + svnX + filemerge)?

iphone xcode4 xcode4.3

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