ios compilation problems

Post here your questions about the Objective-C API for SFS2X

Moderators: Lapo, Bax

skipper3k
Posts: 20
Joined: 22 Feb 2012, 09:21

ios compilation problems

Postby skipper3k » 22 Feb 2012, 09:34

I downloaded the new ios api 1.0.1 framework for smartfoxserver 2X, imported it to my project as shown in instructions, but I get a linker error :

Code: Select all

Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_SmartFoxiPhoneClient", referenced from:
      objc-class-ref in MySFS.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)


I am using the SmartfoxiPhoneClient object just like in the older ios examples I could find, which used to work with RC1 version of the SFS2X.

I tried to change the instantiation of the smartfox object from the SmartFoxiPhoneClient object to SmartFox2XClient. When I do that my project compiles, but the app crashes uppon connecting with no error just (gdb) :

Code: Select all

2012-02-22 10:31:11.262 MySFSExample[10241:707] [SFS - INFO]sending handshake request: isReconnection : NO
(gdb)


any ideas what I am doing wrong ?
User avatar
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Re: ios compilation problems

Postby A51Integrated » 22 Feb 2012, 11:00

You can get a full backtrace after the crash by entering "bt" after the "(gdb):".

Try and see if you can find out what's happening there, otherwise, post the results and we'll have a look.
A51 Integrated
http://a51integrated.com / +1 416-703-2300
skipper3k
Posts: 20
Joined: 22 Feb 2012, 09:21

Re: ios compilation problems

Postby skipper3k » 22 Feb 2012, 11:43

I guess I'm missing SBJson dependencies :

Code: Select all

2012-02-22 12:41:18.862 MySFSExample[10676:707] [SFS - INFO]sending handshake request: isReconnection : NO
(gdb) bt
#0  0x000260dc in -[SBJsonWriter setHumanReadable:] ()
#1  0x00026378 in -[SBJsonWriter setHumanReadable:] ()
(gdb)


I'll try to look into that.

Thanks for the tip.
skipper3k
Posts: 20
Joined: 22 Feb 2012, 09:21

Re: ios compilation problems

Postby skipper3k » 22 Feb 2012, 12:32

I can't seem to get it to work even with the new sbjson library.

Any suggestions ?
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: ios compilation problems

Postby Bax » 22 Feb 2012, 12:39

Please read the client API setup instructions in the documentation, as we changed the import statement.
Paolo Bax
The SmartFoxServer Team
skipper3k
Posts: 20
Joined: 22 Feb 2012, 09:21

Re: ios compilation problems

Postby skipper3k » 22 Feb 2012, 12:53

Hi Bax.

I have setup the API according to the instructions. My app compiles and runs. I also se in the smartfoxserver log, that a session was created. But when the response comes back to the ios client it crashes, with the error I posted previously.

Now I am looking for what I might have missed.

To elaborate my settings :
I have pretty much the default server.xml configuration, except for the ip part. Protocol mode is binary.
My ios config.xml looks like this:

Code: Select all

<SmartFoxConfig>
   <ip> some ip adress </ip>
   <port>9933</port>
   <blueBoxIpAddress> some ip adress </blueBoxIpAddress>
   <blueBoxPort>8080</blueBoxPort>
   <smartConnect>true</smartConnect>
   <httpPort>8080</httpPort>
   <httpPollSpeed>750</httpPollSpeed>
   <zone>BuddyMessanger</zone>
</SmartFoxConfig>


Android client example connects to the server, so does the BuddyMessanger flash example.

Any suggestions ?
skipper3k
Posts: 20
Joined: 22 Feb 2012, 09:21

Re: ios compilation problems

Postby skipper3k » 22 Feb 2012, 15:05

Ok, the previous error is irrelevant...

What really happens is this error: SIGSYS

I created a completely new project, with only smartfox ios api imported, just like explained in documentation.
I created a Smartfox2XClient property. And I only call this code :

Code: Select all

    smartFox = [[SmartFox2XClient alloc] initSmartFoxWithDebugMode:NO delegate:self];
    [smartFox loadConfig:@"config.xml" connectOnSuccess:YES];


