在APPdelegate代理方法中 设置window属性编译没问题 运行报错?

在APPdelegate代理类中自己写了如下代码?

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    CGRect firstFrame = CGRectMake(160, 240, 100, 150);
    BNRHypnosisView *firstView = [[BNRHypnosisView alloc] initWithFrame:firstFrame];
    firstView.backgroundColor = [UIColor redColor];
    [self.window addSubview:firstView];

    self.window.backgroundColor = [UIColor blueColor];
    [self.window makeKeyAndVisible];
    return YES;
}
//程序完成启动后,会给AppDelegate对象发送这条消息.

其中BNRHypnosisView 是一个 继承于UIView的类.

编译时没报错.
程序运行崩溃,错误信息显示:

2017-04-17 14:24:47.878 Views and View Hierarchy[31077:1917671] *** Assertion failure in -[UIApplication runWithMainScene:transitionContext:completion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3600.7.47/UIApplication.m:3677
2017-04-17 14:24:47.880 Views and View Hierarchy[31077:1917671] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'
*** First throw call stack:
(
0 CoreFoundation 0x000000010852db0b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00000001060ca141 objc_exception_throw + 48
2 CoreFoundation 0x0000000108531cf2 +[NSException raise:format:arguments:] + 98
3 Foundation 0x0000000105c643b6 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4 UIKit 0x000000010659abe6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 3343
5 UIKit 0x0000000106597793 -[UIApplication workspaceDidEndTransaction:] + 182
6 FrontBoardServices 0x0000000109c3d5f6 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK
_ + 24
7 FrontBoardServices 0x0000000109c3d46d -[FBSSerialQueue performNext] + 186
8 FrontBoardServices 0x0000000109c3d7f6 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
9 CoreFoundation 0x00000001084d3c01 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION
_ + 17
10 CoreFoundation 0x00000001084b90cf __CFRunLoopDoSources0 + 527
11 CoreFoundation 0x00000001084b85ff __CFRunLoopRun + 911
12 CoreFoundation 0x00000001084b8016 CFRunLoopRunSpecific + 406
13 UIKit 0x000000010659602f -[UIApplication _run] + 468
14 UIKit 0x000000010659c0d4 UIApplicationMain + 159
15 Views and View Hierarchy 0x0000000105afc9ff main + 111
16 libdyld.dylib 0x00000001094cd65d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

不懂了,这是设置问题还是Xcode版本问题?代码我是按照书上照抄的呀.

0

6个回答

self.window.rootViewController=firstView;
不是[self.window addSubview:firstView];

0
u014794736
dominghao 回复dominghao: 谢谢你的回答.
2 年多之前 回复
u014794736
dominghao 这里面的firstView不是UIViewController 类型的,是一个UIView子类.这里面我没有创建控制器.
2 年多之前 回复

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'
这个错误提示就是告诉你,app启动后必须设置根控制器。
self.window.rootViewController=xxx;//这个必须要设置

0

[self.window addSubview:firstView]; 错误
标准写法是
BNRHypnosisView *firstView = [[BNRHypnosisView alloc] initWithFrame:firstFrame];
firstView.backgroundColor = [UIColor redColor];
self.window.rootViewController= firstView;

0

楼上真是瞎扯。。。。都说了,根控制器,结果拿一个View去当Controller了。。。笑死人了~

0

Application windows are expected to have a root view controller at the end of application launch',这句话已经说得很清楚了啊,没设置根控制器就要添加view,当然会报错

0

我也遇到过这个问题,在self.window做任何操作之前,是需要设置它的rootViewController的,看你直接在上面加了一个view。可以有两种方式解决你的问题:
1、把你的那个view放到一个controller里面,在你这里初始化你的controller,然后设置self.window.rootViewController=你的controller
2、self.window.rootViewController = [[UIViewController alloc] init];然后再add你的这个view在self.window上。代码如下:
self.window.rootViewController = [[UIViewController alloc] init];
UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
view.backgroundColor = RGB(130, 43, 123);
[self.window addSubview:view];

0
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
AppDelegate代理方法
方法说明 didFinishLaunchingWithOptions: App加载完成 applicationWillResignActive: App将要注销激活 applicationDidEnterBackground: App已经进入后台 applicationWillEnterForeground: App将要返回前台 applicationDidBecomeActive: Ap
Appdelegate的代理方法简单解析
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions这个方法,应该都不会陌生吧? 自定义推送或者URL Schemes的时候用这个用的最多的~ LaunchOptions这个字典查看官方文档是这么解释的: (查看官方文档方法:Al
IOS开发 - AppDelegate的代理方法
[size=medium][color=red] 1. [url=http://cwlong.iteye.com/admin/blogs/2236795]Info.plist和pch文件的作用[/url] 2. [url=http://cwlong.iteye.com/blog/2236809]UIApplication的常见使用[/url] 3. [url=http://cw...
iOS10 AppDelegate文件中代理方法的作用
iOS10 AppDelegate文件中代理方法的作用#import "AppDelegate.h"@interface AppDelegate ()@end@implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *
请教高手一个编译没问题,运行报错的问题!!
// tzy4.cpp : Defines the entry point for the application.rn//rnrn#include "stdafx.h"rn#include "windows.h"rn//定义全局变量和函数rnHINSTANCE hInst;rnHINSTANCE hInstance;rnMSG msg;rnchar lpszClassName[]="window_class";rnchar *ShowText;rn//声明函数原型rnLRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM); //窗口函数rnvoid OnLButtonDown(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);rnvoid OnPaint(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);rnvoid OnDestroy(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);rn//声明窗口类rnclass CFrameWndrnrnpublic:rn HWND hWnd;rnpublic:rn int RegisterWindow();rn void Create(LPCTSTR lpClassName,LPCTSTR lpWindowName);rn void ShowWindow(int nCmdShow);rn void UpdateWindow();rn;rn//窗口类成员函数的实现rnint CFrameWnd::RegisterWindow()rnrn WNDCLASS wc;rn wc.style=0;rn wc.lpfnWndProc=WndProc;rn wc.cbClsExtra=0;rn wc.cbWndExtra=0;rn wc.hInstance=hInstance;rn wc.hIcon=LoadIcon(NULL,IDI_APPLICATION);rn wc.hCursor=LoadCursor(NULL,IDC_ARROW);rn wc.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);rn wc.lpszClassName=NULL;rn wc.lpszClassName=lpszClassName;rn return RegisterClass(&wc);rnrnvoid CFrameWnd::Create(LPCTSTR lpClassName,LPCTSTR lpWindowName)rnrn RegisterWindow();rn hInst=hInstance;rn hWnd=CreateWindow(lpszClassName,lpWindowName,WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,rn 0,CW_USEDEFAULT,0,NULL,NULL,hInstance,NULL);rnrnvoid CFrameWnd::ShowWindow(int nCmdShow)rnrn ::ShowWindow(hWnd,nCmdShow);rnrnvoid CFrameWnd::UpdateWindow()rnrn ::UpdateWindow(hWnd);rnrnrn//声明应用程序类rnclass CWinApprnrnpublic:rn CFrameWnd *m_pMainWnd;rnpublic:rn BOOL InitInstance(int nCmdShow);rn int Run();rn ~CWinApp();rn;rn//应用程序类成员函数的实现rnBOOL CWinApp::InitInstance(int nCmdShow)rnrn m_pMainWnd=new CFrameWnd;rn m_pMainWnd->Create(NULL,"封装的Window程序");rn m_pMainWnd->ShowWindow(nCmdShow);rn m_pMainWnd->UpdateWindow();rn return TRUE;rnrnint CWinApp::Run()rnrn while(GetMessage(&msg,NULL,0,0))rn rn TranslateMessage(&msg);rn DispatchMessage(&msg);rn rn return msg.wParam;rnrnCWinApp::~CWinApp()rnrn delete m_pMainWnd;rnrnrn//程序员定义的WinApp对象theApprnCWinApp theApp;rn//主函数rnrnint APIENTRY WinMain(HINSTANCE hInstance,rn HINSTANCE hPrevInstance,rn LPSTR lpCmdLine,rn int nCmdShow)rnrn // TODO: Place code here.rn int ResultCode=-1;rn theApp.InitInstance(nCmdShow);rn return ResultCode=theApp.Run();rnrn//窗口函数的实现rnLRESULT CALLBACK WndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)rnrn switch(message)rn rn case WM_LBUTTONDOWN:rn OnLButtonDown(hWnd,message,wParam,lParam);rn break;rn case WM_PAINT:rn OnPaint(hWnd,message,wParam,lParam);rn break;rn case WM_DESTROY:rn OnDestroy(hWnd,message,wParam,lParam);rn break;rn default:rn return DefWindowProc(hWnd,message,wParam,lParam);rn rn return 0;rnrnvoid OnLButtonDown(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)rnrn ShowText="Hello!";rn InvalidateRect(hWnd,NULL,1);rnrnvoid OnPaint(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)rnrn PAINTSTRUCT ps;rn HDC hdc;rn hdc=BeginPaint(hWnd,&ps);rn TextOut(hdc,50,50,ShowText,6);rn EndPaint(hWnd,&ps);rnrnvoid OnDestroy(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)rnrn PostQuitMessage(0);rnrnrn这个程序我编译没有问题,但是运行的时候报:rn"0x77e3a3fe"指令引用的"0xcccccccc"内存。该内存不能为"read"rnrn请哪位高手指点一下怎么回事?rnrn
XP下没问题的代码在win7下运行报错
IPAddress[] ip=System.Net.Dns.GetHostEntry("192.168.0.10");rn两台机器,分别是XP和Win7,IP是192.168.1.100和192.168.1.101rn结果XP执行这个代码就没问题,Win7就获取不到地址列表,请问是什么情况
iOS 获取AppDelegate单例类的属性
AppDelegate *app = (AppDelegate *)[[UIApplication sharedApplication] delegate]; app.vbool==YES;
android—studio设置代理方法
如图设置即可,简单不哈哈哈 http://127.0.0.1:1080/proxy.pac
UISearchBar基本设置 和 代理方法
UISearchBar的基本设置以及delegate介绍
记录:升级android studio,项目编译没问题,运行报错,找不到文件
升级android studio到3.4.1,Sdk Build-Tools 到29,项目编译没有问题,但是运行报错,报错信息: Android resource linking failed error: resource andorid:style/Theme.AppCompat.Light.DarkActionBar not found. error: resource andorid...
184,ScrollView中常用的属性与代理方法
1,属性 @property(nonatomic) CGPoint contentOffset;  这个属性用来表示UIScrollView滚动的位置 @property(nonatomic) CGSize contentSize;  这个属性用来表示UIScrollView内容的尺寸,滚动范围(能滚多远) @property(nonatomic) UI
jsp中的window属性
jsp中的window属性
Window中常用的属性
注意的是window对象是浏览器宿主对象,与js语言无关 window对象的方法: window.alert(message); window.confirm(message);//返回一个布尔值 window.prompt(message[,defaultstr]); window.close();//关闭窗口 window.print();打印 window.setIntval(
一、IOS程序执行顺序、APPdelegate代理方法执行顺序、ViewController 生命周期
IOS程序执行顺序、APPdelegate代理方法执行顺序、ViewController 生命周期
appdelegate
代理协议
android studio 编译运行报错:
Cannot reload AVD list: cvc-enumeration-valid: Value ‘280dpi’ is not facet-valid with respect to enumeration ‘[ldpi, mdpi, tvdpi, hdpi, xhdpi, 400dpi, xxhdpi, 560dpi, xxxhdpi]’. It must be a value from
百度地图编译通过运行报错
![图片说明](https://img-ask.csdn.net/upload/201603/27/1459067238_93898.png)nn在学习百度地图的使用按照别人的demo敲的不知道为什么会出现错误哪位前辈帮忙看一下.nnError:(27, 22) 错误: 无法将类 BMapManager中的构造器 BMapManager应用到给定类型;n需要: 没有参数n找到: MainActivityn原因: 实际参数列表和形式参数列表长度不同nnError:(31, 20) 错误: 无法将类 BMapManager中的方法 init应用到给定类型;n需要: 没有参数n找到: String,n原因: 实际参数列表和形式参数列表长度不同
编译正常,但是运行报错,
编译正常,但是运行报错,rnrn*p = 'h'; //这行正常呀rnrn*ptr = 'h'; //这一行,编译正常,运行报错rnrn同样的操作,为何前者正常,后者就报错呢rnrn[code=C/C++]rnrn#include "stdafx.h"rn#include rn#include rnusing namespace std;rnrnint main(int argc, char* argv[])rnrn char str[12] = "Hello";rn rn char *p = str;rn rn *p = 'h'; //这行正常呀rn cout << p << endl;rnrnrn char *ptr = "666Hello";rn *ptr = 'h'; //这一行,编译正常,运行报错rnrn cout << ptr << endl;rn return 0;rnrn[/code]
cmd下编译运行报错
程序在myeclipse下运行没有问题,可以得到正常的结果。可是在cmd下编译在运行则报错。rnjavac -cp f:\ojdbc14_g.jar f:\Hello.javarnjava -cp ,;ojdbc14_g.jar HellornException in thread "main" java.lang.NoClassDefFoundError: HellornCaused by: java.lang.ClassNotFoundException: Hellorn at java.net.URLClassLoader$1.run(Unknown Source)rn at java.security.AccessController.doPrivileged(Native Method)rn at java.net.URLClassLoader.findClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rnCould not find the main class: Hello. Program will exit.rnrn网上查找说是环境变量的问题,但是检查没有发现。写最简单的程序编译也是可以运行的。ojdbc14_g.jar是数据库的jar包。rn程序代码见附件。rn此段代码是一个web项目中的一部分。现在是为了解决如下问题:rn通过shell脚本调用该项目中Hello.java的某一方法(当然目前才写完这段代码,对一些异常尚未处理,功能还没有做完),我的思路是在Hello中添加main方法然后将该类打包成jar然后写shell脚本调用。由于从为使用过shell脚本,也不知道该方法是否可行,或者是否有其他的更好的方法,求大神赐教。(原web项目中均是使用hibernate操作数据库,与下面的数据库连接不一样)。rnrn谢谢了!如果您有什么好的解决方式,请加我QQ393420225或者回帖。多谢!rn[code=java]rnrnimport java.io.BufferedInputStream;rnimport java.io.BufferedOutputStream;rnimport java.io.DataInputStream;rnimport java.io.DataOutputStream;rnimport java.io.FileOutputStream;rnimport java.io.IOException;rnimport java.io.UnsupportedEncodingException;rnrnimport java.net.InetSocketAddress;rnimport java.net.Socket;rnimport java.sql.Connection;rnimport java.sql.DriverManager;rnrnimport java.sql.Statement;rnimport java.text.SimpleDateFormat;rnimport java.util.Calendar;rnimport java.util.Date;rnrnrnpublic class Hellorn private String head1 = " 135500000000000000000000** 003";rn private String head2 = "000";rn private String head3 = "000000000";rn private String head4 = " 0000Y 0000000";rn private String tail = " " +rn "0000000000000000000000 00000000000000000" +rn " " +rn " " +rn " " +rn " ";rn private String successCode = "0000";rn private String errorCode = "0188";rn public void core009022()rn String icode = "009022";rn SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-ddhh:mm:ss");rn SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMdd");rn String workTime = sdf1.format(new Date());rn String workday = sdf2.format(new Date());rn long date1 = new Date().getTime();rn String getWay = "qqq";rnrn rn String uuid = this.getUUID("02", "J", "8800501","009022");rn String head = head1+"77001"+head2+getUserNoStr("8800501")+icode+head3+workday+head4+"1"+uuid;rn String xmlstr ="\r\n111111111111" +rn "009022 " +rn head+"";rn String flag;rn tryrn flag = this.coreSendForAcptMatu(xmlstr,"009022","11111111111",Long.valueOf(1111111));rn// rcoreBean009022 = (RCoreBean009022)XmlParserToObject.parserXML(responseXml.substring(10, responseXml.length()), rcoreBean009022);rn long date2 = new Date().getTime();rn long haomiao =date2-date1; rn if("1".equals(flag))rn System.out.println("end:true");rn System.out.println("msg:"+getWay+"@true@"+haomiao); rn elsern System.out.println("end:false");rn System.out.println("msg:"+getWay+"@false@"+haomiao);rn rn rn catch (Exception e) rn long date2 = new Date().getTime();rn System.out.println(date2);rn long haomiao =date2-date1; rn System.out.println("end:false");rn System.out.println("msg:"+getWay+"@false@"+haomiao);rn rn rn rn public String coreSendForAcptMatu(String bodyXml,String iCode,String acct,Long acptBatchId )rn String str = "";rn try rn str = String .format("%010d", bodyXml.getBytes("GBK").length);rn String ip = "172.16.8.11";rn int port = 11017;rn str = this.sendAndReciveMsgForAcptMatu(ip,port,str+bodyXml,iCode,acct,acptBatchId);rn catch (UnsupportedEncodingException e) rn e.printStackTrace();rn rn return str;rn rn rn public String sendAndReciveMsgForAcptMatu(String ip, int port,String msg,String iCode,String acct,Long acptBatchId )rn String flag = "1";rn Connection conn=null;rn Statement stmt = null;rn Socket socket = new Socket();rn tryrn Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();rn String url="jdbc:oracle:thin:@172.16.12.201:1521:date1211";rn String user = "test1";rn String password = "test1";rn conn = DriverManager.getConnection(url, user, password);rn String sendlog = "insert into core_or_payment_log (ID, CORE_CODE, REMARK, CORE_LOG, SEND_ID, CREATE_TIME, ACCT, ACPT_BATCH_ID) " +rn "values (hibernate_sequence.nextval,'009022','发出','"+msg+"','',''"+",'"+acct+"',"+acptBatchId+")";rnrn stmt = conn.createStatement();rn stmt.executeUpdate(sendlog);rn rn String respMsg = "";rn InetSocketAddress iAddress = new InetSocketAddress(ip, port);rn socket.connect(iAddress);rn if (socket.isConnected()) rn sendMsg(socket, msg);rn respMsg = reciveMsg(socket);rn if(null==respMsg||"".equals(respMsg))rn flag = "0";rn throw new Exception("异常!");rn rn respMsg = respMsg.replaceAll("'", "\"");rn String receivelog ="insert into core_or_payment_log (ID, CORE_CODE, REMARK, CORE_LOG, SEND_ID, CREATE_TIME, ACCT, ACPT_BATCH_ID) " +rn "values (hibernate_sequence.nextval,'009022','接收','"+respMsg+"','',''"+",'"+acct+"',"+acptBatchId+")";rn stmt.executeUpdate(receivelog);rn rn elsern flag = "0";rn rn catch (Exception e) rn System.out.println(e);rn flag = "0";rn finally rn close(socket);rn rn return flag;rn rn rn public static void sendMsg(Socket s, String msg) rn DataOutputStream bos = null;rn FileOutputStream fos = null;rn try rn byte[] buffer =null;rn try rn buffer = msg.getBytes("GBK");rn bos = new DataOutputStream(new BufferedOutputStream(s.getOutputStream()));rn bos.write(buffer);rn bos.flush();rn rn fos = new FileOutputStream("F:\\coreMsg.txt");rn DataOutputStream out = new DataOutputStream(fos);rn out.write(buffer);rn out.close();rn rn rn catch (Exception e) rn e.printStackTrace();rn rn catch (Exception e) rn e.printStackTrace();rn finallyrn if(fos!=null)rn try rn fos.close();rn catch (IOException e) rn e.printStackTrace();rn rn rn rn rn rn public static String reciveMsg(Socket socket) throws IOException rn String responsXml = "";rn try rn DataInputStream dis = new DataInputStream(new BufferedInputStream(socket.getInputStream())); rn byte[] bytes = null;rn byte[] header = new byte[10];rn int len;rn int msgLen = 0;rn if ((len = dis.read(header)) > 0) rn msgLen = Integer.parseInt(new String(header, "GBK"));rn bytes = new byte[header.length];rn System.arraycopy(header, 0, bytes, 0, header.length);rn elsern return "";rn rn byte[] b = new byte[msgLen];rn while ((len = dis.read(b)) != -1) rn byte[] tmp = new byte[bytes.length];rn System.arraycopy(bytes, 0, tmp, 0, bytes.length);rn bytes = new byte[bytes.length + len];rn System.arraycopy(tmp, 0, bytes, 0, tmp.length);rn System.arraycopy(b, 0, bytes, tmp.length, len);rn rn rn rn if (bytes != null) rn responsXml = new String(bytes,"GBK");rn else rn responsXml = "";rn rn catch (IOException e) rn e.printStackTrace();rn throw new RuntimeException("错误");rn rn return responsXml;rn rn public String getUUID(String code,String strCode,String strId,String iCode)rn String flowNo = ""; rn if(strId.length()>7)rn flowNo = strCode+strId.substring(strId.length()-7, strId.length());rn elsern flowNo = strCode+strId;rn rn String flowNoStrtemp="";rn for(int i = 0;i<8-flowNo.length();i++)rn flowNoStrtemp="0"+flowNoStrtemp;rn rn String flowNoStr = flowNoStrtemp+flowNo;rn String iCodeStr = String .format("%07d", iCode.length());rn String dt = "";rn SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmss");rn Calendar cal = Calendar.getInstance();rn dt = sdf.format(cal.getTime());rn return "G"+code+dt+flowNoStr+iCodeStr;rn rn public String getUserNoStr(String userNoStr)rn String flowNoStrtemp="";rn for(int i = 0;i<7-userNoStr.length();i++)rn flowNoStrtemp="0"+flowNoStrtemp;rn rn userNoStr = flowNoStrtemp+userNoStr;rn return userNoStr;rn rn public static void close(Socket s) rn try rn if (s != null) s.close();rn catch (IOException e) rn e.printStackTrace();rn rn rn rn public static void main(String[] args) rn Hello hh = new Hello();rn hh.core009022();rn rnrn[/code]
编译好的程序运行报错
我在WIN7下用VS2010编译32bits的程序,但是在运行时报错“应用程序发生异常0xc0000409位置为0x00611288”这是什么错rn?应该怎么改?我最开始的程序都没有这个错误的~但是修改了一些代码之后哦在WIN7上运行良好,但是xp却报错了。
AppDelegate文件中跳转页面
目前知道有两种方式,自己小结一下: 方式一: UINavigationController *presentNav = [[UINavigationController alloc] initWithRootViewController:vcReply]; [self.window.rootViewController presentViewController:prese...
代理中实现代理方法和调用代理方法的理解
当我在做2个界面之间相互传值的时候,我遇到了这个问题
AppDelegate中的常用方法使用说明
1、当应用程序启动时(不包括已在后台的情况下转到前台),调用此回调。launchOptions是启动参数,假如用户通过点击push通知启动的应用,这个参数里会存储一些push通知的信息。– (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
重写AppDelegate中的UINavigationBar
我想重写UINavigationBar,然后添加一个自定义图片,我添加到了AppDelegate文件和执行文件中,但是没有用。rnrn @implementation UINavigationBar (CustomImage)rn - (void)drawRect:(CGRect)rect rn UIImage *image = [UIImage imageNamed: @"redbar.png"];rn [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];rn rn @end
AppDelegate中定义全局变量
在AppDelegate类中轻松定义全局变量,几乎和C语言一样来定义。
ejb 部署没问题,运行报错高手请指点!!
C:\HelloWorld>java -classpath C:\Sun\AppServer\lib\j2ee.jar;.;HelloWorldClient.jrnar; Clientrnhellornhello1rnjavax.naming.NoInitialContextException: Need to specify class name in environmenrnt or system property, or as an applet parameter, or in an application resource frnile: java.naming.factory.initialrn at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)rn at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)rn at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)rn at javax.naming.InitialContext.lookup(Unknown Source)rn at Client.main(Client.java:15)rnrnrn我是不是少了什么jarrn
MyEclipse 编写JSP页面运行报错???代码没问题
MyEclipse 编写JSP页面运行报错???代码没问题rn是环境没配置好还是怎么回事啊>? 谢谢rn rn错误信息:rnHTTP Status 404 - /MyWeb/rnrn--------------------------------------------------------------------------------rnrntype Status reportrnrnmessage /MyWeb/rnrndescription The requested resource (/MyWeb/) is not available.rnrnrn--------------------------------------------------------------------------------rnrnApache Tomcat/6.0.13
go/git设置及取消代理方法
本地开启VPN后,GIt也需要设置代理,才能正常略过GFW,访问goole code等网站 设置如下(可复制): git config --global https.proxy http://127.0.0.1:1080  git config --global https.proxy http://127.0.0.1:1080 git config --global http.proxy...
Window属性
windowBackground:窗体的背景 windowFrame:Dialog 是否有边框 windowNoTitle:窗体是否有标题 windowActionBar:窗体是否有ActionBar windowFullscreen:是否为全屏 windowOverscan: 是否要求窗体铺满整屏幕 windowIsFloating:窗体是否浮在下层之上 windowConten
window属性
/** * windowBackground 背景 * windowBackgroundFallback * windowClipToOutline * windowFrame Dialog 是否有边框 * windowNoTitle 是否有标题 * windowFullscreen 是否为全屏 * windowOverscan 是否要求窗体铺满整屏幕 * wind
AppDelegate 中的函数介绍
– (BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions; 当应用程序加载时触发, 在方法中创建 window 窗口对象, 让 window 对象成为应用程序主窗口并且可视 - (BOOL)application:(UIApplication
代码整理-AppDelegate 中
//设置启动图时间 [NSThread sleepForTimeInterval:1.0];//常加 self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds]; self.window.backgroundColor = [UIColor whiteColor]; [self.
Js中window属性和方法
一、window属性和方法 1. confirm //效果类似于alert,但是有一个bool类型的返回值 var result=confirm("请确认"); alert(result); 2. setTimeout //延迟函数,时间单位是毫秒 setTimeout(function(){     alert("asassaa"); },1000); 3. setInter
Xcode中的main.m文件与AppDelegate中的代理方法简介---iOS基础篇
main.m文件中的方法简介 &vbsp如上图所示,该方法为Xcode中的main.m文件中默认的一个方法,我们只要创建一个工程它都会出现在我们的工程中,可能你会好奇这个方法是干什么的那么下边就来分析一下它。 &vbsp这个默认的方法为iOS程序的入口,iOS程序只要一运行便从这个main.m函数开始执行,但是在main函数中我们其实只能看到一个方法,这个方法内部是一个消息循环(相当于一个死循
window下编译boost库中的regex
window下编译boost库regex库的步骤: 1. 启动【Visual Studio 2005 命令提示】窗口 2. cd E:\mywork3\T-Test\boost_1_47_0\libs\regex\build 3. 执行 nmake -f vc8.mak
Mybatis中mapper代理方法
User.java  存储用户的信息 UserMapper.xml   配置查询用户的sql语句 SqlMapConfig.xml    加载配置文件(即全局配置文件) UserMapper.java      mapper接口 UserMapperTest.java   数据库操作文件 UserMapperTest.java public class UserMapperTe
请问调用window api的编译设置问题?
请问下面的程序,在vc++环境下编译应该首先在工程菜单的seting选项如何设置?rnrn#include"stdafx.h"rn#include"iostream.h"rn#include"process.h"rnCloseHandle();rn#include"windows.h"rn#include"stdio.h"rnBOOL repeat=TRUE;rnDWORD WINAPI MyThread1(LPVOID lpParameter)rnrnwhile(repeat)rnrn printf("How are you?/n");rnrn Sleep(1);rnrnDWORD exitCode;rnExitThread(exitCode);rnreturn 0;rnrnDWORD WINAPI MyThread2(LPVOID lpParameter)rnrn while(repeat)rn rn printf("Very well/n");rn Sleep(1);rn rn DWORD exitCode;rn ExitThread(exitCode);rn return 0;rnrnDWORD WINAPI KillThread(LPVOID lpParameter)rnrn repeat=false;rn return 0;rnrnint main(int argc,char*argc[])rnrn HANDLE handle1,handle2,handle3;rn DWORD dw1,dw2,dw3;rn handle1=CreateThread(NULL,0,MyThread1,NULL,0,&dw1);rn if(handle1==NULL)rn rn printf("Create Thread 1 Failed!/n");rn return -1;rn rn handle2=CreateThread(NULL,0,MyThread2,NULL,0,&dw2);rn if(handle2==NULL)rn rn printf("Create Thread 2 failed!\n");rn return -1;rn rn Sleep(1000);rn handle3=CreateThread(NULL,0,KillThread,NULL,0,&dw3);rn if(handle3==NULL)rn rn printf("Create Thread 3 Failed\n");rn return -1;rn rn CloseHandle(handle1);rn CloseHandle(handle2);rn CloseHandle(handle3);rn return 0;rnrnrn
编译没问题,运行出错
编译没问题,运行出错:说是要用到网络资源,不然的话可以自己输入一个“borland C++ builder6.msi”路径。rn哪位大侠知道怎么回事,请指点迷津!rn谢谢!
编译没问题,执行不了!
代码编译时没问题,执行时却出现以下错误提示rnrnquote2.obj : error LNK2005: _main already defined in quote3.objrnDebug/quote3.exe : fatal error LNK1169: one or more multiply defined symbols foundrn执行link.exe时出错.rnrn请各位指点一二。rn补充:我用VC在同一个工程中,保存了两个功能类似的cpp,分别是quote2,quote3.rn rn
android studio编译运行报错(一)
android studio 编译 运行 报错