SIGSYS happens right after connection attempt and before the connection attempt returns to its delegate method. I should also mention if the ip is wrong, the app does not stop, but the onConnection delegation method returns not connected. I have the latest ios 1.0.1 framework and the latest Smartfox 2X server.

config.xml is the same as I mentioned above.
User avatar
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Re: ios compilation problems

Postby A51Integrated » 22 Feb 2012, 15:11

Can you tell me what XCode version you are using? Which SDK? and which target?

Also, make sure ARC is turned off - this is a Non-ARC release.
A51 Integrated

http://a51integrated.com / +1 416-703-2300
skipper3k
Posts: 20
Joined: 22 Feb 2012, 09:21

Re: ios compilation problems

Postby skipper3k » 22 Feb 2012, 15:18

Xcode version 4.2, Build 4D199.

Automatic reference counting is disabled. Arhitecture with the SIGSYS error was set to armv6. On armv7 I get a slightly different error, this one : EXC_BAD_INSTRUCTION
Base SDK is iOS 5.0
Apple LLVM compiler 3.0
Device target is set to iPhone only
Deployment target is set to iOS 5.0.

tnx, lk
User avatar
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Re: ios compilation problems

Postby A51Integrated » 22 Feb 2012, 15:36

OK. It looks as if there are some settings that may need to be adjusted - it's just hard to tell which ones without access to your XCode.

Base SDK -> Latest iOS (iOS 5.0)
Supported Platforms -> iphonesimulator iphoneos
Valid Architectures -> armv6 armv7
iOS Deployment Target -> iOS 5.0
Other Linker Flags -> -lxml2 -lz -ObjC
Header Search Paths -> /usr/include/libxml2

Make sure these frameworks are imported:
SFS2XAPI.framework
CFNEtwork.framework
UIKit.framework
Foundation.framework
CoreGraphics.framework

Clean the project and run.
A51 Integrated

http://a51integrated.com / +1 416-703-2300
skipper3k
Posts: 20
Joined: 22 Feb 2012, 09:21

Re: ios compilation problems

Postby skipper3k » 22 Feb 2012, 15:49

Sorry.. I still get EXC_BAD_INSTRUCTION on @autoreleasepool in AppDelegate.

I uploaded this simple test app. If you have any time, please take a look at it, maybe it will be more clear what is wrong with my app.
http://db.tt/b6ANo2G3

Are there any new ios examples available for the new release ?
User avatar
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Re: ios compilation problems

Postby A51Integrated » 22 Feb 2012, 16:00

I just tried your sample app and it compiles and connects successfully for me. The only thing I did was change the config.xml to:

Code: Select all

<SmartFoxConfig>
    <ip>127.0.0.1</ip>
    <port>9933</port>
    <udpHost>127.0.0.1</udpHost>
    <udpPort>9934</udpPort>
    <zone>simpleChat</zone>
    <debug>true</debug>
    <blueBoxIpAddress>127.0.0.1</blueBoxIpAddress>
    <blueBoxPort>9339</blueBoxPort>
    <smartConnect>true</smartConnect>
    <httpPort>8080</httpPort>
    <httpPollSpeed>750</httpPollSpeed>
    <rawProtocolSeparator>%</rawProtocolSeparator>
</SmartFoxConfig>
A51 Integrated

http://a51integrated.com / +1 416-703-2300
skipper3k
Posts: 20
Joined: 22 Feb 2012, 09:21

Re: ios compilation problems

Postby skipper3k » 22 Feb 2012, 16:29

I copy pasted the config file, and changed the ip and udpHost to my server ip 192.168.1.181 - its no secret, its a local dev machine.
Still get the same error. I'm posting a screenshot, and my server.xml configuration, because I don't know where to look for the problem anymore.

pretty much a standard server.xml config. Maybe there is a setting here I am missing.

Code: Select all

<serverSettings>
  <socketAddresses>
    <socket address="127.0.0.1" port="9933" type="TCP"/>
    <socket address="127.0.0.1" port="9933" type="UDP"/>
    <socket address="192.168.1.181" port="9933" type="TCP"/>
  </socketAddresses>
  <ipFilter>
    <addressBlackList>
      <string>1.2.3.4</string>
    </addressBlackList>
    <addressWhiteList>
      <string>127.0.0.1</string>
    </addressWhiteList>
    <maxConnectionsPerAddress>9999999</maxConnectionsPerAddress>
  </ipFilter>
  <flashCrossdomainPolicy>
    <useMasterSocketPolicy>true</useMasterSocketPolicy>
    <policyXmlFile>crossdomain.xml</policyXmlFile>
  </flashCrossdomainPolicy>
  <systemControllerThreadPoolSize>1</systemControllerThreadPoolSize>
  <extensionControllerThreadPoolSize>3</extensionControllerThreadPoolSize>
  <systemControllerRequestQueueSize>20000</systemControllerRequestQueueSize>
  <extensionControllerRequestQueueSize>20000</extensionControllerRequestQueueSize>
  <schedulerThreadPoolSize>3</schedulerThreadPoolSize>
  <protocolCompressionThreshold>1024</protocolCompressionThreshold>
  <protocolMode>BINARY</protocolMode>
  <useBinaryProtocol>true</useBinaryProtocol>
  <remoteAdmin>
    <administrators>
      <adminUser>
        <login>sfsadmin</login>
        <password>sfsadmin</password>
      </adminUser>
    </administrators>
    <allowedRemoteAddresses>
    </allowedRemoteAddresses>
    <adminTcpPort>9933</adminTcpPort>
  </remoteAdmin>
  <bannedUserManager>
    <isAutoRemove>true</isAutoRemove>
    <isPersistent>true</isPersistent>
    <customPersistenceClass></customPersistenceClass>
  </bannedUserManager>
  <extensionRemoteDebug>true</extensionRemoteDebug>
  <useFriendlyExceptions>true</useFriendlyExceptions>
  <mailer>
    <isActive>false</isActive>
    <mailHost>test.mail.com</mailHost>
    <mailUser>foo</mailUser>
    <mailPass>pippo</mailPass>
    <smtpPort>25</smtpPort>
    <workerThreads>1</workerThreads>
  </mailer>
  <webServer>
    <isActive>true</isActive>
    <cfgFile>config/jetty/jetty.xml</cfgFile>
    <blueBoxPollingTimeout>26</blueBoxPollingTimeout>
    <blueBoxMsgQueueSize>40</blueBoxMsgQueueSize>
  </webServer>
  <startExtensionFileMonitor>true</startExtensionFileMonitor>
  <useDebugMode>true</useDebugMode>
  <sessionMaxIdleTime>50</sessionMaxIdleTime>
  <userMaxIdleTime>300</userMaxIdleTime>
  <licenseCode></licenseCode>
  <licenseEmails></licenseEmails>
</serverSettings>


Image
User avatar
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Re: ios compilation problems

Postby A51Integrated » 22 Feb 2012, 16:47

Really hard to say, but from your project settings, look at "Framework Search Paths". You have some other entries in there. Make sure there is only one "$(SRCROOT)/.." and it's recursive (checked).

Again, the project is working fine for. I literally unzipped changed the config and ran it. The only warning I got was an unknown search path (above). SO remove those - the inherited one as well and let me know what happens.
A51 Integrated

http://a51integrated.com / +1 416-703-2300
skipper3k
Posts: 20
Joined: 22 Feb 2012, 09:21

Re: ios compilation problems

Postby skipper3k » 23 Feb 2012, 09:50

Hi,

just ran with proposed options deleted. Still get the same error. As does my coworker. We both have iPhone 4 devices, running 5.0.1 (9A405) - offical latest ios version. It also crashes on an iPad and a 3G S with the same ios version. I'll try to find a device with a lower ios version and post the result.

I also run this app in the simulator and it worked. It works on a flash app and in an android example on a device. It must be something with this particula

What device are you running on ?

Return to “SFS2X iPhone / iPad / OSX API”

Who is online

Users browsing this forum: No registered users and 17 guests